Driving the Future: DIY Bluetooth-Controlled Arduino Car

by Lee1999 in Circuits > Arduino

57 Views, 2 Favorites, 0 Comments

Driving the Future: DIY Bluetooth-Controlled Arduino Car

Driving the Future: DIY Bluetooth-Controlled Arduino Car
Bluetooth Control Car.JPG

Today I will make the Bluetooth-controlled Arduino car using the 3D-printed chassis. the Arduino board is connected to motor drivers and various sensors to control the movement and functionality of the car. By pairing the Arduino with a Bluetooth module, such as HC-05 or HC-06, users can send commands from a Bluetooth-enabled device like a smartphone or a computer to control the car's movement, such as forward, backward, left, right, and other actions like turning on/off lights or sensors.

Supplies

  1. Arduino Uno R3
  2. Mounting Bracket
  3. DC Motor + Tires
  4. 18650 Battery
  5. Battery Case
  6. l298N motor driver
  7. Some M3 bolts and Nuts

These are all you need for this project. You also need to print the chassis.

If you're uncertain about which components are needed for this project, feel free to refer to the video description for further details and insights.

Soldering and Attach the Mouting Bracket to Motors

Mouting wheels to motor.JPG

First, you need to solder the motors and attach the mounting bracket to the motors so you can attach the motors to the chassis later. You will also need wheels for these motors. I think you can do this if you are a beginner or a pro electronics learner. You only need 2 motors for this project.

Fix the Motors to the Chassis

Chassis.JPG
attach motors to chassis.JPG
Scre.JPG
2 motors.JPG

After printing the chassis you may have a 3D printed part like this one. All the files are available for download, so make sure you check it out. You need for M3x10 to mount the motor to the chassis. It's quite easy, right?

Mounting the Battery Holder to the Chassis

battery.JPG
Battery holder.JPG

Let's mount the battery holder to the chassis. You need 2 M3x10 to do that.

Mounting the Caster Wheel to the Chassis

3d part.JPG
caster wheel.JPG
m4.JPG

Because the height of the caster wheel is pretty short so I have to print another part to increase the height. Then attach the caster wheel to the chassis using 4 M4x40.

Fix the L298N Motor Driver to the Chassis

add the nut.JPG
nuts.JPG

Since the chassis is a 3D printed part, you need to add the nuts to the chassis so we can mount the L298N and Arduino to it. Use 4 m3x10 to mount the motor driver to the chassis.

After that, let's connect the power for the driver and the motors to the motor driver according to the circuit.

Attach the Arduino to the Chassis

28.PNG

Next mount the Arduino Uno R3 to the base with 4 M3x10. Almost done, let's move on to the pin connections.

For the pin from L298N to Arduino connections:

enA - pin 8

IN1 - pin 4

IN2 - pin 5

IN3 - pin6

IN4 - pin 7

enB - pin 9

For the HC-05 Bluetooth module :

Vcc - 5v

Gnd - Gnd

RX-TX Arduino

TX-RX Arduino

Add the Accessories

29.PNG

Add the accessories for the better looks.

For the Code and Circuit

//Vitsit Lee Curiosity Channel for full videos
//https://www.youtube.com/@LeeCuriosity
int in1 = 4;
int in2 = 5;
int in3 = 6;
int in4 = 7;
int enA = 8;
int enB = 9;
int val;


void setup()
{  
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  Serial.begin(9600);
}


void loop()
{


  while (Serial.available() > 0)
  {
    val = Serial.read();
  }
  if( val == 'F') //Forward
    {
      Serial.println("Forward");
      digitalWrite(in1, HIGH);
      digitalWrite(in2, LOW);
      digitalWrite(in3, HIGH);
      digitalWrite(in4, LOW);  
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }
    else if(val == 'B') //Backward
    {
      Serial.println("Reverse");
      digitalWrite(in1, LOW);
      digitalWrite(in2, HIGH);
      digitalWrite(in3, LOW);
      digitalWrite(in4, HIGH);
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }  
    else if(val == 'L') //Left
    {
      Serial.println("Turn Left");
      digitalWrite(in1, LOW);
      digitalWrite(in2, LOW);
      digitalWrite(in3, HIGH);
      digitalWrite(in4, LOW);
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }
    else if(val == 'R') //Right
    {
      Serial.println("Turn Right");
      digitalWrite(in1, HIGH);
      digitalWrite(in2, LOW);
      digitalWrite(in3, LOW);
      digitalWrite(in4, LOW);
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }    
    else if(val == 'S') //Stop
    {
      Serial.println("Stop");
      digitalWrite(in1, LOW);
      digitalWrite(in2, LOW);
      digitalWrite(in3, LOW);
      digitalWrite(in4, LOW);
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }
    else if(val == 'I') //Forward Right
    {
      Serial.println("Forward Right");
      digitalWrite(in1, HIGH);
      digitalWrite(in2, LOW);
      digitalWrite(in3, LOW);
      digitalWrite(in4, LOW);
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }
    else if(val == 'J') //Backward Right
    {
      Serial.println("Backward Right");
      digitalWrite(in1, LOW);
      digitalWrite(in2, LOW);
      digitalWrite(in3, LOW);
      digitalWrite(in4, HIGH);
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }
    else if(val == 'G') //Forward Left
    {
      Serial.println("Forward Left");
      digitalWrite(in1, LOW);
      digitalWrite(in2, LOW);
      digitalWrite(in3, HIGH);
      digitalWrite(in4, LOW);
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }
    else if(val == 'H') //Backward Left
    {
      Serial.println("Backward Left");
      digitalWrite(in1, LOW);
      digitalWrite(in2, HIGH);
      digitalWrite(in3, LOW);
      digitalWrite(in4, LOW);
      digitalWrite(enA,HIGH);
      digitalWrite(enB,HIGH);
    }
}