Arduino Bluetooth Car
by Ramatronics Laboratory in Circuits > Arduino
22697 Views, 51 Favorites, 0 Comments
Arduino Bluetooth Car
In this project we are going to make a bluetooth Controlled Robot Car using Arduino. Although remote controlled robot cars that are available in the market are controlled by an RF remote, But this is the time of android phones. So I decided to make a wireless bluetooth controlled robot car with arduino. To control this robot car we do not require any kind of RF remote, This car can be controlled by any one that uses android phone. So let's make this awesome project.
Supplies
List of the hardware to make this project.
http://www.quartzcomponents.com
- Arduino UNO
- Adafruit Motor Shield
https://quartzcomponents.com/search?type=product&q=motor+shied
- 4-Gear Motors
https://quartzcomponents.com/products/dual-shaft-dc-geared-motor-300-rpm?_pos=1&_sid=afc7b413b&_ss=r
- 4-Wheels
- HC-05 Bluetooth Module
https://quartzcomponents.com/products/hc-05-bluetooth-module?_pos=2&_sid=1c56fff69&_ss=r
- 3-Li-ion Batteries
- Switch
- Jumper wires (female to female)
- Ribbon Wire
- MDF Board
not available
- USB cable (that arduino Uno supports)
https://quartzcomponents.com/products/arduino-uno-programming-cable?_pos=5&_sid=3c9516795&_ss=r
- Fevicol (glue)
https://quartzcomponents.com/products/hot-melt-glue-gun-100w?_pos=2&_sid=56651f388&_ss=r
- Double Sided Tape
- an Aluminum L-shaped strip with an screw
Cut a Small Sheet From MDF
In step first, we cut the MDF board to get a smaller rectangular sheet of MDF with area(15cm X 10cm). After this we drill two holes on this sheet to pass the wires from lower side to upper side.
Soldering Wires to Gear Motors
In step 2, we cut 8, 5cm long wires from ribbon wire cable and solder these wires to the terminal of gear motors.
Downloads
Fixing Gear Motors on MDF Sheet
In step 3, we fix the gear motors on the 15x10 MDF sheet with Glue or Fevicol. we can take the help of given image to know how to fix the motors on the sheet.
Connecting Arduino Uno and Motor Shield Together
In step 4, we fix the Adafruit motor shield on the Arduino Uno as shown in the given picture.
Placing Arduino Uno and Motor Shield on Chassis
In step 5, we fix the Arduino and Adafruit motor shield on the chassis with the help of double sided tape as shown in the above images.
Connecting Gear Motors to Motor Shield
In step 6, we connect the wires of the gear motors to Adafruit motor shield. For this we also need an screw driver to rotate the screws of the terminal blocks. you can take the help of circuit diagram or the given images to make proper connections between gear motors and Adafruit motor shield.
Mounting the Battery Pack
In step 7, we fix the battery pack on the chassis with the help of double sided tape. we also solder the +Ve wire of the battery pack to one of the terminal of the on-off switch and take another piece of wire and solder its one end with the second remaining terminal of the switch and another end is connected the the +Ve supply pin of the motor shield.
further connect the -Ve wire of the battery pack to the -ve supply terminal of the motor shield. As shown in the given image.
Mounting the HC-05 Module
In step 8, we fix the L-shaped aluminum on the chassis with the help of an screw and screw driver. After the attach our HC-05 bluetooth module to it with the help of double sided tape, we connect the HC-05 module with adafruit motor shield using jumper wires, as shown.
Connectiong Wheels to Car
In step 9, we connects the 4 wheels to the shafts of the gear motors as shown in the images
Programming
In this last step we have to program the arduino Uno board with Arduino IDE so we connect our robot car to laptop or computer with an USB cable. Before uploading the sketch on the Uno board we remove the two jumper wires that is connected to the TX. and RX. pin of the arduino Uno. It is necessary otherwise our arduino IDE gives us a programming error. After successfully uploading the ketch, again connect the two wires(that we have removed) on their places. Now our Bluetooth car is ready to test and the only thing that is remained is to install the Bluetooth Car app in our android phone from play store. After installing the app on your android phone, switch on the power button of your robot car and turn on the Bluetooth of your android phone and pair it with the Bluetooth of our Car and after pairing with the Bluetooth now Everything is ready.
Downloading the Android App From Google Play Store
To operate the bluetooth car with android phone. we need to download an app form the google play store. After downloading the app install it in your android phone.
Link: https://play.google.com/store/apps/details?id=braulio.calle.bluetoothRCcontroller
Code
#include <AFMotor.h>
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
char command;
void setup()
{
Serial.begin(9600);
}
void loop(){
if(Serial.available() > 0){
command = Serial.read();
Stop();
switch(command){
case 'F':
forward();
break;
case 'B':
back();
break;
case 'L':
left();
break;
case 'R':
right();
break;
}
}
}
void forward()
{
motor1.setSpeed(255);
motor1.run(FORWARD);
motor2.setSpeed(255);
motor2.run(FORWARD);
motor3.setSpeed(255);
motor3.run(FORWARD);
motor4.setSpeed(255);
motor4.run(FORWARD);
}
void back()
{
motor1.setSpeed(255);
motor1.run(BACKWARD);
motor2.setSpeed(255);
motor2.run(BACKWARD);
motor3.setSpeed(255);
motor3.run(BACKWARD);
motor4.setSpeed(255);
motor4.run(BACKWARD);
}
void left()
{
motor1.setSpeed(255);
motor1.run(BACKWARD);
motor2.setSpeed(255);
motor2.run(BACKWARD);
motor3.setSpeed(255);
motor3.run(FORWARD);
motor4.setSpeed(255);
motor4.run(FORWARD);
}
void right()
{
motor1.setSpeed(255);
motor1.run(FORWARD);
motor2.setSpeed(255);
motor2.run(FORWARD);
motor3.setSpeed(255);
motor3.run(BACKWARD);
motor4.setSpeed(255);
motor4.run(BACKWARD);
}
void Stop()
{
motor1.setSpeed(0);
motor1.run(RELEASE);
motor2.setSpeed(0);
motor2.run(RELEASE);
motor3.setSpeed(0);
motor3.run(RELEASE);
motor4.setSpeed(0);
motor4.run(RELEASE);
}