Project showcase
Talking Robot Based on Arduino

Talking Robot Based on Arduino © GPL3+

Add an audio breakout to a robot to make it talk.

  • 2,740 views
  • 1 comment
  • 7 respects

Components and supplies

Necessary tools and machines

Apps and online services

About this project

We will add audio to the "Make your own robot" project. We will make our talking robot with artificial intelligence based on Arduino. In our previous project we made our robot we checked into the phone’s voice command. In this project we develop our robot, in the same way again, we’ll send voice answer the phone and give us a voice. This way, your robot will speak to you. You can also make an educational robot for kids. For example, an integrated robot that detects colors and say the name out loud.

In addition to our practice here, we will make our robot respond to voice commands to control the robot add the voice answering feature. For example, we go forward in response to our robot ‘going forward’ he could say the name or the answer we say ‘my name is Roby’ could say. You can download the audio file you want to modify that answer.

Materials

You can get our robot kits for part of the chassis or toy robot can use the chassis and engine of an RC car.

Wiring

Wtv020 SD card reader module supports the mevcut modül AD4 file format. Before making the file extension .wav audio files then convert the AD4 format.

The names of audio files must be in the form of numbers. The name of each file in the example software are numbered. I’ll be posting a video of the project’s work in the coming days.

Code

Code snippet #1C/C++
// Arduino Artificial Intelligence Based Talking Robot By Robimek
//Software developer By Sezgin Gül
//www.robimek.com
#include <Servo.h>
#include <NewPing.h>
#include <Wtv020sd16p.h>
int resetPin = 13; 
int clockPin = 11;
int dataPin = 12; 
int busyPin = 10; 
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);
String voice;
//motor pinleri
#define SolMotorileri 6
#define SolMotorGeri 5
#define SagMotorileri 8
#define SagMotorGeri 9
#define led 53
#define ledmavi 51
#define ledyesil 49
#define ledkirmizi 45
#define ledvcc 47
#define tx 1
#define rx 0
//sensör pinleri
#define USTrigger 3
#define USEcho 2
#define Maksimum_uzaklik 100
 
 
Servo servo; //servo motor tanımlama
NewPing sonar(USTrigger, USEcho, Maksimum_uzaklik);//ultrasonik sensör tanımlama
//kullanılacak eleman tanımı
unsigned int uzaklik;
unsigned int on_uzaklik;
unsigned int sol_uzaklik;
unsigned int sag_uzaklik;
unsigned int zaman;
// program ilk çalıştığında sadece bir kez çalışacak programlar
void setup() 
{
Serial.begin(9600); //iletişim ayarı
//motor çıkışları
 pinMode(SolMotorileri, OUTPUT);
 pinMode(SolMotorGeri, OUTPUT);
 pinMode(SagMotorileri, OUTPUT);
 pinMode(SagMotorGeri, OUTPUT);
 pinMode(led, OUTPUT);
 pinMode(ledkirmizi, OUTPUT);
 pinMode(ledmavi, OUTPUT);
 pinMode(ledyesil, OUTPUT);
 pinMode(ledvcc, OUTPUT);
 
 servo.attach(4); //servo pin tanımı 
 wtv020sd16p.reset();
 wtv020sd16p.playVoice(0);
 wtv020sd16p.playVoice(13);
 delay(10000);
 wtv020sd16p.playVoice(14); 
 
 
}
// sonsuz döngü
void loop() {
 
 while (Serial.available()){ //Okumak için kullanılabilir bayt olup olmadığını kontrol et
 delay(10); //10 milisaniye bekle
 char c = Serial.read(); //Seri okuma
 if (c == '#') {break;} // # tespit edildiğinde döngüden çık
 voice += c; //Ses = ses + c Steno 
 }
 
 if (voice.length() > 0) {
 Serial.println(voice); 
 
 if(voice == "*ileri"||voice == "*ileri git") 
 {wtv020sd16p.playVoice(3);
 ileri();} 
 else if(voice == "*geri"||voice == "*geri gel")
 {wtv020sd16p.playVoice(2);
 geri();}
 else if(voice == "*sağa dön"||voice == "*sağ") 
 {wtv020sd16p.playVoice(7);
 sag();} 
 else if(voice == "*sola dön"||voice == "*sol") 
 {wtv020sd16p.playVoice(1);
 sol();}
 else if(voice == "*dur"||voice == "*arabayı durdur") 
 {dur();
 wtv020sd16p.playVoice(11);}
 else if(voice == "*sol ileri")
 {sol(); 
 delay(100); 
 ileri();}
 else if(voice == "*sağ ileri")
 {sag(); 
 delay(100); 
 ileri();}
 else if(voice == "*sol geri")
 {sol(); 
 delay(100);
 geri();}
 else if(voice == "*sag geri")
 {sag(); 
 delay(100); 
 geri();}
 else if(voice == "*ileri git dur"||voice == "*biraz ileri git") 
 {ileri(); 
 delay(1000); 
 dur();} 
 else if(voice == "*geri gel dur"||voice == "*biraz geri gel") 
 {geri();
 delay(1000); 
 dur();}
 else if(voice == "*sola dön dur"||voice == "*biraz sola dön") 
 {sol(); 
 delay(300);
 dur();}
 else if(voice == "*sağa dön dur"||voice == "*biraz sağa dön") 
 {sag();
 delay(300);
 dur();}
 else if(voice == "*sola bak"||voice == "*soluna bak") 
 {wtv020sd16p.playVoice(8);
 solabak();}
 else if(voice == "*sağa bak"||voice == "*sağına bak"||voice == "*sabah") 
 {wtv020sd16p.playVoice(6);
 sagabak();}
 else if(voice == "*önüne bak"||voice == "*öne bak") 
 {wtv020sd16p.playVoice(5);
 onunebak();}
 else if(voice == "*ışığı aç"||voice == "*ledi yak")
 {wtv020sd16p.playVoice(4);
 ledyak();}
 else if(voice == "*ışığı kapat"||voice == "*ledi söndür") 
 {digitalWrite(51,HIGH);
 digitalWrite(49,HIGH); 
 digitalWrite(45,HIGH); 
 digitalWrite(47,LOW);}
 else if(voice == "*kırmızı") 
 {digitalWrite(45,LOW);
 digitalWrite(49,HIGH);
 digitalWrite(51,HIGH);
 digitalWrite(47,HIGH);}
 else if(voice == "*yeşil") 
 {digitalWrite(49,LOW);
 digitalWrite(45,HIGH);
 digitalWrite(51,HIGH);
 digitalWrite(47,HIGH); }
 else if(voice == "*mavi")
 {wtv020sd16p.playVoice(4);
 digitalWrite(51,LOW);
 digitalWrite(49,HIGH);
 digitalWrite(45,HIGH);
 digitalWrite(47,HIGH);}
 else if(voice == "*mor") 
 {digitalWrite(51,LOW); 
 digitalWrite(49,HIGH); 
 digitalWrite(45,LOW);
 digitalWrite(47,HIGH);}
 else if(voice == "*beyaz") 
 {digitalWrite(51,LOW); 
 digitalWrite(49,LOW); 
 digitalWrite(45,LOW);
 digitalWrite(47,HIGH);}
 else if(voice == "*engel"||voice == "*engel algıla")
 {wtv020sd16p.playVoice(0);
 engel();
 delay(5000);
 dur();}
 else if(voice == "*merhaba")
 { wtv020sd16p.playVoice(9);}
 else if((voice == "*müziği kapat")||(voice == "*kapat"))
 { wtv020sd16p.reset();
 wtv020sd16p.stopVoice();} 
 else if((voice == "*müziği aç")||(voice == "*şarkı söyle")||(voice == "*muzik"))
 { wtv020sd16p.playVoice(12);} 
 voice="";
 }
 }
 
 
// robotun yön komutları
void ileri() 
{
 digitalWrite(SolMotorGeri, LOW);
 digitalWrite(SolMotorileri, HIGH);
 digitalWrite(SagMotorGeri, LOW);
 digitalWrite(SagMotorileri, HIGH);
}
 
void geri() 
{
 digitalWrite(SolMotorileri, LOW);
 digitalWrite(SolMotorGeri, HIGH);
 digitalWrite(SagMotorileri, LOW);
 digitalWrite(SagMotorGeri, HIGH);
}
 
void sag() 
{
 digitalWrite(SolMotorileri, HIGH);
 digitalWrite(SolMotorGeri, LOW);
 digitalWrite(SagMotorGeri, HIGH);
 digitalWrite(SagMotorileri, LOW);
 }
 
void sol() 
{
 digitalWrite(SolMotorGeri, HIGH);
 digitalWrite(SolMotorileri, LOW);
 digitalWrite(SagMotorileri, HIGH);
 digitalWrite(SagMotorGeri, LOW);
}
 
void dur() 
{
 digitalWrite(SolMotorGeri, LOW);
 digitalWrite(SolMotorileri, LOW);
 digitalWrite(SagMotorileri, LOW);
 digitalWrite(SagMotorGeri, LOW);
}
void sagabak()
{
 servo.write(0);
 delay(100);
}
void solabak()
{
 servo.write(180);
 delay(100);
}
void onunebak()
{
 servo.write(90);
 delay(100);
}
void ledyak()
{
 digitalWrite(53,HIGH);
 }
void ledkapat()
{
 digitalWrite(53,LOW);
 }
// sensörün mesafe ölçümü
void sensor_olcum() 
{
 delay(50); 
 zaman = sonar.ping(); 
 uzaklik = zaman / US_ROUNDTRIP_CM;
}
void engel()
{
 delay(500);
 servo.write(90); 
 sensor_olcum(); 
 on_uzaklik = uzaklik; 
 if(on_uzaklik > 35 || on_uzaklik == 0) 
 {
 ileri(); 
 } 
 else
 {
 dur(); 
 servo.write(180); 
 delay(500); 
 sensor_olcum(); 
 sol_uzaklik = uzaklik; 
 servo.write(0); 
 delay(500); 
 sensor_olcum(); 
 sag_uzaklik = uzaklik;
 servo.write(90);
 delay(500); 
 if(sag_uzaklik < sol_uzaklik) 
 {
 sol(); 
 delay(500);
 ileri(); 
 }
 else if(sol_uzaklik < sag_uzaklik) 
 {
 sag(); 
 delay(500);
 ileri(); 
 }
 else
 {
 geri(); 
 } 
 }
 }

Schematics

Xk5BDZMqdvfu66ahSXfJ.png
Xk5bdzmqdvfu66ahsxfj

Comments

Similar projects you might like

Amazing 6WD Off-Road Robot | Arduino RC Robot

Project tutorial by Jithin Sanal

  • 8,851 views
  • 0 comments
  • 53 respects

IoT Based Homemade Robot with Android and Voice Control Tech

Project showcase by Md Amirul Islam

  • 1,685 views
  • 0 comments
  • 5 respects

Voice-Controlled Robot

Project tutorial by Łukasz Budnik

  • 16,664 views
  • 2 comments
  • 41 respects

Voice-Controlled Robot - Google Cloud Services

Project tutorial by Łukasz Budnik

  • 11,933 views
  • 4 comments
  • 33 respects

Voice-Controlled Pick-and-Place Robot

by Sagar pawar

  • 3,310 views
  • 0 comments
  • 11 respects
Add projectSign up / Login