Project tutorial
Voice Controlled Robot using your Smart Phone

Voice Controlled Robot using your Smart Phone © GPL3+

Now you can control your Robot using voice commands like move forward the robot moves forward, move back and so on.

  • 4,195 views
  • 0 comments
  • 9 respects

Components and supplies

About this project

Now you can control your robot using your smart phone just say commands like move forward, move back, etc...

Essentials:

  • 1Sheeld board and android smart phone/ Tablet
  • Any Arduino board (in this project i used Arduino UNO)
  • Rover 5 or any RC car
  • Rover 5 motor driver board
  • Jumpers

Motor driver explained:

This motor driver can be controlled by simply applying a logic 0 or 1 to the direction pin for that motor and a PWM signal to the speed pin. In this way, the speed and direction of four separate motors can be controlled independently from only 8 GPIO pins. For more details you can check User Manual.

1Sheeld Explained:

1Sheeld Android Smartphone Multi-Purpose Shield is an easily configured shield for Arduino. It is connected to a mobile app that allows the use of all of Android smartphones' capabilities such as LCD Screen, Gyroscope, Switches, LEDs, Accelerometer, Magnetometer, GSM, Wi-Fi, GPS …etc. into your Arduino sketch.

How to use 1Sheeld?

1- Stack 1Sheeld on top of your Arduino board, and write the code using 1Sheeld library.

2- Pair 1Sheeld board with 1Sheeld app over bluetooth.

3- Select the shields from a list of over 40 shields.

For more information, visit 1Sheeld Tutorials Archive.

How to Connect the Circuit??

As shown in the previous photo connect motor 1 and motor 2.

for channel 1 connect pin 4 in Arduino to Direction pin and pin 5 in Arduino to PWM pin. Then for channel 2 connect direction pin to pin 7 in Arduino and pwm pin to pin 6 in Arduino.

Note that we connect pwm pins in motor drivers to pins 5,6 pins in arduino as these pins in Arduino are PWM pins.

How it Works?

Open 1Sheeld app, connect it with 1Sheeld then choose voice recognizer shield,

When you say move forward then the robot move forward.

When you say move back it moves back.

When you say left it turn left.

When you say right it turn right.

When you say stop then it will stop.

Check this video

Code

Arduino code Arduino
#define CUSTOM_SETTINGS
#define INCLUDE_VOICE_RECOGNIZER_SHIELD
#define INCLUDE_TERMINAL_SHIELD

/* motor driver pins */
#define DIRECTIONA 4
#define MOTORA 5
#define DIRECTIONB 7
#define MOTORB 6


/* Include 1Sheeld library. */
#include <OneSheeld.h>

/* Voice commands set by the user. */
const char moveCommand[] = "move forward";
const char leftCommand[] = "left";
const char rightCommand[] = "right";
const char backCommand[] = "move back";
const char stopCommand[] = "stop";

/* go forward function */
void forward()
{
      digitalWrite(DIRECTIONA,0);
      digitalWrite(DIRECTIONB,1);
      analogWrite(MOTORA,200);
      analogWrite(MOTORB,200);
}//end of forward function

/* go back function*/
void back()
{
      digitalWrite(DIRECTIONA,1);
      digitalWrite(DIRECTIONB,0);
      analogWrite(MOTORA,200);
      analogWrite(MOTORB,200);
}//end of back function

/* turn left function */
void left()
{
      digitalWrite(DIRECTIONA,0);
      digitalWrite(DIRECTIONB,0);
      analogWrite(MOTORA,200);
      analogWrite(MOTORB,200);
}//end of left function

/* turn right function*/
void right()
{
      digitalWrite(DIRECTIONA,1);
      digitalWrite(DIRECTIONB,1);
      analogWrite(MOTORA,200);
      analogWrite(MOTORB,200);
}//end of void right function

/* stop function */
void stop()
{
      digitalWrite(DIRECTIONA,1);
      digitalWrite(DIRECTIONB,1);
      analogWrite(MOTORA,0);
      analogWrite(MOTORB,0);
}//end of stop function

void setup() {

  /* Start Communication. */
  OneSheeld.begin();
  /* Error Commands handiling. */
  VoiceRecognition.setOnError(error);
  
  VoiceRecognition.start();
  
  /* motors pins */
  pinMode(MOTORA, OUTPUT);
  pinMode(DIRECTIONA, OUTPUT);
  pinMode(MOTORB, OUTPUT);
  pinMode(DIRECTIONB, OUTPUT);

}//end of setup function

void loop() {

   /* Check if new command received. */
  if(VoiceRecognition.isNewCommandReceived())
  {
    /* Compare the forward command. */
    if(!strcmp(moveCommand,VoiceRecognition.getLastCommand()))
    {
      /* go forward. */
      forward();
    }//end of if
    /* compare turn left command. */
    else if (!strcmp(leftCommand,VoiceRecognition.getLastCommand()))
    {
      /* turn left. */
      left();
    }//end of else if
    /* Compare the turn right command. */
    else if (!strcmp(rightCommand,VoiceRecognition.getLastCommand()))
    {
      /* turn right. */
      right();
    }//end of else if 
    /* Compare the move back command. */
    else if (!strcmp(backCommand,VoiceRecognition.getLastCommand()))
    {
      /* go back */
      back();
    }//end of else if
    /* Compare the stop command. */
    else if (!strcmp(stopCommand,VoiceRecognition.getLastCommand()))
    {
      /* go back */
      stop();
    }//end of else if
  }//end of main if 
  
}//end of loop function

/* Error checking function. */
void error(byte errorData)
{
  /* Switch on error and print it on the terminal. */
  switch(errorData)
  {
    case NETWORK_TIMEOUT_ERROR: Terminal.println("Network timeout");break;
    case NETWORK_ERROR: Terminal.println("Network Error");break;
    case AUDIO_ERROR: Terminal.println("Audio error");break;
    case SERVER_ERROR: Terminal.println("No Server");break;
    case SPEECH_TIMEOUT_ERROR: Terminal.println("Speech timeout");break;
    case NO_MATCH_ERROR: Terminal.println("No match");break;
    case RECOGNIZER_BUSY_ERROR: Terminal.println("Busy");break;
  }//end of switch 
}//end of error function

Schematics

motor driver
Dagu%20controller

Comments

Similar projects you might like

2WD Voice Controlled Robot with Arduino and BitVoicer Server

Project tutorial by Marcio Tamagushi

  • 10,208 views
  • 11 comments
  • 32 respects

Control your Light System Using Smart Phone

Project tutorial by Ahmed Yassin

  • 35,276 views
  • 4 comments
  • 55 respects

Voice Assistant Using A Smart Phone And 1Sheeld

Project tutorial by Oguz Salar

  • 1,531 views
  • 0 comments
  • 5 respects

Control Robot Arm with your Android Phone

Project tutorial by Ammar Atef Ali

  • 12,494 views
  • 0 comments
  • 25 respects

smart robot

Project in progress by Team Arduino Arab

  • 3,174 views
  • 1 comment
  • 9 respects

Hand Gesture Controlled Robot

Project tutorial by Mayoogh Girish

  • 54,939 views
  • 78 comments
  • 65 respects
Add projectSign up / Login