In this blog, we are going to know about the BT Controlled Car Using Arduino and L298N. Welcome to Poly Notes Hub, a leading destination for diploma and degree engineering notes for engineering students.
Author Name: Arun Paul.
BT Controlled Car Using Arduino and L298N
The Arduino UNO, HC-05 Bluetooth module, L298N motor driver, and two DC motors will be used in this project to create a Bluetooth-controlled automobile. This car can be wirelessly controlled with a smartphone and a Bluetooth controller app, allowing us to maneuver it forward, backward, left, and right with simple commands.
The primary goal of this project is to understand how to connect a Bluetooth module to Arduino and control the movement of a robot car. It’s a terrific entry-level robotics and electronics project for students, amateurs, and DIY enthusiasts.
What You Will Learn From this Project?
- Connect and configure the HC-05 Bluetooth module.
- Control DC motors using the L298N motor driver.
- Program Arduino to respond to Bluetooth commands.
- Use a mobile app to wirelessly control a robot.
Required Components for BT (HC-05) Controlled Car
Here is the list of required components in this project –
- Arduino UNO
- HC-05 Bluetooth Module
- L298N Motor Driver Module
- 2 DC Motors (connected to wheels)
- Chassis, wheels, caster wheel
- Battery pack (6V–12V, depending on motor specs)
- Jumper wires
- Smartphone (with a BT Controller app like “Arduino Bluetooth Controller”)
📌 Learn About L298N Motor Driver Module – Click Here to Learn | 📌 If you want know more about Bluetooth Module HC-05 then Click Here | 📌 Click Here to take a tour on Arduino Uno and its Pinout Details.
Wiring Guide of HC-05 to UNO & L298N Motor Driver
HC-05 to Arduino UNO
HC-05 Pin | Arduino Pin |
---|---|
VCC | 5V |
GND | GND |
TXD | RX (Pin 0) |
RXD | TX (Pin 1) (Use voltage divider: 1kΩ + 2kΩ to step down 5V to 3.3V) |
L298N Motor Driver
L298N Pin | Arduino Pin | Description |
---|---|---|
IN1 | 7 | Motor A Control |
IN2 | 6 | Motor A Control |
IN3 | 5 | Motor B Control |
IN4 | 4 | Motor B Control |
ENA (jumper) | 5V or PWM | Enable Motor A |
ENB (jumper) | 5V or PWM | Enable Motor B |
OUT1, OUT2 | Motor A | Connect to motor terminals |
OUT3, OUT4 | Motor B | Connect to motor terminals |
VCC | Battery +ve | Motor power supply (6V–12V) |
GND | Common GND | Connect to Arduino GND |
5V (Output) | N/C | (Don’t connect to Arduino) |
Arduino Code (Copy it and Upload it to Arduino)
char command;
void setup() {
Serial.begin(9600);
pinMode(4, OUTPUT); // IN4
pinMode(5, OUTPUT); // IN3
pinMode(6, OUTPUT); // IN2
pinMode(7, OUTPUT); // IN1
}
void loop() {
if (Serial.available() > 0) {
command = Serial.read();
stopCar(); // Default to stop before any command
switch (command) {
case 'F': forward(); break;
case 'B': backward(); break;
case 'L': left(); break;
case 'R': right(); break;
case 'S': stopCar(); break;
}
}
}
void forward() {
digitalWrite(7, HIGH);
digitalWrite(6, HIGH);
digitalWrite(5, LOW);
digitalWrite(4, LOW);
}
void backward() {
digitalWrite(7, LOW);
digitalWrite(6, LOW);
digitalWrite(5, HIGH);
digitalWrite(4, HIGH);
}
void left() {
digitalWrite(7, LOW);
digitalWrite(6, HIGH);
digitalWrite(5, LOW);
digitalWrite(4, LOW);
}
void right() {
digitalWrite(7, HIGH);
digitalWrite(6, LOW);
digitalWrite(5, LOW);
digitalWrite(4, LOW);
}
void stopCar() {
digitalWrite(7, LOW);
digitalWrite(6, LOW);
digitalWrite(5, LOW);
digitalWrite(4, LOW);
}
Bluetooth Control App for Wireless Communication
Use any free app like:
- Arduino Bluetooth Controller by “Giumig Apps” (Android)
- Map buttons to send: F, B, L, R, S