How To Make Bluetooth Control Car Using Arduino

Hello Guys, In this project, I will show you how to make a Bluetooth Control car using Arduino. Here I am Using HC-05 Bluetooth Module to communicate with smartphone and L298N Motor Driver Module to control motor.

video

MATERIAL REQUIRED

Bluetooth controlled car is controlled by using Android mobile phone instead of any other method like buttons, gesture, etc. Here only needs to touch button in android phone to control the car in forward, backward, left and right directions. So here android phone is used as transmitting device and Bluetooth module placed in car is used as receiver. Android phone will transmit command using its in-built Bluetooth to car so that it can move in the required direction like moving forward, reverse, turning left, turning right and stop.

Connection Diagram

Assembling

So First Of All Take Cardboard And Paste All The Four Motors On Cardboard At Back Side As Shown In The Picture Then Connect Lift Side Two Motors In Parallel And Right Side Motors As Well.

then paste all the components on cardboard.

Now Connect all the Components using jumper wire’s According to the Diagram.

Then I Secure The Wheel On The Shaft Of The Gear Motor.

Now Fix Battery On Cardboard with the help of Double sided tape.

programming

Assembling part has been done, So It’s the time of programming.

Now connect Arduino nano to pc using USB cable.

note: before connecting Arduino to pc Remove Bluetooth module from the circuit.

Then open arduino ide and select tools then click on port and select arduino nano.

Again click on tools then click on Port and select latest port, In my case it is Com7.

Now copy the below-written code and paste in Arduino ide.

Arduino code

/* 
 * Project: Bluetooth Controlled Car
 * https://www.youtube.com/channel/UCJFYG8rKSO-ZoM9awuwZU2A?view_as=subscriber
 
 */
 
//L293 Connection   
  const int motorA1      = 3;  
  const int motorA2      = 4; 
  const int motorAspeed  = 5;
  const int motorB1      = 7; 
  const int motorB2      = 8; 
  const int motorBspeed  =6;
  

//Useful Variables
  int state;
  int vSpeed=200;     // Default speed, from 0 to 255

void setup() {
    // Set pins as outputs:
    pinMode(motorA1, OUTPUT);
    pinMode(motorA2, OUTPUT);
    pinMode(motorB1, OUTPUT);
    pinMode(motorB2, OUTPUT);
   
    // Initialize serial communication at 9600 bits per second:
    Serial.begin(9600);
}
 
void loop() {
  
    if(Serial.available() > 0){     
      state = Serial.read();   
    }
   Serial.println(state); 
  //Change speed if state is equal from 0 to 4. Values must be from 0 to 255 (PWM)
    if (state == '0'){
      vSpeed=0;}
    else if (state == '1'){
      vSpeed=100;}
    else if (state == '2'){
      vSpeed=180;}
    else if (state == '3'){
      vSpeed=200;}
    else if (state == '4'){
      vSpeed=255;}
     
  /***********************Forward****************************/
  //If state is equal with letter 'F', car will go forward!
    if (state == 'F') {
  digitalWrite (motorA1,LOW);
  delay(1);
  digitalWrite(motorA2,HIGH);                       
  delay(1);
  
  digitalWrite (motorB1,LOW);
  delay(1);
  digitalWrite(motorB2,HIGH);

  analogWrite (motorAspeed, vSpeed);
  analogWrite (motorBspeed, vSpeed);
  }
  /**********************Forward Left************************/
  //If state is equal with letter 'I', car will go forward left
    else if (state == 'I') {
  digitalWrite (motorA1,LOW);
  delay(1);
  digitalWrite(motorA2,HIGH);                       
  delay(1);
  
  digitalWrite (motorB1,LOW);
  delay(1);
  digitalWrite(motorB2,HIGH);

  analogWrite (motorAspeed, 0);
  analogWrite (motorBspeed, vSpeed);
    }
  /**********************Forward Right************************/
  //If state is equal with letter 'G', car will go forward right
    else if (state == 'G') {
  digitalWrite (motorA1,LOW);
  delay(1);
  digitalWrite(motorA2,HIGH);                       
  delay(1);
  
  digitalWrite (motorB1,LOW);
  delay(1);
  digitalWrite(motorB2,HIGH);

  analogWrite (motorAspeed, vSpeed);
  analogWrite (motorBspeed, 0);
    }
  /***********************Backward****************************/
  //If state is equal with letter 'B', car will go backward
    else if (state == 'B') {
  digitalWrite (motorA1,HIGH);
  delay(1);
  digitalWrite(motorA2,LOW);                       
  delay(1);
  
  digitalWrite (motorB1,HIGH);
  delay(1);
  digitalWrite(motorB2,LOW);

  analogWrite (motorAspeed, vSpeed);
  analogWrite (motorBspeed, vSpeed);
    }
  /**********************Backward Left************************/
  //If state is equal with letter 'J', car will go backward left
    else if (state == 'J') {
  digitalWrite (motorA1,HIGH);
  delay(1);
  digitalWrite(motorA2,LOW);                       
  delay(1);
  
  digitalWrite (motorB1,HIGH);
  delay(1);
  digitalWrite(motorB2,LOW);

  analogWrite (motorAspeed, 0);
  analogWrite (motorBspeed, vSpeed);
    }
  /**********************Backward Right************************/
  //If state is equal with letter 'H', car will go backward right
    else if (state == 'H') {
  digitalWrite (motorA1,HIGH);
  delay(1);
  digitalWrite(motorA2,LOW);                       
  delay(1);
  
  digitalWrite (motorB1,HIGH);
  delay(1);
  digitalWrite(motorB2,LOW);

  analogWrite (motorAspeed, vSpeed);
  analogWrite (motorBspeed, 0);
    }
  /***************************Left*****************************/
  //If state is equal with letter 'L', wheels will turn left
    else if (state == 'L') {
  digitalWrite (motorA2,HIGH);
  delay(1);
  digitalWrite(motorA1,LOW);                       
  delay(1);
  
  digitalWrite (motorB2,LOW);
  delay(1);
  digitalWrite(motorB1,HIGH);

  analogWrite (motorAspeed, vSpeed);
  analogWrite (motorBspeed, vSpeed);
    }
  /***************************Right*****************************/
  //If state is equal with letter 'R', wheels will turn right
    else if (state == 'R') {
  digitalWrite (motorA2,LOW);
  delay(1);
  digitalWrite(motorA1,HIGH);                       
  delay(1);
  
  digitalWrite (motorB2,HIGH);
  delay(1);
  digitalWrite(motorB1,LOW);

  analogWrite (motorAspeed, vSpeed);
  analogWrite (motorBspeed, vSpeed);    
    }

     /************************Stop*****************************/
  //If state is equal with letter 'S', stop the car
    else if (state == 'S'){
        analogWrite(motorA1, 0);  analogWrite(motorA2, 0); 
        analogWrite(motorB1, 0);  analogWrite(motorB2, 0);
    }
 
    
}

now click on upload button to upload the code.

After successful upload disconnect Arduino to pc and connect Bluetooth module again to the circuit.

setup

So Now connect the battery.be careful during connecting battery wires, anode should be connected to anode and cathode should be connected to cathode. You Can use Battery Connector Instead of Jumper Wire.

Now open play store in your smartphone and search for arduino bluetooth rc car then install the application.

After the installation process, open app and click setting icon then click on connect car and select your bluetooth module.In my case it is HC-05, it may be different in your case.

Finally you can enjoy your Bluetooth control car.

I Hope You Enjoyed The Post. If You Like This Post Or You Have Any Doubt Let Me Know In The Comment Section.To Connected With You Can Also Subscribe Our Channel.

7 thoughts on “How To Make Bluetooth Control Car Using Arduino”

  1. Just want to say your articoe is as astonishing. The clarity in yopur post iis simply
    nice and i ould assume you’re an expert oon this subject.

    Fine with your permission allow mme to grab your RSS feed to keep up to date with fforthcoming post.

    Thanks a million and please carery on the enjoyable work.

  2. I want some help will you contact me , i am sorry for asking this strangely but from tomorrow i can’t comment you . Are you are ready?

Leave a Reply

Your email address will not be published. Required fields are marked *