How to make a simple Bluetooth control car step by step

How to make a simple Bluetooth control car step by step

Hello, welcome back. In this project, we will learn how to make a simple Bluetooth control car step by step. Especially for this project, the remote control introduced by SriTu Hobby has been used. It is designed to be easy for anyone to use and more interesting. Also, the HC-05 Bluetooth module is used for this project. The Arduino UNO board is the main component of this project and the L298N motor driver board is used to power up the gear motors. Next, popsicle sticks were used for making car chassis. Therefore, we can make this car low cost and easily. Ok, let’s go ahead.

If you want to visit other Bluetooth control tutorials, use the links below.

OK, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, attach the popsicle sticks to one gear motor.

Step 3

Thirdly, attach that part to the other gear motor as follows.

Step 4

Next, connect the robotic wheels for the gear motors.

Step 5

Ok, now let’s make the backside of this car. One Nuts and bolt are mainly used for this purpose. See the pictures below.

Step 6

Then, attach the motor driver board to the car chassis. After, connect the gear motors. You can use the pictures and circuit diagram below to do this.

How to make a simple Bluetooth control car step by step

Step 7

Next, attach the Arduino board. After, connect the motor driver board to the Arduino board. For that, use the circuit diagram above.

Step 8

OK, now connect the Bluetooth module to the Arduino board.

Step 9

Then, attach the Bluetooth module to the front of the car.

Step 10

Then, put the batteries into the battery holder and connect it motor driver board.

Step 11

Finally, attach the switch and connect this car to the computer.

Step 12

Ok, let’s create the program for this project. It is as follows.

  • The complete program of this project – Download
/*Simple Bluetooth control car
 * https://srituhobby.com
 */
 
#define IN1 8
#define IN2 9
#define IN3 10
#define IN4 11

void setup() {
  Serial.begin(9600);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
}

void loop() {
  if (Serial.available() > 0) {
    char value = Serial.read();
    Serial.println(value);

    if (value == 'U') {
      Forward();
    } else if (value == 'D') {
      Backward();
    } else if (value == 'S') {
      Stop();
    }else if(value == 'L'){
      Left();
    }else if(value == 'R'){
      Right();
    }
  }
}

void Forward() {
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}
void Backward() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}
void Stop() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
}
void Left() {
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}
void Right() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}

Code explanation

First the Arduino output pins are defined.

#define IN1 8
#define IN2 9
#define IN3 10
#define IN4 11

Then, these pins are set as output pins in the setup function.

void setup() {
  Serial.begin(9600);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
}

In the loop function, serial values were checked using the IF condition. After, car movements arranged using these values.

void loop() {
  if (Serial.available() > 0) {
    char value = Serial.read();
    Serial.println(value);

    if (value == 'U') {
      Forward();
    } else if (value == 'D') {
      Backward();
    } else if (value == 'S') {
      Stop();
    }else if(value == 'L'){
      Left();
    }else if(value == 'R'){
      Right();
    }
  }
}

These are car movemnets functions.

void Forward() {
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}
void Backward() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}
void Stop() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
}
void Left() {
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}
void Right() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}

Step 13

Next, remove the RX and TX jumper wires from your Bluetooth control car.

Step 14

Now, select board and port, After, upload this code to the Arduino board.

Step 15

Then, reconnect the jumper wires.

Step 16

Ok, now let’s set up the Bluetooth controller app. For that, follow the steps below.

  • First, install this app using this link — Download(Only play store)
  • Next, run this application and click the “Controllers” button.
How to make a simple Bluetooth control car step by step
  • Then, turn on Bluetooth. After, click the gear wheel icon in the upper right corner and select the “Connect to Device” button.
  • Now you can find new Bluetooth devices. To do so, click on the “FIND DEVICES” button. Then, you need to enable Location and Location Permission to find new devices.
  • Now, select the name of your Bluetooth module and enter the PIN as “1234”. Then it will connect.

OK, now you can run your Bluetooth control car using this remote control. So, enjoy this project. The full video guide is below. See you in the next project.

How to make a simple Bluetooth control car step by step

Similar Posts

Leave a Reply

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