1. Introduction
In this project, we are building a wireless toy car that you can control using a free Android app on your smartphone. By using the HC-05 Bluetooth module, we can send steering commands from the phone to an Arduino UNO, which then drives the motors. This is a 100% free alternative to paid platforms like Blynk.
2. Components
Arduino UNO
L298N Motor Driver
HC-05 Bluetooth Module
2 x DC Geared Motors
7.4V or 12V Li-ion Battery
Robot Chassis & Wheels
Jumper Wires
3. Circuit and Connections
Follow these exact pin mappings to ensure the code works without modifications and also see the tips before loading the code.
L298N Motor Driver to Arduino:
IN1 → Arduino Digital Pin 8
IN2 → Arduino Digital Pin 9
IN3 → Arduino Digital Pin 10
IN4 → Arduino Digital Pin 11
ENA → Arduino Pin 5 (PWM)
ENB → Arduino Pin 6 (PWM)
HC-05 Bluetooth to Arduino:
VCC → Arduino 5V
GND → Arduino GND
TX → Arduino RX (Pin 0)
RX → Arduino TX (Pin 1)
4. Circuit Working
The HC-05 module receives serial data from the smartphone app wirelessly. It passes this data to the Arduino's RX/TX pins. The Arduino processes the characters (like 'F' or 'B') and triggers the L298N Motor Driver to spin the motors in the corresponding direction.
5. Code
char data = 0;
void setup() {
pinMode(8, OUTPUT); // Left Motor Forward
pinMode(9, OUTPUT); // Left Motor Backward
pinMode(10, OUTPUT); // Right Motor Forward
pinMode(11, OUTPUT); // Right Motor Backward
Serial.begin(9600);
}
void loop() {
if(Serial.available() > 0) {
data = Serial.read();
if(data == 'F') { forward(); }
else if(data == 'B') { backward(); }
else if(data == 'L') { left(); }
else if(data == 'R') { right(); }
else if(data == 'S') { stop_car(); }
}
}
void forward() {
digitalWrite(8, HIGH); digitalWrite(9, LOW);
digitalWrite(10, HIGH); digitalWrite(11, LOW);
}
void backward() {
digitalWrite(8, LOW); digitalWrite(9, HIGH);
digitalWrite(10, LOW); digitalWrite(11, HIGH);
}
void left() {
digitalWrite(8, LOW); digitalWrite(9, HIGH);
digitalWrite(10, HIGH); digitalWrite(11, LOW);
}
void right() {
digitalWrite(8, HIGH); digitalWrite(9, LOW);
digitalWrite(10, LOW); digitalWrite(11, HIGH);
}
void stop_car() {
digitalWrite(8, LOW); digitalWrite(9, LOW);
digitalWrite(10, LOW); digitalWrite(11, LOW);
}
6. Code Working
The code uses Serial.read() to listen for incoming Bluetooth signals. When a button is pressed in the app, it sends a specific character. The if statements check the value and call the corresponding function to drive the L298N pins. For example, forward() sets both motors to spin ahead, while left() reverses one motor to turn the chassis.
7. Tips
Disconnect RX/TX: Always unplug the HC-05 RX/TX pins before uploading code to the Arduino.
Power: Use a separate battery for the motors to prevent the Arduino from resetting due to voltage drops.
8. Uses
Wireless robotics education.
Learning smartphone-to-hardware communication.
Building remote-controlled surveillance bots.
9. Conclusion
Successfully building and controlling a wireless toy car is a major milestone for any electronics hobbyist. By using a free Bluetooth controller app and the HC-05 module, you have mastered the fundamentals of serial communication and motor driver integration—skills that are essential for more advanced robotics.