Simple CAR Arduino Bluetooth Controlled
In this project i will show you how use the Bluetooth module to control a car through commands coming from a smartphone.
List element:
- Bluetooth HC-06
- Arduino uno
- L293D motor shield
- Plexi 17cm x 10cm
- 4x TT gear Motor
- 4x wheels
- 4x Battery AA
- Battery pack
- Wires
- Switch
Video Tutorial:
Schema:
If your Arduino works in 5 volt logic, connect ONLY Tx to pin S (servo 2). The HC-06 bluetooth module works in 3.3 volt logic, connecting the Rx pin can damage it. If your arduino works in 3.3 volt logic, connect Rx to pin S (servo 1)

Sketch :
- Download FILES (sketch and library) or Only library
- Open sketch and add a library. Sketch -> include library -> Add .ZIP Library and select “Adafruit-Motor-Shield-library-master.zip”
Files:


Android Aplication:
- Pair HC-06 with your phone
- Install aplication on your phone https://play.google.com/store/apps/details?id=com.appsvalley.bluetooth.arduinocontroller
- Open Aplication and select device bluetooth HC-06
- Enter Controller and open “configuration buttons”:
◄=L
▲=F
►=R
▼=B
- Have fun
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
#include "AFMotor.h" #include "SoftwareSerial.h" SoftwareSerial BT( 9 , 10 ); //initial motors pin AF_DCMotor motor1(1); AF_DCMotor motor2(2); AF_DCMotor motor3(3); AF_DCMotor motor4(4); char command; void setup() { Serial.begin(9600); //Set the baud rate to your Bluetooth module. BT.begin(9600); } void loop(){ if(BT.available() > 0){ command = BT.read(); switch(command){ case '0': Stop(); break; case 'F': forward(); break; case 'B': back(); break; case 'L': left(); break; case 'R': right(); break; } } } void forward() { motor1.setSpeed(255); //Define maximum velocity motor1.run(FORWARD); //rotate the motor clockwise motor2.setSpeed(255); //Define maximum velocity motor2.run(FORWARD); //rotate the motor clockwise motor3.setSpeed(255);//Define maximum velocity motor3.run(FORWARD); //rotate the motor clockwise motor4.setSpeed(255);//Define maximum velocity motor4.run(FORWARD); //rotate the motor clockwise } void back() { motor1.setSpeed(255); //Define maximum velocity motor1.run(BACKWARD); //rotate the motor anti-clockwise motor2.setSpeed(255); //Define maximum velocity motor2.run(BACKWARD); //rotate the motor anti-clockwise motor3.setSpeed(255); //Define maximum velocity motor3.run(BACKWARD); //rotate the motor anti-clockwise motor4.setSpeed(255); //Define maximum velocity motor4.run(BACKWARD); //rotate the motor anti-clockwise } void left() { motor1.setSpeed(255); //Define maximum velocity motor1.run(BACKWARD); //rotate the motor anti-clockwise motor2.setSpeed(255); //Define maximum velocity motor2.run(BACKWARD); //rotate the motor anti-clockwise motor3.setSpeed(255); //Define maximum velocity motor3.run(FORWARD); //rotate the motor clockwise motor4.setSpeed(255); //Define maximum velocity motor4.run(FORWARD); //rotate the motor clockwise } void right() { motor1.setSpeed(255); //Define maximum velocity motor1.run(FORWARD); //rotate the motor clockwise motor2.setSpeed(255); //Define maximum velocity motor2.run(FORWARD); //rotate the motor clockwise motor3.setSpeed(255); //Define maximum velocity motor3.run(BACKWARD); //rotate the motor anti-clockwise motor4.setSpeed(255); //Define maximum velocity motor4.run(BACKWARD); //rotate the motor anti-clockwise } void Stop() { motor1.setSpeed(0); //Define minimum velocity motor1.run(RELEASE); //stop the motor when release the button motor2.setSpeed(0); //Define minimum velocity motor2.run(RELEASE); //rotate the motor clockwise motor3.setSpeed(0); //Define minimum velocity motor3.run(RELEASE); //stop the motor when release the button motor4.setSpeed(0); //Define minimum velocity motor4.run(RELEASE); //stop the motor when release the button } |