Introduction: ARDUINO BLUETOOTH ROBOT
View to this instructable to learn how to make a robot and control it using an android smartphone.
Step 1: COMPONENTS REQUIRED
HARDWARE:
- 1 x ARDUINO UNO (I used the R3)
- 1 x L293D MOTOR DRIVER BOARD
- 1 x CHASSIS
- 1 x CASTOR WHEEL
- 1 x ANDROID PHONE
- 10 x MALE TO FEMALE JUMPER CABLES
- 1 x HC-05 BLUETOOTH MODULE
SOFTWARE:
ARDUINO IDE
BLUETOOTH ROBO CONTROL APPLICATION(FROM PLAY STORE)
Step 2: CONNECTIONS
HC-05 BLUETOOTH MODULE TO ARDUINO UNO:
- RX ~ D-5 PIN
- TX ~ D-4 PIN
- VCC ~ 5V
- GND ~ GND
L293D MOTOR DRIVER TO ARDUINO UNO
- ENABLE PIN OF MOTOR 1 ~ D-8 PIN
- INPUT PIN 3 ~ D-9 PIN
- INPUT PIN 4 ~ D-10 PIN
- ENABLE PIN OF MOTOR 2 ~ D-11 PIN
- INPUT PIN 2 ~ D-12 PIN
- INPUT PIN 1 ~ D-13 PIN
Step 3: CODE
UPLOAD THE CODE TO YOUR ARDUINO:
#include
SoftwareSerial mySerial(4, 5); // RX, TX
void setup() { pinMode(13, OUTPUT); pinMode(12, OUTPUT); pinMode(11, OUTPUT); digitalWrite(11, HIGH); digitalWrite(8, HIGH); // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port mySerial.begin(9600); mySerial.println("Hello, world?"); }
void loop() // run over and over { int inByte; if (mySerial.available()) { inByte= mySerial.read(); Serial.write(inByte); if(inByte==65)//forward { Serial.println(inByte); digitalWrite(13, HIGH); digitalWrite(12, LOW); digitalWrite(9, HIGH); digitalWrite(10, LOW); } if(inByte=='B')//Backword { Serial.println(inByte); digitalWrite(13, LOW); digitalWrite(12, HIGH); digitalWrite(9, LOW); digitalWrite(10, HIGH); } if(inByte=='C')//left { digitalWrite(13, LOW); digitalWrite(12, HIGH); digitalWrite(9, HIGH); digitalWrite(10, LOW); } if(inByte=='D')//right { digitalWrite(13, HIGH); digitalWrite(12, LOW); digitalWrite(9, LOW); digitalWrite(10, HIGH); } if(inByte=='E')//brake or stop { digitalWrite(13, HIGH); digitalWrite(12, HIGH); digitalWrite(9, HIGH); digitalWrite(10, HIGH); } } }
Attachments
Step 4: WORKING
After uploading the code into your arduino, open play store in your android phone, and download 'BLUETOOTH ROBO CONTROL' app. Pair your android phone with the module. Then open the app click on select device, again click on hc-05, once it is successfully connected you may start moving the robot.
------------------------------------------------------------------------------------------------------------------------------------------------------
BY-ANMOL