In this tutorial, we will learn how to make an Arduino Bluetooth racing car. For this, I am using a discarded RC car with the transmitter missing. You can find many broken RC cars like this. This article presents how to make such a reusable RC car. This is made using Arduino. This is controlled by an Android mobile. The connection is via Bluetooth.
You can watch the following video or read the written tutorial below.
Overview
The only downside is the limited control distance it can cover. However, by creating and utilizing a discarded RC car in this manner, we can acquire knowledge and contribute to environmental conservation by reducing pollution. The Arduino Bluetooth car that we create is entirely controlled by an Android app. The communication between the car and the mobile device is through Bluetooth. It can be controlled just like an RC car, and features such as the car horn, front light, backlight, and speed control can also be adjusted. The maximum distance it can be controlled is 15m-20m.
Check if RC car is suitable.
To create a Bluetooth Racing Car using this method, a DC motor must be connected to the drive wheel, and another DC motor to the two front wheels that steer the vehicle. You can observe this in the pictures below or by watching the video. Check if the motor works using an 18650 li-ion battery.
Components Needed
Before we begin, make sure you have gathered all the necessary components. The purchase links are in the description of my YouTube video.
- Arduino Nano or compatible board
- L298N motor driver module
- HC-05 or HC-06 Bluetooth Module
- Jumper wires
- Two 18650 Rechargeable Battery 3.7V
- 18650 Li-ion Battery Holder 2-Way
- USB cable for programming the Arduino
- Screwdriver and assorted screws
- Glue Gun
- Front and back lights (LEDs)
- 5V buzzer (for the car horn)
The smaller the Arduino board, the better. I am using an Arduino Nano board.
Remove unnecessary parts from the RC Car
- Remove the casing from the car.
- If there are unusable batteries, remove them.
- Remove the receiver circuit and other circuits.
- If there are gears, remove them, clean them, and reattach them.
- Remove unnecessary parts so that the L298N motor driver and Arduino board can be installed.
- If there is dust or dirt, clean them well.
- Repair any broken parts.
After repair,
Circuit Diagram
The Arduino Bluetooth RC Car Circuit Diagram is not complicated. First, you download the circuit diagram from the download button. It’s more obvious. Small jumpers should be connected to ENA and ENB on the L298N motor driver you are using. It is connected by default when you buy it. Use two 3.7V 18659 li-ion batteries to provide power. Do not use more than two batteries. It cannot use 9V battery. If a 9V battery is used, only the front light, rear light, and horn will work. Gear motor not working. The reason for that is that the 9V battery does not have enough amperage. Front light, rear light, and horn are optional things of Arduino Bluetooth RC Car. Arduino Bluetooth RC car can be made without front light, back light and horn. No need to modify Arduino code.
Connect the Motors to the L298N Driver
In this way, connect the wires of the motors to the motor power connectors of the l298N motor driver.
- Connect the Rear motor wires to the “OUT1 and OUT2” terminals on the motor driver.
- Connect the Turning motor wires to the “OUT3 and OUT4” terminals on the motor driver.
Connect the Battery Power Connection
Use two 3.7V 18659 li-ion batteries to provide power. Do not use more than two batteries. It cannot use 9V battery. If a 9V battery is used, only the ultrasonic sensor and servo motor will work. Gear motor not working. The reason for that is that the 9V battery does not have enough amperage. I use the car switch to turn the vehicle on and off.
- Connect the red wire(+) coming through the switch to the 12V(+) in the L298n motor drive.
- Connect the Black wire (-) of the battery holder to the GND In of the L298N Motor Driver.
Connect the Arduino UNO to the L298N Driver
In this way, connect the digital pins of the Arduino board and the inputs of the L298N motor driver by jumper wires.
- Connect the IN1 pin of the motor driver to digital pin D5 on the Arduino.
- Connect the IN2 pin of the motor driver to digital pin D6 on the Arduino.
- Connect the IN3 pin of the motor driver to digital pin D10 on the Arduino.
- Connect the IN4 pin of the motor driver to digital pin D11 on the Arduino.
The Arduino board is powered by the L298N Motor driver.
- Connect the 5V Out connecter of the motor driver to VIN pin on the Arduino.
- Connect the GND connecter of the motor driver to GND pin on the Arduino.
Connecting the Bluetooth module ( HC-05 or HC-06 ) to the Arduino board
Hc-05 and HC-06 Bluetooth modules can be applied to the Arduino Bluetooth RC Car.
In this way, connect the Arduino board and the Bluetooth module by jumper wires.
- Connect the VIN (power) pin of the Bluetooth module to the 5V pin on the Arduino.
- Connect the GND (ground) pin of the Bluetooth module to the GND pin on the Arduino.
- Connect the TXD pin of the Bluetooth module to RX pin on the Arduino.
- Connect the RXD pin of the Bluetooth module TX pin on the Arduino.
When uploading the code to the Arduino board, the TX and RX wires of the Arduino board that are connected to the Bluetooth Module’s RXD and TXD should be temporarily disconnected. After the code is successfully uploaded, connect the wires again.
Connecting the front light, rear light, and horn to the Arduino board. ( Optional )
Front light, rear light, and horn are optional things of Arduino Bluetooth RC Car. Arduino Bluetooth RC car can be made without front light, backlight and horn. No need to modify Arduino code.
I use 1W LED bulbs for the front and rear lights. No resistors are needed to connect these. An active buzzer is used as the horn of the vehicle. It emits a beep.
In this way, connect the front and back lights and the 5V active buzzer to the Arduino board.
- Front light, connect the positive terminal (+) to A0 on the Arduino and the negative terminal (-) to the GND on the Arduino.
- Back light, connect the positive terminal (+) to A2 on the Arduino and the negative terminal (-) to the GND on the Arduino.
- 5V Buzzer, connect the positive terminal (+) to A4 on the Arduino and the negative terminal (-) to the GND on the Arduino.
Upload the Arduino Sketch
- Before uploading the code, disconnect the RX and TX pins of the HC-05 Bluetooth module.
- After uploading the code, connect them again
Arduino Bluetooth RC car can be made without front light, backlight and horn. No need to modify Arduino code. Copy the following Arduino code and paste it into the new sketch in the Arduino IDE. Select the board and port and upload the code. If this is difficult to do, watch a tutorial video.
You can download the Arduino code and open it directly through the Arduino IDE. Click the Download button below to download the Arduino code
//Robot Lk Youtube Channe
#define in1 5 //L298n Motor Driver pins.
#define in2 6
#define in3 10
#define in4 11
#define light_FR 14 //LED Front Right pin A0 for Arduino Uno
#define light_FL 15 //LED Front Left pin A1 for Arduino Uno
#define light_BR 16 //LED Back Right pin A2 for Arduino Uno
#define light_BL 17 //LED Back Left pin A3 for Arduino Uno
#define horn_Buzz 18 //Horn Buzzer pin A4 for Arduino Uno
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.
boolean lightFront = false;
boolean lightBack = false;
boolean horn = false;
void setup() {
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(light_FR, OUTPUT);
pinMode(light_FL, OUTPUT);
pinMode(light_BR, OUTPUT);
pinMode(light_BL, OUTPUT);
pinMode(horn_Buzz, OUTPUT);
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.
if (lightFront) {digitalWrite(light_FR, HIGH); digitalWrite(light_FL, HIGH);}
if (!lightFront) {digitalWrite(light_FR, LOW); digitalWrite(light_FL, LOW);}
if (lightBack) {digitalWrite(light_BR, HIGH); digitalWrite(light_BL, HIGH);}
if (!lightBack) {digitalWrite(light_BR, LOW); digitalWrite(light_BL, LOW);}
if (horn) {digitalWrite(horn_Buzz, HIGH);}
if (!horn) {digitalWrite(horn_Buzz, LOW);}
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;
case 'W':lightFront = true;break;
case 'w':lightFront = false;break;
case 'U':lightBack = true;break;
case 'u':lightBack = false;break;
case 'V':horn = true;break;
case 'v':horn = false;break;
}
Speedsec = Turnradius;
if (brkonoff == 1) {
brakeOn();
} else {
brakeOff();
}
}
}
void forward() {
analogWrite(in1, Speed);
}
void back() {
analogWrite(in2, Speed);
}
void left() {
analogWrite(in3, Speed);
}
void right() {
analogWrite(in4, Speed);
}
void forwardleft() {
analogWrite(in1, Speed);
analogWrite(in3, Speed);
}
void forwardright() {
analogWrite(in1, Speed);
analogWrite(in4, Speed);
}
void backright() {
analogWrite(in2, Speed);
analogWrite(in4, Speed);
}
void backleft() {
analogWrite(in2, Speed);
analogWrite(in3, 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() {
}
Code language: PHP (php)
This code allows the Arduino to receive commands from the Bluetooth module and control the motors, lights, and buzzer accordingly.
How To Download Bluetooth RC Car App And Its Function
To take control of your Arduino-powered Bluetooth Racing Car, initiate the pairing process between your mobile device and the HC-05 Bluetooth module. Open the Bluetooth RC Control app on your mobile device, connect to the Bluetooth module, and begin wirelessly controlling your robot car. Utilize the user-friendly interface of the app to send commands that direct your car to move, turn, and activate features such as lights and the buzzer. This wireless control enhances the interactive experience, allowing enthusiasts to observe their Arduino-powered creation respond to commands with agility and responsiveness. For users facing challenges in establishing a proper Bluetooth connection, a helpful YouTube video tutorial is available for reference, providing visual guidance and troubleshooting tips.
Here is the link to download the Android app: Bluetooth RC Control App. This app serves as the intuitive control interface for your robot car, offering a seamless and enjoyable user experience. By incorporating both the app and the provided Arduino code, this project enables enthusiasts to delve into the exciting realm of Arduino-based robotics while experiencing the thrill of wireless control through a mobile device.
Mobile App Link: https://play.google.com/store/apps/de…
- If the above link does not work, download the app from this Button
Conclusion
In conclusion, the Bluetooth Racing Car project demonstrates a creative and sustainable approach to repurposing old RC cars into Arduino-controlled vehicles with smartphone functionality. By leveraging discarded RC cars and integrating Arduino, L298N motor driver, and HC-05 Bluetooth module, enthusiasts can transform these forgotten toys into fully functional and customizable robotic cars. The project not only fosters knowledge in electronics and programming but also contributes to environmental conservation by repurposing discarded items. With the added features of front and back lights and a buzzer for a car horn effect, the robot car becomes an engaging and interactive platform. Through the Bluetooth RC Control app, users can wirelessly control the car, showcasing its movements and activating various features. This project offers a hands-on learning experience, combining hardware and software components to create an Arduino-powered, smartphone-controlled racing car from an old and forgotten RC vehicle.