Bluetooth remote-controlled 4WD car using an Arduino Nano v3 board with steering performed by a servo motor
Also published at https://www.instructables.com/Arduino-Bluetooth-RC-Car-1/





Note: enable the sound by clicking on the speaker icon from the video toolbar
bluetooth_car_driving.mp4
bluetooth_car_mobile_app.mp4
This is a Platform IO IDE project coded in C++.
- Download and install the free Android app called "Arduino Car"
- Find and connect to the Bluetooth device called "HC-05" (if asked for a password, type 1234 or 0000)
- Once installed the app, map the buttons code as shown in the picture
- I recommend to change the controller joystick type to "Analog"
- 01 - 4WD Car Chassis with steering (see section below)
- 04 - DC Motors (3v - 6v)
- 04 - Wheels
- 01 - Arduino Nano v3
- 01 - Arduino Nano shield (recomended, not required)
- 01 - Dual H-Bridge board (L298N or TB6612FNG)
- 01 - HC-05 Bluetooth module
- 02 - Red Leds
- 02 - White Leds
- 01 - Passive Buzzer
- 04 - 150 Ω Resistors
- 01 - 1.0K Ω Resistor
- 01 - 3.3K Ω Resistor
- 01 - 220 Ω Resistor
- 02 - 18650 batteries (3.7v - 4.2v)
- 01 - Battery support
- 01 - SG90 Servo Motor
- 02 - Electrolytic Capacitor (16v - 50v, 8,000 - 12,000 μF)
NOTES:
- TB6612FNG is a modern MOSFET driver with about 90% energy efficiency versus 40-70% for the L298N
Platform IO is a plugin for Microsoft Virtual Studio Code. It is a more robust IDE compared to official Arduino IDE. It also allows us to easily create our own private libraries and use a more object oriented code.
The PINs can be customized in the main.cpp
#include <Arduino.h>
#include <DigitalLed.h>
#include <PassiveBuzzer.h>
#include <DCMotor.h>
#include <Car.h>
#include <BluetoothJoyHandler.h>
#include <SoftwareSerial.h>
#include <ServoMotor.h>
#include <Servo.h>
#include <SerialReader.h>
#define PIN_FLED 2
#define PIN_RLED 3
#define PIN_HORN 10
#define PIN_M1_EN 5
#define PIN_M1_IN1 4
#define PIN_M1_IN2 6
#define PIN_M2_EN 11
#define PIN_M2_IN1 7
#define PIN_M2_IN2 8
#define PIN_BLUETOOTH_TX 12
#define PIN_BLUETOOTH_RX 13
#define PIN_SERVO 9
#define MIN_MOTOR_SPEED 80 // (between 0 to 255)
DigitalLed fLed(PIN_FLED);
DigitalLed rLed(PIN_RLED);
PassiveBuzzer horn(PIN_HORN);
DCMotor motor1(PIN_M1_EN, PIN_M1_IN1, PIN_M1_IN2);
DCMotor motor2(PIN_M2_EN, PIN_M2_IN1, PIN_M2_IN2);
Servo servo;
ServoMotor servoMotor(servo, PIN_SERVO);
Car car(motor1, motor2, fLed, rLed, servoMotor, horn);
SoftwareSerial bluetooth(PIN_BLUETOOTH_TX, PIN_BLUETOOTH_RX);
BluetoothJoyHandler joyHandler(car);
SerialReader serialReader;
void setup()
{
Serial.begin(9600);
bluetooth.begin(9600);
servoMotor.attach();
joyHandler.setDebug(false);
car.stop();
car.setMaxSpeed();
}
void loop()
{
String command = serialReader.read(bluetooth);
if (command != "") {
joyHandler.handle(command);
}
}
Fine-tuning customizations can be done in the individual files like ServoMotor.h
for servo motor angle
#ifndef SERVOMOTOR_H
#define SERVOMOTOR_H
#include <Arduino.h>
#include <Servo.h>
class ServoMotor
{
public:
ServoMotor(Servo &servo, uint8_t pin);
void attach();
void turn(uint16_t angle);
void turnLeft();
void turnHalfLeft();
void turnRight();
void turnHalfRight();
void reset();
private:
uint8_t pin;
Servo _servo;
uint8_t angleReset = 90;
uint8_t angleFull = 25;
uint8_t angleHalf = 15;
};
#endif
or in the DCMotor.h
for changing speed parameters
#ifndef DCMOTOR_H
#define DCMOTOR_H
#include <Arduino.h>
class DCMotor
{
public:
DCMotor(uint8_t pinEn, uint8_t pinIn1, uint8_t pinIn2);
void backward(uint8_t speed = 100);
void forward(uint8_t speed = 100);
void setMinAbsSpeed(uint8_t absSpeed);
void stop();
private:
uint8_t pinEn;
uint8_t pinIn1;
uint8_t pinIn2;
uint8_t absSpeed = 0;
uint8_t maxAbsSpeed = 255;
uint8_t minAbsSpeed = 50;
uint8_t ignoreAbsSpeed = 30;
void setSpeed(uint8_t speed);
};
#endif
This project was designed to have a servo motor steering the front wheels:

https://www.aliexpress.us/item/2251832846243463.html?channel=facebook

I recommend to use high quality 18650 batteries (3.7v - 4.2v, 2200mAh, at least 2C of discharge rate).
Most people prefer to use different power sources for Arduino (5v) and Bridge driver (7.4 - 8.4v).
I prefer to have a single power source and thus a single power switch. However, it was required to use huge Electrolytic Capacitors (around 8,000 to 12,000µF) to prevent Arduino Nano from rebooting when the 04 DC motors drains too much power. The capacitor is also useful to filter some electric noise. Note: in the video recordings above, I used 2x 18650 batteries 2600mAh (3C) and one 10,000 µF capacitor.
It is up to you!
Be careful if you need to change PINs of PWM motors (PIN_M1_EN
and PIN_M2_EN
) and Servo (PIN_SERVO
) since they cannot use the same Arduino timers.
The eletronic schematic was created in the Fritzing software and can be downloaded at