Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Creative creator
Published © CC BY-ND

How to Make Bluetooth Controlled car using Arduino UNO R3, H

Today in this article we are going to discuss How to make a Bluetooth Controlled car using Arduino so without wasting any time let’s make it

BeginnerFull instructions provided3 hours21,328
How to Make Bluetooth Controlled car using Arduino UNO R3, H

Things used in this project

Hardware components

UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1
HC-05 Bluetooth UTSOURCE:
×1
Arduino Uno R3 Board UTSOURCE:
×1
L298N Motor Driver UTSOURCE:
×1
DC Motor UTSOURCE:
×1
18650 Battery and Holder UTSOURCE:
×1

Hand tools and fabrication machines

Soldering Iron UTSOURCE:
Iron Stand UTSOURCE:
Nose Pliers UTSOURCE:
Flux UTSOURCE:

Story

Read more

Schematics

Motor

For the engine area, I am utilizing a TT engine. These are some incredible for our Bluetooth control vehicle venture. Also, it has some low voltage extend like 3V to 6V. In this way, These Motors are incredible for DIY ventures. Here I have additionally included some high torque Motors well on the off chance that you need more force.

Motor Driver

Here, I have utilized for engines two Motors each site. Two side Motors are associated in equal for high torque. What's more, the two-sided Motors links will go to the engine driver.

For the engine driver, I am utilizing a l298n H Bridge engine driver. This is some acceptable force yield so I am utilizing it. Presently simply associate two-sided engine links with the engine driver.

The primary controller Arduino Uno R3:

For the controller, I am utilizing an essential Arduino microcontroller for example Arduino Uno R3. Presently utilized twofold sided tape for joining it on the wood. Furthermore, presently I have associated the information distribution center with the l298n engine driver for sending the peruser totes which will drive the engine.

Bluetooth module:

For the Bluetooth module, I am utilizing HC 05 Bluetooth module. You can likewise utilize a HC-06 Bluetooth module also. For keeping it basic I am utilizing it.

Code

Arduino Bluetooth Control Car

Arduino
This program is used to control a robot using a app
that communicates with Arduino through a bluetooth module.
/*
Code Name: Arduino Bluetooth Control Car 
Code URI: https://circuitbest.com/category/arduino-projects/
Author: Make DIY
Author URI: https://circuitbest.com/author/admin/
Description: This program is used to control a robot using a app
that communicates with Arduino through a bluetooth module.
App URI: https://bit.ly/2BlMAea
Version: 1.0
License: Remixing or Changing this Thing is allowed. Commercial use is not allowed.
*/


#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() {

}

Credits

Creative creator
22 projects • 8 followers

Comments