Issac Thomas
Published © GPL3+

Spresense Bot

Ever thought of creating a voice controlled robot using Spresense and Donkey Car Kit? This is the right place to get it done!

EasyFull instructions provided5 hours275
Spresense Bot

Things used in this project

Hardware components

Spresense boards (main & extension)
Sony Spresense boards (main & extension)
×1
Breadboard (generic)
Breadboard (generic)
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Dual H-Bridge motor drivers L293D
Texas Instruments Dual H-Bridge motor drivers L293D
×1
Chassis
×1
DC motor (generic)
With gear box and wheels
×2
Resistor 2.21k ohm
Resistor 2.21k ohm
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Male/Male Jumper Wires
×20

Software apps and online services

Arduino IDE
Arduino IDE
Sony Spresence Library for Arduino IDE
AMR Voice Application
Download The AMR_Voice Application in your Android Smartphone

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
To Solder Wires to Motor

Story

Read more

Code

Spresence Code for Voice Controlled Robot

C/C++
Simply upload this code to the Spresence Board
String voice;
int
M11 = 13, //Connect C1-A of Motor Driver Module To Pin #13
M12 = 12, //Connect C1-B of Motor Driver Module To Pin #12
M21 = 11, //Connect C2-A of Motor Driver Module To Pin #11
M22 = 10; //Connect C2-B of Motor Driver Module To Pin #10

//--------------------------Call A Function-------------------------------//
void forward() {
  digitalWrite(M11, HIGH);
  digitalWrite(M12, LOW);
  digitalWrite(M21, HIGH);
  digitalWrite(M22, LOW);
}

void backward() {
  digitalWrite(M11, LOW);
  digitalWrite(M12, HIGH);
  digitalWrite(M21, LOW);
  digitalWrite(M22, HIGH);

}
void left() {
  digitalWrite(M11, LOW);
  digitalWrite(M12, LOW);
  digitalWrite(M21, HIGH);
  digitalWrite(M22, LOW);
}
void right() {
  digitalWrite(M11, HIGH);
  digitalWrite(M12, LOW);
  digitalWrite(M21, LOW);
  digitalWrite(M22, LOW);
}
void stay() {
  digitalWrite(M11, LOW);
  digitalWrite(M12, LOW);
  digitalWrite(M21, LOW);
  digitalWrite(M22, LOW);
}

//-----------------------------------------------------------------------//
void setup() {
  Serial.begin(9600);
  pinMode(M11, OUTPUT);
  pinMode(M12, OUTPUT);
  pinMode(M21, OUTPUT);
  pinMode(M22, OUTPUT);

}
//-----------------------------------------------------------------------//
void loop() {
  while (Serial.available()) { //Check if there is an available byte to read
    delay(10); //Delay added to make thing stable
    char c = Serial.read(); //Conduct a serial read
    if (c == '#') {
      break; //Exit the loop when the # is detected after the word
    }
    voice += c; //Shorthand for voice = voice + c
  }
  if (voice.length() > 0) {
    Serial.println(voice);
    //-----------------------------------------------------------------------//
    //----------Control Multiple Pins/ LEDs----------//
    if (voice == "*forward") {
      forward(); //Move Robot Forward (Call Function)
    }
    else if (voice == "*backward") {
      backward(); //Move Robot Backward (Call Function)
    }
    else if (voice == "*left") {
      left(); //Move Robot Left (Call Function)
    }
    else if (voice == "*right") {
      right(); //Move Robot right (Call Function)
    }
    else if (voice == "*stop") {
      stay(); //Stop Robot (Call Function)
    }


    //-----------------------------------------------------------------------//
    voice = "";
  }
} //Reset the variable after initiating

Credits

Issac Thomas

Issac Thomas

2 projects • 3 followers
Electronics Hobbyist, Prototype Hacker, Developer

Comments