Introduction: Easy to Make Talking Humanoid Robot!

About: A Computer Science and Engineering student and a Hobbyist. love to make robots,electric devices,diy things and Programming them by Myself. My youtube channel https://www.youtube.com/fussebatti Follow me on gi…

Everybody loves Talking Robots. It's like having a little pal to mess around with. If the robot is humanoid then it's more fun than ever. Among all other robots, humanoid robots suddenly become a 'he/she' instead of 'it'. Having a humanoid talking robot feels like awesome, but talking robots are seemingly complicated to make. Today I will talk about an approach that I followed to make one easily. Let's begin, shall we?

Step 1: Parts We Need

So the parts we need are simple. First picture contains all the major electronics. Later consists other too.

1. Arduino Pro mini / Arduino Nano

2. Micro sd TF module and micro SD card (2GB or less)

3. Servo motor - 3x

4. IR sensor (shown in pic1) - 3x

5. 7805 voltage regulator IC - 2x

6. Sound box/ mini speaker

7. 3.7V lipo batteries - 2x

8. Some male female headers

9. Jumper Wires

10. Ribbon Cable etc.

For making the body we need some

1. PVC sheets, preferably white color so that you can paint on them later.

2. Cutter knife and

3. Glue gun to glue things together.

That's it. Now proceed.

Step 2: Principle

Let's talk about what we are going to do before rushing to it. Yes, we are making a robot but let us learn something first so that we can teach others too.
Okay, to make a robot talk we can go through two methods (a) Speech Synthesis (b) Prerecorded audio. Among them option a doesn't perform understandably well with Arduino. So we are going for method b.

So, we make some Audio file (.wav) and save them into a SD card. The robot will have some joints to move with the help of servo motors. And some sensors to interact with the outside world. If the sensors detect something it/she will play the audio files. Like if I point at eyes she reacts and moves her head.

Step 3: Circuit Diagram

The circuit diagram is pretty straight forward. Connect all the

servo motors to Arduino digital pins.

TF module takes 6 pins and 4 digital pins.

Digital Pin 9 is for audio output, connect the speaker in that pin.

Tthe sensors have a voltage regulator for constant 5V power.

The whole system is powered using 2x 3.7V lithum batteries. So the board and servo motors get 7.4 volts.

The circuit may seem complex at some point. That's why I made a pcb and printed from PCBWay.com. I am using that PCB for the next version of this robot. The PCB quality is very good and that solved my issue too. Create an account there.

Visit this link and add to cart, or upload your own gerber file and place an order. You can order this robots pcb or any pcb 10 pieces in just 5$.

Click here to download the circuit diagram or pcb gerber files.

Step 4: Talk (Process Audio)

To make the audio files I used and Android application - Text to Speech (STT). The app lets you write text and save as wav file. You can change language, voice speed, pitch etc. After saving the audio files take them to your computer.

Then go to this site - audio.online-convert.com - to process the audio files for the last time. Go ahead and upload the audio file. Then set -

1. Bit resolution > 8 bit

2. Sampling rate > 16000Hz

3. Audio channel > mono

4. Click 'Advanced Options' and set pcm unsigned 8 bit.

After doing so copy the audio files into a Micro sd card. Do not save them into a folder, just paste them into sd card.

Note: Arduino can write on any sd card (I tested on 64GB) but Arduino can only read from 2GB or less memory containing sd card. So, do manage a sd card that has memory capacity not more than 2GB.

Step 5: Making the Body

This is the most cool part. As of my design you can see, you can shape it any ways you wish to. I used cardboard box to make the head, pvc sheets to make the entire body. Then painted it red. The circuitry and motor places can be seen in the pictures. I put 2 sensors on head and one sensor on chest. That's pretty much it. I used a ribbon cable on the back to connect head sensors and led with main board.

Go ahead and shape it any way you want.

Step 6: Programming the Robot (Code)

The code is simple enough to understand. The only problem was when I had to use the tmrpcm library to play audio using arduino the servo motors won't spin. It's because the servo and tmrpcm library both works on timer1 of Arduino. To overcome the problem I used servoTimer2 library. Download the library from here. Place it into your arduino library folder and include it. That's it.

Download the code from here or copy from below. I recommend downloading.

/*MOFIZA - The Humanoid Smart Robot made with just Arduino
 * By Ashraf Minhaj  ashraf_minhaj@yahoo.com
 * https://ashrafminhajfb.blogspot.com
 *http://youtube.com/c/fusebatti */
 
#include "ServoTimer2.h"      //declare ServoTimer2 library to run servo with TMRpcm
#include"SD.h"                //declare SD library for SD cards
#define SD_ChipSelectPin 10   //select sd chip select pin 10
#include"TMRpcm.h"            //library to play audio from sd card by arduino
#include"SPI.h"              //create Serial peripheral Interface Communication
TMRpcm tmrpcm;              //name tmrpcm
ServoTimer2 head;           //declare Head servo followed by left right hand servos
ServoTimer2 lhand;
ServoTimer2 rhand;

int in1= 6;               //declare Infrared sensor pins
int in2= 7;
int in3= 8;

void setup() 
{
 head.attach(2);        //attach servos to pins
 lhand.attach(3);
 rhand.attach(4);
 tmrpcm.speakerPin=9;   //Speaker pin 9,audio out pin is 9
 
 Serial.begin(9600);    //initialize Serial communication
 
 if(!SD.begin(SD_ChipSelectPin))   //this runs until SD is connected
 {
  Serial.println("SD FAIL");
  return; 
 }

}

void loop() 
{
  if(!(digitalRead(in3)))          //Chest sensor is low- Say "Hi there.."
  {
   tmrpcm.play("welcome.wav");     //Playing audio saved as 'welcome.wav'
    lhand.write(2500);            //hand up- saying HI
    delay(2000);
    lhand.write(1200);            //hand comes to handshake position
    
    delay(9000);
    
  }
 
  if(!(digitalRead(in1)))       //Sensor on eye gets low play audio -"dont touch my eye"
  {
    tmrpcm.play("dont_touch_eye.wav");     //play file saved as "dont.wav" - dont touch my eye 
    rhand.write(300);            //hand up
    head.write(2000);
    delay(3000);
  }
 
  if(!(digitalRead(in2)))     //Sensor on eye gets low play audio -"dont touch my eye"
  {
    tmrpcm.play("dont_touch_eye.wav");
    lhand.write(2000);
    head.write(1000);
    delay(3000);
  }
 
 else             //No input detected - keep the robot steady.
 {
  
  lhand.write(300);
  rhand.write(1700);
  head.write(1500);
 }
}

Upload the code and test it.

Step 7: Finish!

That's it. Power the robot using 7.4V DC source and have fun. The audio can be hard to hear, if so then use any audio amplifier to amplify the sound. Now you have a talking humanoid robot pal!

Robots Contest

Participated in the
Robots Contest