Introduction: DIY a Spelling Game With an Interactive Robot

Did you hear before about Social Robot? Did you you see the Pepper Robot or Jibo robot? These kinds of robots that can hear you, understand you and make a social contact with you via sound, facial expressions and body gestures. Social robots have various applications, specifically with elderly people, children and children with a lack in social interaction such as autism. The existence of social robot "physical body" not just a 3D avatar in screen has shown a valuable impact to people who use this kind of technology. The following instructable shows you a trial of developing a social robot(called Woody) which interactively plays a spelling game with you.

Woody consists of two parts:

  1. Woody body (head and LCD embedded to its body which holds the characters you write)
  2. Mobile application (basically 1sheeld app) that takes the characters input via keyboard and stores the sounds that woody produces.

More details are provided in the next steps.

Step 1: Game Scenario

The game scenario can be described as the following:

Start by the mobile side, via keyboard press 'Enter' to start the game. Woody will ask you to spell a word, you will provide the answer by click on the alphabets that best match what you heard. If you spelled the word correctly(wrote the characters correctly) then woody will congrats you. If you spelled it totally wrong then Woody will be angry of you and repeat the word again until you make it correctly. If you were almost there(only half of the word's characters or less are wrong) then Woody will encourage you by telling you that you are very close and make you another chances to correctly spell the word. Videos provided can show you the game and woody expressions through the game.

Step 2: Project Components

Specifically the components of the projects are:

  1. Arduino Uno
  2. 1Sheeld sheild (keyboard sheild abd music player shield)
  3. 2 Micro Servos (eyebrows)
  4. 1 Standard Servo (nick)
  5. LCD (16x2)
  6. breadboard, wires(female and male jumpers),power supply
  7. wood sheets, equipment for cutting the wood, glue

Step 3: 1Sheeld and Mobile Side App

If you explored the 1sheeld website you can figure out what this shield used for. It's about turning your smartphone to rich sensors and IO capabilities for Arduino chip. Put the shield on your Arduino, download the library on your Arduino environment and download the android mobile app into your mobile, and now you are ready to use all shield listed in 1sheeld website. Here we will use the keyboard and Music shields.

To use any of the available shields In the Arduino sketch:

  1. call the library
  2. begin the 1sheeld in the setup
#include <onSheeld.h> <br>void setup() { 
OneSheeld.begin();<br>}

Keyboard Shield

In our project all the Arduino sketch is based on the click of the user, the start is by clicking 'enter' key and for other clicks (alphabets) some comparisons take place and once the user finish enter the word, he/she will click 'enter again' to proceed to next level or to see his/her result.

In Arduino sketch:
void loop() {    
    AsciiKeyboard.setOnButtonChange(print_c);            
} 
  • setOnButtonChange function called each time you pressed a key in the keyboard shield.
  • print_c is a function that take characters as parameter and this character is the character that is clicked by the user for example:
void print_c(char c){
    if(c == '\n')
        //turn LED on
} //c here is the character which pressed by the user

Music Player Shield

For the sounds that Woody produces, we record some sounds and put them on the mobile, then by using the music shield we added the sounds in order that we can handle trough the code.

In Arduino sketch:
To play a sound you have to just write this line:

MusicPlayer.play();

to jump to the next or previous, will use the following code:

MusicPlayer.next(); /*OR*/ MusicPlayer.previous();

Step 4: LCD

LCD part supposed to display character by character for the user, when you click 'a', lcd should display 'a', when you enter 'p' then 'p' will be displayed beside the 'a'. So when you entered all the characters of the word, the whole word is there displayed on the LCD.

LCD Configuration

as LCD(16x2) the configuration of the pin as the following:

  • LCD: 1, 16 -- Arduino GND
  • LCD: 2,15 --Ardunio +5V
  • LCD: 3,5 --Ardunio GND
  • LCD : 4 -- Arduino Pin 7
  • LCD : 6 -- Arduino Pin 8
  • LCD : 11 -- Arduino Pin 9
  • LCD : 12 -- Arduino Pin 10
  • LCD : 13 -- Arduino Pin 11
  • LCD : 14 -- Arduino Pin 12

Arduino Sketch

#include <<liquidcrystal.h>
LiquidCrystal lcd(7,8,9,10,11,12);
void setup() {
   lcd.begin(16, 2);
}

To use LCD with the keyboard shield, we will update the print_c function so: *complete code provided at the final step

void print_c(char c){
if (c == '\n'){  //display result
	i=0;
}else{ // an alphabet
lcd.setCursor(i, 1); //where is the i is a global variable initialized by 0
lcd.print(c);
i++; }

Step 5: Servos and Face Expressions

For the eyebrow and nick, we handle 3 servos which connected to pins: 3,5,6 in Arduino and used a simple code that rotates the servos angles according to a specific input:

void moveServo(char c){
if(c== 'm'){    // upset
EeyebrowSL.write(120);
EeyebrowSR.write(60);
}else if(c == 'n'){ //normal
EeyebrowSL.write(90);
EeyebrowSR.write(90);
}else if (c == 'a' ){ //anger
EeyebrowSL.write(60);
EeyebrowSR.write(120);
moveNick();
}
delay(200);  
} 

Similarly the move nick code, was to rotate the nick to act like saying 'NO'. The center angle was 140 degree so we rotated 110 and 180 from the center. (rotate from center to 110, from 110 to 180 then back to the center)

void moveNick(){
delay(1000);
for(int k =0; k<2 ; k++){ //say 'NO' twice
for(int i =140; i>= 110 ; i--){
nickS.write(i);
delay(5);
}
for(int i =110; i<= 180 ; i++){
nickS.write(i);
delay(5);
}
for(int i =180; i>= 140 ; i--){
nickS.write(i);
delay(5);
}
}
}

Step 6: Complete Code & Sounds

Tech Contest

Participated in the
Tech Contest

Microcontroller Contest

Participated in the
Microcontroller Contest

Formlabs Contest

Participated in the
Formlabs Contest