Bluetooth Robot

by Gilson Domingues

Fellow

This robot can be controlled by a Smartphone or tablet with Android. Its control system is an Atmega328 microcontroller, the same used in Arduino uno. The board send signals to a H-Bridge driver, that is able to control 2 motors. A bluetooth module is used to communicate to the device remotely.
The assembly is done according to the layout (in PDF File)

After the circuit is done, the following code must be downloaded to the microcontroller.
// RoboBluetooth
int pins_A[3]={17,16,12};//Enable, D1, D2
int pins_B[3]={6,8,7};//Enable, D1, D2
char command;
void setup(){
for(int i=0;i<3;i++){
pinMode(pins_A[i],OUTPUT);
pinMode(pins_B[i],OUTPUT);
}
Serial.begin(9600);
}
void loop(){
command=Serial.read();
action();
}
void action(){
switch(command){
case 'D':
rigth();
break;
case 'E':
left();
break;
case 'T':
back();
break;
case 'F':
front();
break;
case 'P':
stop_a();
stop_b();
break;
}
}
void front(){
digitalWrite(pins_A[0],HIGH);
digitalWrite(pins_A[1],HIGH);
digitalWrite(pins_A[2],LOW);
digitalWrite(pins_B[0],HIGH);
digitalWrite(pins_B[1],HIGH);
digitalWrite(pins_B[2],LOW);
}
void rigth(){
digitalWrite(pins_A[0],HIGH);
digitalWrite(pins_A[1],HIGH);
digitalWrite(pins_A[2],LOW);
digitalWrite(pins_B[0],HIGH);
digitalWrite(pins_B[1],LOW);
digitalWrite(pins_B[2],HIGH);
}
void left(){
digitalWrite(pins_B[0],HIGH);
digitalWrite(pins_B[1],HIGH);
digitalWrite(pins_B[2],LOW);
digitalWrite(pins_A[0],HIGH);
digitalWrite(pins_A[1],LOW);
digitalWrite(pins_A[2],HIGH);
}
void back(){
digitalWrite(pins_A[0],HIGH);
digitalWrite(pins_A[1],LOW);
digitalWrite(pins_A[2],HIGH);
digitalWrite(pins_B[0],HIGH);
digitalWrite(pins_B[1],LOW);
digitalWrite(pins_B[2],HIGH);
}
void stop_a(){
digitalWrite(pins_A[0],LOW);
}
void stop_b(){
digitalWrite(pins_B[0],LOW);
}

If you want to use a new Atmega328 chip, you can burn the bootloader according to the instructions on the site arduino.cc (https://www.arduino.cc/en/Tutorial/ArduinoISP).
After you burned and downloaded the program, the microcontroller can be now installed on the board. Then the motors are connected to the board (via a connector or soldering). Finally, connect the battery box and the bluetooth module.

To test the robot, download the app here: .First, you need to activate the bluetooth in your Android, then pair the robot (try to discover the bluetooth module address). It asks for a password, it is 0000 or 1234. After pairing, go back to the app and connect with the paired module. To make the robot walk just tap the directional keys on the screen.