edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
ashraf_minhaj
Published © GPL3+

Speech Controlled Robot

An Arduino robot that can be controlled using speech or voice!

IntermediateFull instructions provided3 hours19,280
Speech Controlled Robot

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
L298n motor driver
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Shematic

Code

Code snippet #1

Plain text
void setup()
{
  //initlize the mode of the pins
   pinMode(lm1,OUTPUT);
   pinMode(lm2,OUTPUT);
   pinMode(rm1,OUTPUT);
   pinMode(rm2,OUTPUT);

   //set the serial communication rate
   Serial.begin(9600);
}

Code snippet #3

Plain text
/**** Arduino Speech/voice Controlled robot ***
 *  by Ashraf Minhaj
 *  mail me at [email protected]
 *  tutorial- ashrafminhajfb.blogspot.com
 */

//Declare the arduino pins

int lm1 = 4;     //declare 1st motor pins
int lm2 = 5;

int rm1 = 2;    //right motor pins
int rm2 = 3;

char val;

void setup()
{
  //initlize the mode of the pins
   pinMode(lm1,OUTPUT);
   pinMode(lm2,OUTPUT);
   pinMode(rm1,OUTPUT);
   pinMode(rm2,OUTPUT);

   //set the serial communication rate
   Serial.begin(9600);


}

void loop()
{
  //check whether arduino is reciving signal or not 
  while(Serial.available() == 0);
  val = Serial.read() ;           //reads the signal
  //Serial.print(val);

  /*********For Forward motion*********/
  if (val == 'F')
  {
    //Serial.println("FORWARD");
    digitalWrite(lm1,HIGH);  
    digitalWrite(rm1,HIGH);
    digitalWrite(lm2,LOW);       
    digitalWrite(rm2,LOW);
  }

 
   /*********For Backward Motion*********/
  else if(val == 'B')
  {
    digitalWrite(lm2,HIGH);    
    digitalWrite(rm2,HIGH);
    digitalWrite(lm1,LOW);      
    digitalWrite(rm1,LOW);
  }
  
   /*********Right*********/
  else if(val == 'R')
  {
    digitalWrite(lm1,HIGH);  
    digitalWrite(rm2,HIGH);
    digitalWrite(lm2,LOW);       
    digitalWrite(rm1,LOW);
  }
  
   /*********Left*********/
  else if(val == 'L')
  {
    digitalWrite(lm2,HIGH);  
    digitalWrite(rm1,HIGH);
    digitalWrite(lm1,LOW);       
    digitalWrite(rm2,LOW);
  }

  /*********STOP*********/
  else
  {
    digitalWrite(lm1,LOW);  
    digitalWrite(rm1,LOW);
    digitalWrite(lm2,LOW);       
    digitalWrite(rm2,LOW);
  }

 delay(10);
  
}

Github

https://github.com/ashraf-minhaj/speech-controlled-robot

Credits

ashraf_minhaj
5 projects • 84 followers
Love to kill Soft things with Python and C++, Hard things with Soldering Iron.

Comments