The Blog

 

Co-authored by Reema AlMeshari

In this blog post, we are going to share our project experience about teaching a little cute robot how to play Rock, Paper, Scissors.

TJBot

TJBot explained

TJBot was born in 2016 at IBM Research. It consists of a cartoon or a 3D-printed body, Raspberry Pi, a camera, speakers, microphone, RGB LED light, and servo motor — assembled together, resulting in a robot that can see, speak, listen, and wave.

When TJBot arrived in Saudi Arabia, he was nicknamed “Saudbot.” Saud is excited to learn new things and explore the world around him.

The first game he learned is Rock, Paper, Scissors. We got inspired by JeanCarl Bisson, a developer advocate from IBM.

The Game

Dashboard Screenshot

The picture shown above is the dashboard of the game. First, the player presses the Play button to start the game. Then, Saudbot will say the game rules to the player. Afterward, it will count down from three to one, and the player will play his move in front of the Saudbot camera to take picture of it. Later, Saudbot will say his move and who won. Finally, the scoreboard on the dashboard will be updated by the result.

Architecture

We are using different services in this game: Node-RED on IBM Cloud, Node-RED on Raspberry Pi, Watson™ Visual Recognition, Watson Text to Speech, and Watson IoT™.

flow-diagram

The flow goes like this:

  1. Player presses Play
  2. Publish IoT play command
  3. Subscribe to play command
  4. Synthesize game rules
  5. Classify move
  6. Publish IoT event
  7. Display score
  8. Persist history in storage
  9. Synthesize game result

Watson Visual Recognition

TJbot-figure3

Saud uses IBM’s Watson Visual Recognition to help him identify the player move. The service is trained with three classes: a rock class, a paper class, and a scissors class. This was the fun part — where we asked the team to give us a hand!

We trained each class with about 25 images, and the more you add images the better it becomes.

Experience using Node-RED and Watson IoT

We created an IoT platform service to connect our Raspberry Pi to it. This creates a Node-RED application we used to build our dashboard.

The Node-RED dashboard flow is running on the cloud, built using nodes from the node-red-dashboard palette.

Node-RED-Dashboard-Flow

The other Node-RED flow is on Raspberry Pi to control its logic. First, you have to set up Node-RED on the Raspberry Pi; follow the steps to do so. Then you can start building programs using nodes.

Node-RED-Raspberry-Pi-Flow

Using Watson IoT and Node-RED made programming objects more fun and less complex with less time, which is why we think projects like this present a great value for teaching young people how to make cognitive objects and enable them to innovate.

In the future, we plan to make Saud learn new things and interact more with the people in the office.