Advertisement

How to make a bluetooth control 4WD car.

 


        Hello guys, Welcome back to my SriTu Hobby blog. Today we are going to talk about making a smart car that can be controlled by Bluetooth. For this, we mainly need Bluetooth technology. Today we are using a Bluetooth module for our project. You can control this car through your smartphone. For that, we need a small app. We'll talk about that later. What is Bluetooth? How does it work? I have given you a complete description of this in a previous article. If you want you can read that article from this link. Read me.

Next, we need the power to move this car. For this, I am using 4 gear motors. This is why we can call this car a 4WD (Four-wheel) car. The next question we have is how to control these four gear motors through an Arduino board. Of course, we can't do this directly through the Arduino board. For this, we need the help of another device. That means we need a motor driver board. If you do not know what a motor driver board is, click on this link. Read me.

Now let's see what other components are needed to create this smart car.

OK, let's do this project step by step.

Step 1

First, identify these components.


Arduino Uno board.


Please use the Arduino Uno board for this project. Because this is good for this project.

Motor driver shield.


This component is used to control the four motors. Click this link for more details.

Bluetooth module


Click this link for more details.

Gear motors and wheels.



These components we want to move the robot car.

Dot board.


Next, we need a robot car chassis. For that, I use the dot board. But you can use any car chassis.

Li-ion battery and holder.

                


You can use any kind of power source. But remember to use a power source from 7.4 to 12 DC.

Jumper wires.


Use these jumper wires to connect the Bluetooth module to the motor driver shield.


Step 2

First, attach the four gear motors to the dot board. For that, I used a glue gun. You can use any method.



Step 3

Then, connect the motor drive shield to the Arduino board and attach it to the center of the dot board.



Step 4

Next, connect these four motors to the motor driver shield. For that, use the circuit diagram below.






Step 5

OK, now connect the Bluetooth module using the jumper wire. For that, use the Serial communication pins.



Step 6

Now, Connect to the computer to upload the appropriate code.

 Remember to remove the RX and TX jumper before uploading the code.



Step 7

OK, let's look at the code below. First, you need to download the motor driver shield library. Download it.

#include <AFMotor.h>
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

int Speed = 230;
char value;
void setup() {
  Serial.begin(9600);
  motor1.setSpeed(Speed);
  motor2.setSpeed(Speed);
  motor3.setSpeed(Speed);
  motor4.setSpeed(Speed);


}

void loop() {
  if (Serial.available() > 0) {
    value = Serial.read();
  }
  if (value == 'F') {
    motor1.run(FORWARD);
    motor2.run(FORWARD);
    motor3.run(FORWARD);
    motor4.run(FORWARD);
  } else if (value == 'B') {
    motor1.run(BACKWARD);
    motor2.run(BACKWARD);
    motor3.run(BACKWARD);
    motor4.run(BACKWARD);
  } else if (value == 'L') {
    motor1.run(BACKWARD);
    motor2.run(BACKWARD);
    motor3.run(FORWARD);
    motor4.run(FORWARD);
  } else if (value == 'R') {
    motor1.run(FORWARD);
    motor2.run(FORWARD);
    motor3.run(BACKWARD);
    motor4.run(BACKWARD);
  } else {
    motor1.run(RELEASE);
    motor2.run(RELEASE);
    motor3.run(RELEASE);
    motor4.run(RELEASE);
  }

}


After, select the correct board and port. Then upload this code.









After uploading the code, Reconnect the RX and TX jumper wires.



Step 8

Now, attach the Li-ion battery holder on the back and connect the power wires. For that, use the circuit diagram above.


Step 9

Next, connect the robot wheels to the gear motors.



Step 10

Finally, insert the battery into the battery holder and turn on the Smart car.




Step 11

Okay, now let’s set up the mobile app. First, you need to download and install the Arduino Bluetooth RC Car app.

Then, open this application.


Next, we need to connect to the Bluetooth module. For that, use the steps below.








If the Bluetooth module is connected correctly, the circle on the left will be green. Right now click the arrow buttons. Then look at the smart car movement. The full video guide is given below. We will meet in the next article.


Post a Comment

0 Comments