How to make Bluetooth control car ?

 How to make a Bluetooth control car ?

1. So what is basically the Bluetooth control car ?
Bluetooth control car basically means a car which is controlled by your Android phones Bluetooth and basically taping on the buttons of a Android app you can control a car. And for the making cost of the card is very much small then you can buy it from the online or in the shop which you can afford. You don’t need a controller for controlling the car your phone is almost everything for controlling it. Suppose you want to turn the speed to the max level so you can also do it by your Android by turning up the its speed by buttons to 75% to 100% or anything else so it is the main thing and you can do it as well by a simple app. You don’t have to do coding for this. You can get the app in the Play Store and I will give the courts to you which you can upload to your arduino and then the everything alright and you can run your car very smoothly.

2. The things you need are
1. Arduino Uno R3 board
2. HC-05 Bluetooth module
3. L298N Motor Driver
4. Some connecting words
5. Gear Motors 300RPM
6. Android device from which you can control your car
6. Batteries
[For the battery version I am using lead acid battery and you can also use some Lithium polymer or Lithium ion batteries in which you are comfortable. For my case the lead acid batteries as they are cheap and also give maximum power which is 4 volt so I’m using two of them in series so I will get about 8 volt Max so, you can also use 9 volt battery also for the power up it.]

Arduino UNO R3

L298N Motor Driver

HC-05 Bluetooth Module

Battery

Here are some pics about the car


Upper View
Side View
Front Side View

Watch the Full Video On YouTube

 

Circuit Diagram of Bluetooth control car 

Codes are Here

https://drive.google.com/file/d/1qI4crZG6tvwMz5TEWEfqxKu8XlyAyaS1/view?usp=drivesdk´╗┐

If you are not able to downloading the codes then copy from here

 

 

//This program is used to control a robot using a app that communicates with Arduino through a Bluetooth module.

#define in1 5 //L298n Motor Driver pins.
#define in2 6
#define in3 10
#define in4 11
#define LED 13
int command; //Int to store app command state.
int Speed = 204; // 0 – 255.
int Speedsec;
int buttonState = 0;
int lastButtonState = 0;
int Turnradius = 0; //Set the radius of a turn, 0 – 255 Note:the robot will malfunction if this is higher than int Speed.
int brakeTime = 45;
int brkonoff = 1; //1 for the electronic braking system, 0 for normal.
void setup() {
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
  pinMode(LED, OUTPUT); //Set the LED pin.
  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.
    switch (command) {
      case ‘F’:
        forward();
        break;
      case ‘B’:
        back();
        break;
      case ‘L’:
        left();
        break;
      case ‘R’:
        right();
        break;
      case ‘G’:
        forwardleft();
        break;
      case ‘I’:
        forwardright();
        break;
      case ‘H’:
        backleft();
        break;
      case ‘J’:
        backright();
        break;
      case ‘0’:
        Speed = 100;
        break;
      case ‘1’:
        Speed = 140;
        break;
      case ‘2’:
        Speed = 153;
        break;
      case ‘3’:
        Speed = 165;
        break;
      case ‘4’:
        Speed = 178;
        break;
      case ‘5’:
        Speed = 191;
        break;
      case ‘6’:
        Speed = 204;
        break;
      case ‘7’:
        Speed = 216;
        break;
      case ‘8’:
        Speed = 229;
        break;
      case ‘9’:
        Speed = 242;
        break;
      case ‘q’:
        Speed = 255;
        break;
    }
    Speedsec = Turnradius;
    if (brkonoff == 1) {
      brakeOn();
    } else {
      brakeOff();
    }
  }
}

void forward() {
  analogWrite(in1, Speed);
  analogWrite(in3, Speed);
}

void back() {
  analogWrite(in2, Speed);
  analogWrite(in4, Speed);
}

void left() {
  analogWrite(in3, Speed);
  analogWrite(in2, Speed);
}

void right() {
  analogWrite(in4, Speed);
  analogWrite(in1, Speed);
}
void forwardleft() {
  analogWrite(in1, Speedsec);
  analogWrite(in3, Speed);
}
void forwardright() {
  analogWrite(in1, Speed);
  analogWrite(in3, Speedsec);
}
void backright() {
  analogWrite(in2, Speed);
  analogWrite(in4, Speedsec);
}
void backleft() {
  analogWrite(in2, Speedsec);
  analogWrite(in4, Speed);
}

void Stop() {
  analogWrite(in1, 0);
  analogWrite(in2, 0);
  analogWrite(in3, 0);
  analogWrite(in4, 0);
}

void brakeOn() {
  //Here’s the future use: an electronic braking system!
  // read the pushbutton input pin:
  buttonState = command;
  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == ‘S’) {
      if (lastButtonState != buttonState) {
        digitalWrite(in1, HIGH);
        digitalWrite(in2, HIGH);
        digitalWrite(in3, HIGH);
        digitalWrite(in4, HIGH);
        delay(brakeTime);
        Stop();
      }
    }
    // save the current state as the last state,
    //for next time through the loop
    lastButtonState = buttonState;
  }
}
void brakeOff() {

}
 

Things you must have to remember during making this car

1. Remove the RX and TX pin from the Arduino while uploading the codes otherwise the codes will not uploaded to your microcontroller.

2. Always check one more time when you were connecting your battery’s ground and 12 volt positive or 9 volt positive which you are using otherwise if you make a mistake then your motor driver will stop working or been damaged by the battery’s opposite polarity.

3. You can use two Motors in parallel for my case I have used two Motors in series so in that case my motor is 6 volt each show in series connection total voltage will be 12 volts.

**** If you use 12 volt Motors then you can also connect to parallel simple early but don’t forget to check the parallel Motors and also running in same direction or not otherwise the car will not run.

**** If you are new to Bluetooth module then you have to know that when the Bluetooth is connected with the phone then the password will be 1234 or 0000.

#### **** For better understanding I will suggest you to see my video on YouTube but you  have to see part 1 and part 2 separately.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.