Talking Robot Vintage

bulb, 4k wallpaper 1920x1080, beautiful wallpaper-5665770.jpg

In this lesson we will learn how to create a robot that talks by adding the Baby module to the robot and adding a library to Arduino. Our robot then will speak some words in the defined order , so it will be a text to speech machine. If you have done the previous lessons you don’t need to change your robot much, if you have your 2WD robot, use M3 instead of M1 motor by addressing the pins of M3 instead of M1 and changing the motor connections, if you have a 4WD robot, make it 4 on 2 WD by connecting M1 and M3 motors to M3 terminal and M2 and M4 to M4 terminal and change the code accordingly ,and skip steps 1 to 11, except step .

Estimated time: 15 minutes

You will learn about:

Adding A Library

 Including a Library

Code Sequence

Components Needed

Main Boardarduino, electronic, card-5170681.jpgUSB Cable
Arduinohand, reach, reaching-5961660.jpgBodymercedes-benz, car, clocks-1464852.jpg
Baby Setgears, bulb, innovation-1443730.jpg3 pieces Female to male wiresmegaphone, speaker, speak-2374502.jpg
Hoodhand, reach, reaching-5961660.jpg10 pieces M3 x 10 Screwstechnology, robot, futuristic-3940288.jpg
2 pieces Spacerscontroller, playstation, hand-852271.jpg4 pieces Lock Washersbridge, illuminated, multicoloured-1092256.jpg
2 Pieces Flat Washers imac, apple, mockup-606765.jpg2 pieces M4 x 45 screwsspeech icon, voice, talking-2797263.jpg
8 pieces M4 hex nutselectronics, circuit board, computer-1607250.jpg4 pieces M4 nylon Washershand, reach, reaching-5961660.jpg
2 pieces M4 Lock Washersmercedes-benz, car, clocks-1464852.jpg4 pieces M4 Flat Washersasphalt, nature, street-2178703.jpg
Pliersbridge, illuminated, multicoloured-1092256.jpgScrew Drivermars, mars rover, space travel-67522.jpg
Pliersmegaphone, speaker, speak-2374502.jpg6 pieces/ M3 x 30 Screws
10 pieces/ M3 Hex Nutmegaphone, speaker, speak-2374502.jpg
Step 1:

Install Mainboard on the body [|] For that, you need to use M3 x 10 screws in the installation holes with Nylon washers touching the Mainboard, [|], then using flat washers touching body and nylon washers and lock washers after that and then hex nut.] using screw driver and pliers.

Step 2:

Install the Caster Wheel on the Main Board using M4 Screws Like here.

Step 3:

Install the motors on the both sides of the body [|] We use the in body configuration for motors][|], Where the Wires of the motors come out of them should face the walls.] using 6 M3 x 30 screws, 12 flat washers , 6 lock washers and 6 hex nuts.

Step 4:

Make sure the Jumper cap of 3C is disconnected so pin 3 remains isolated.

Step 5:

Connect [|] For that, you need to place the Arduino on top of the Arduino pin headers [|], the USB port of it facing the edge of the board, and while you can see the access pins of the pinheader at both sides of the Arduino board, then push it in place to ensure the board is in place.] the Arduino to the Main board.

arduino, electronic, card-5170681.jpg
Step 5:

Plug in the USB cable[|] the USB type B to Micro USB, which you can get from a cellphone charger also] to the Micro USB port of Arduino and then plug it to the USB port of the computer.

usb, logo, input-1773302.jpg
Step 6:

Add the “Talkie” Library [|] Libraries are files which provide your codes with extra functionality.So instead of writing many lines of code to for example do a task or use a module, we use a library, write the needed codes and use keywords to interact with those extra codes. There is at least two files in a library: a header file (with the extension .h) and the source file (with extension .cpp). The header file has definitions for the library: basically a listing of everything that’s inside; while the source file has the actual code.] to the Arduino IDE.

Step 7:

Upload [|] Follow this] the following code to the Arduino.

// Talkie library
// Copyright 2011 Peter Knight
// This code is released under GPLv2 license.

// Welcome to the Talkie library examples.
// Talkie is a speech synthesiser that works from a fixed vocabulary.
// There are hundreds of words in the 'Vocabulary' examples.

 * Voice PWM output pins for different ATmegas:
 *  ATmega328 (Uno and Nano): non inverted at pin 3, inverted at pin 11.
 *  ATmega2560: non inverted at pin 6, inverted at pin 7.
 *  ATmega32U4 (Leonardo): non inverted at pin 10, inverted at pin 9.
 *  ATmega32U4 (CircuitPlaygound): only non inverted at pin 5.
 *  As default both inverted and not inverted outputs are enabled to increase volume if speaker is attached between them.
 *  Use Talkie Voice(true, false); if you only need not inverted pin or if you want to use SPI on ATmega328 which needs pin 11.
 *  The outputs can drive headphones directly, or add a simple audio amplifier to drive a loudspeaker.
#include <Arduino.h>

#include "Talkie.h"
#include "Vocab_US_Large.h"

Talkie voice;

void setup() {

void loop() {

Step 8:

Remove the USB cable from the USB port of Arduino.

Step 9:

Connect the motor wires to M3 and M4 Screw terminal using the screw driver. The red wire goes to The Terminals closer to Cellpack, the black wires goes to the terminals away from Cellpack.

Step 10:

Install the baby set on top of the M4 x 45 screws using M4 nuts and use the female to male wires to connect the wire from pin 3 of Arduino to pin “S” of the amplifier module in the Baby set, “5V” pin of Arduino to “VCC” pin of the amplifier module and “GND” pin of Arduino to “GND” pin of the amplifier module.

Step 11:

Install the spacers by removing the two screws at the hood part of the robot and placing the spacers on top and fastening the screws from beneath having the Nylon washers touching the Mainboard and flat washer and spring washers under it .

Step 12:

Install the Hood on the body with M3 x 10 screws.

Step 13:

Install the Cellpack in its place [|] and connect the DC power jack Connector to female DC connector on the Mainboard.

Step 14:

Put the 2C , 4C and 5C Jumper Caps [|] in the connecting state so the two corresponding pins connect to each other, make sure 3C jumper cap is disconnecting.

Step 15:

Turn the Cellpack on [|] and check the voice of the robot, we have this code running only once because it’s in the void setup part , so if you want to hear that again press the reset button.

Congratulations! You have your own Robot now.

Step 16:

If the Sound isn’t loud enough, use the screwdriver to turn the potentiometer on the amplifier module at the back of the Baby set to adjust volume.

Code Explanation
  • In lines 13 to 24, [|]
  • In line 25 ,[|] we recall the Arduino.h library which is an internal library and doesn’t need adding by us, which allows us to interact with the other library] .
  • In line 27,[|] we we recall the “Talkie” header file in the Talkie library.] .
  • In line 28,[|] we recall the “Vocab_US_Large.h” header file in the library which contains US accent files listing for our code.] .
  • In line 30,[|] we start a Talkie event or basically turn on the library usage in our code. these are predefined keywords in our library.] .
  • In lines 34 to 47,[|] we recall the files that contain the signals which will create our words and put them in a sequence that playing them one by one create our sentence.] .
  • In line 50 to 51,[|] we can see that the void loop part of the code is empty which means we don’t have anything that we need to repeat again and again.] .
Further Experimentation
  • Try cutting everything in void setup code , and pasting it in the void loop part and upload the code and see what happens.
  • Try using delays to make the speech more natural.
  • Try to mix this code with the 2WD robot or 4WD robot to make your robot report it’s heading.
  • Try building your own sentences picking the file names from the following list and pasting in the code:

To see the list click [Here]

    Practical Usage For our Projects
    • We will use the talking robot wherever we need our robot to have a voice but don’t want to or can’t use the card reader module in the robot, also there are times that we want a notification without using display or connecting Arduino to computer, we can use this configuration there.
    X (Twitter)
    Scroll to Top