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!
Ameya Angadi
Published © GPL3+

Bluetooth-Controlled Car with HC-05 Module

Build a car that can be controlled wirelessly via a smartphone using Bluetooth communication.

IntermediateFull instructions provided30,425
Bluetooth-Controlled Car with HC-05 Module

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
DC Motor, 12 V
DC Motor, 12 V
×4
High Brightness LED, White
High Brightness LED, White
(Optional)
×2
Male/Female Jumper Wires
Male/Female Jumper Wires
×8
Rechargeable Battery, 3.7 V
Rechargeable Battery, 3.7 V
You can use other batteries too!
×1

Software apps and online services

Arduino IDE
Arduino IDE
Arduino Car Connect
Use this app to control your car

Story

Read more

Schematics

Bluetooth Car Connections

Use the Schematics to assemble your car

Code

Bluetooth_Car.ino

Arduino
Upload this code before making connections
/* BLUETOOTH CAR WITH ARDUINO UNO AND HC-05

   THIS CODE DEMONSTRATES CONTROLLING A CAR VIA SMARTPHONE USING BLUETOOTH COMMUNICATION.

   NOTE-IT IS ADVISED THAT BLUETOOTH MODULE SHOULD BE ATTACHED TO ARDUINO BOARD AFTER
        UPLOADING CODE TO AVOID ERRORS AND PREVENT POSSIBLE DAMAGE TO BLUETOOTH MODULE.

   CODE CREATED BY - AMEYA ANGADI
   LAST MODIFIED ON - 26/07/2024
   VERSION - 1.3
*/

#define led1 = 13
#define in1 = 12
#define in2 = 11
#define in3 = 10
#define in4 = 9

void setup() {
  Serial.begin(9600);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
}

void loop() {
  if (Serial.available() > 0) {
    char inputvalue = char(Serial.read());
    if (inputvalue == 'F') {
      digitalWrite(12, HIGH);
      digitalWrite(11, LOW);
      digitalWrite(10, HIGH);
      digitalWrite(9, LOW);
    }
    else if (inputvalue == 'B') {
      digitalWrite(12, LOW);
      digitalWrite(11, HIGH);
      digitalWrite(10, LOW);
      digitalWrite(9, HIGH);
    }

    else if (inputvalue == 'R') {
      digitalWrite(12, LOW);
      digitalWrite(11, LOW);
      digitalWrite(10, HIGH);
      digitalWrite(9, LOW);
    }

    else if (inputvalue == 'L') {
      digitalWrite(12, HIGH);
      digitalWrite(11, LOW);
      digitalWrite(10, LOW);
      digitalWrite(9, LOW);
    }

    else if (inputvalue == 'C') {
      digitalWrite(12, LOW);
      digitalWrite(11, HIGH);
      digitalWrite(10, HIGH);
      digitalWrite(9, LOW);
    }

    else if (inputvalue == 'A') {
      digitalWrite(12, HIGH);
      digitalWrite(11, LOW);
      digitalWrite(10, LOW);
      digitalWrite(9, HIGH);
    }

    else if (inputvalue == 'O') {
      digitalWrite(13, HIGH);
    }

    else if (inputvalue == 's') {
      digitalWrite(13, LOW);
    }

    else if (inputvalue == 'S') {
      digitalWrite(12, LOW);
      digitalWrite(11, LOW);
      digitalWrite(10, LOW);
      digitalWrite(9, LOW);
    }
  }
}

Credits

Ameya Angadi
5 projects • 3 followers

Comments