Introduction: Arduino Bluetooth Car

this is my first Arduino project it is quite simple to make .
it will take about half an hour to make it it's quite simple as you think
you can also make it by following steps given below and make have fun it's give me create joy when I finally made it .
now it's your turn to make it.
just follow the steps given under description

Step 1: Requirements

Arduino uno board
Bluetooth module hc 05
4wd shield (adafruit)
Jumper wires
Two 9v battery (1. arduino board
2. external power supply to sheild )
Battery cap with 9v pin jack

Step 2: Connection

mount the shield on arduino board and connect Bluetooth to the audino or directly to the shield by soldering on it connect RX to TX ,TX to RX ,ground to ground ,vcc to vcc as shown in the figure and also connect Motors to M1 (left) and M2 (right)

Step 3: Coding

//*** 1- Documentation
//This program is used to control a robot car using a app that communicates with Arduino trough a bluetooth module

#include <AFMotor.h>


//creates two objects to control the terminal 3 and 4 of motor shield
AF_DCMotor motor1(3);
AF_DCMotor motor2(4);

char command;

void setup()
{
Serial.begin(9600); //Set the baud rate to your Bluetooth module.
}

void loop(){
if(Serial.available() > 0){
command = Serial.read();
Stop(); //initialize with motors stoped
//Change pin mode only if new command is different from previous.
//Serial.println(command);
switch(command){
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
}

void back()
{
motor1.setSpeed(255);
motor1.run(BACKWARD); //rotate the motor counterclockwise
motor2.setSpeed(255);
motor2.run(BACKWARD); //rotate the motor counterclockwise
}

void left()
{
motor1.setSpeed(255); //Define maximum velocity
motor1.run(FORWARD); //rotate the motor clockwise
motor2.setSpeed(0);
motor2.run(RELEASE); //turn motor2 off
}

void right()
{
motor1.setSpeed(0);
motor1.run(RELEASE); //turn motor1 off
motor2.setSpeed(255); //Define maximum velocity
motor2.run(FORWARD); //rotate the motor clockwise
}

void Stop()
{
motor1.setSpeed(0);
motor2.run(RELEASE); //turn motor1 off
motor2.setSpeed(0);
motor2.run(RELEASE); //turn motor2 off
}

Step 4: Uploading

remove Bluetooth module before uploading the codes

Step 5: Power Supply

connect 9 volt battery to arduino board and you can also connect 9 volt battery to shield through external power to increase power supply to your Motors
remove the power jumper shown in the figure.

Step 6: Install App

install Bluetooth RC controller app through play store
open the app
it ask for permission turn on Bluetooth allow it
the first time password is 1234 or 0000
then click on gear shown in the app now "choose connect to car"
the red button blinking in the app turn to green
now you are connected to your car play with it and enjoy your project.

thank you for watching this instruction
Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017