Simple RC Car for Beginners (Android Control Over Bluetooth)




Introduction: Simple RC Car for Beginners (Android Control Over Bluetooth)

About: I like Electronics, Robots and Arduino!

This is a simple project of Android Bluetooth Car with Bluetooth control. Arduino controller is used

To control the car used Android-device with a built-in accelerometer. Tilt forward - car goes forward, tilt to the left - car turns to the left, tilt back - car goes back. Speed of movement or rotation depends on how much you tilt the device. Sensitivity and value of the tilt set in the configuration Android-apps. Also are provided a normal way to control: the buttons on the screen. In addition to all I implemented the touch control. Total 3 ways to control the RC Car.

Capabilities of the device you can see on the video above

Step 1: Android Device

Parts needed

1. Android device

The most important part - Android device with accelerometer and Bluetooth: tablet, smartphone and other... As an Android device, I used a cheap Chinese tablet "Ainol Aurora" with an external USB-Bluetooth module (because its not have own), connected via USB Host.

Step 2: DIY Car Chassis

2. DIY Car Chassis

We also need any chassis with 2 or 4 DC motors. You can use an old RC toy car. As a platform I used a small RC DIY platform, bought on AliExpress for 25$. It's most suitable track chassis for this project.

Step 3: Controller (MCU)

3. Controller (MCU)

You need any Arduino-compatible controller (Nano, Uno, Leonardo, Mini and other)

The controller should contain 2 PWM and UART.

Step 4: Bluetooth Module

4. Bluetooth module

As a Bluetooth module uses cheap Chinese module Bluetooth Serial HC-06 (3-4$ on AliExpress). Instructions guide on connecting bluetooth module to Arduino is here.
You can use HC-05, HC-07 and other serial Bluetooth modules

Step 5: Motor Driver

5. Motor Driver

I used L298N Dual Bridge DC stepper Motor Driver module. It cost 3-5$ on AliExpress.

Step 6: Other Parts

6. Other parts

Step 7: Theory


All calculations are performed in the Android-application, and immediately calculate the values 2‹2‹of the PWM for the left and right motor. Application has flexible settings, such as the range of the PWM, the sensitivity of tilt, the minimum threshold for the PWM and other. Example commands transmitted by Bluetooth:
L - the command to the left engine, R - for the right
A dash means the motor rotation to move back
255 - PWM value (for Arduino is the maximum speed of rotation)
\r - end of command.
On this command RC car will move forward and slightly rotated to the right, as right engine rotates slowly left.

On this command the left engine will rotate back and forward right, forcing a car to rotate around its axis counterclockwise.

Command is an additional channel to which you can connect for example lights, sound, etc.

Symbols command L, R and H can be defined in the settings of Android-applications.

In the MCU control program provides a timer that shuts off the engine if the last command was received more than n-seconds ago. The data are stored in the EEPROM memory of the controller and can be changed from Android device. The range of this setting is from 0.1 seconds to 99.9 seconds. This setting can be disabled. To work with EEPROM provides commands: Fr - reading values 2‹2‹and Fw - record values.


Block diagram see on picture above

Step 8: Android Application

As we can see, the Arduino connects to Bluetooth module and a motor driver with two or four connected motors.

Android Application

The application for Android was written in Eclipse IDE. All sources of the project and the project for Eclipse, you can download below. Android version on your device must be > 3.0.

The application contains several activity. Main activity is a home screen with buttons running different operating modes and settings

There are 3 control modes Bluetooth-car: from accelerometer, screen buttons and touch-control.

Android application settings

Screenshot of settings CxemCar Android application version 1.0

MAC address

To establish a connection with the RC Car's Bluetooth module, you must set MAC-address in the application settings. But first, you must configure the pair the devices on Android-device: open Settings -> Bluetooth and click "Search for devices". When the phone finds our Bluetooth-module, click them and enter password for pairing (usually "1234")

To know Bluetooth module MAC-address possible from any application, such as Bluetooth Terminal. To do this, click "Connect a device - Secure" and in the resulting window, click the button "Scan for devices". Software will be scans the Bluetooth devices and displays them MAC-address.

Step 9: Arduino RC Car Wiring

Wiring diagram for Arduino controller

In the circuit I used a jumper (in the scheme Jmp1), because with a connected Bluetooth module is impossible be load sketch to the Arduino.

I soldered a Bluetooth-module to the Arduino and led status light. For communication between Arduino and Bluetooth, read this article: Arduino and Bluetooth. Module HC-06 placed in heat-shrink tube 10mm. Bluetooth-state LED with current limiting resistor (calculator) were also placed in heat-shrink tube.

In the breadboard platform, I drilled a hole and secure motor driver L298N. Arduino board attached with double-sided tape

Between the car platform and breadboard I placed 3 Li-Po battery 3.7V 1100 mAh. Power to the controller and motors separately: Arduino powered by a 3.7 V battery, and the motors and driver L298N from two 3.7V batteries connected in series. There are two 2-position power switch - one position is the power from the batteries to consumers, in the other position to charging terminals.

Beetween BT pin RX (2) and Arduino pin TX may require level shifter. For this, you can use voltage divider: calculator 5V to 3.3V

Step 10: Software

The program was written in Arduino IDE 1.01.

#include "EEPROM.h"

#define D1 2 // direction of motor rotation 1
#define M1 3 // PWM left motor
#define D2 4 // direction of motor rotation 2
#define M2 5 // PWM right motor
#define HORN 13 // additional channel 1
//#define autoOFF 2500 // milliseconds after which the robot stops when the connection

#define cmdL 'L' // UART-command for left motor
#define cmdR 'R' // UART-command for right motor
#define cmdH 'H' // UART-command for additional channel (for example Horn)
#define cmdF 'F' // UART-command for EEPROM operation
#define cmdr 'r' // UART-command for EEPROM operation (read)
#define cmdw 'w' // UART-command for EEPROM operation (write)

char incomingByte; // incoming data

char L_Data[4]; // array data for left motor
byte L_index = 0; // index of array L
char R_Data[4]; // array data for right motor
byte R_index = 0; // index of array R
char H_Data[1]; // array data for additional channel
byte H_index = 0; // index of array H
char F_Data[8]; // array data for EEPROM
byte F_index = 0; // index of array F
char command; // command

unsigned long currentTime, lastTimeCommand, autoOFF;

void setup() {
Serial.begin(9600); // initialization UART
pinMode(HORN, OUTPUT); // additional channel
pinMode(D1, OUTPUT); // output for motor rotation
pinMode(D2, OUTPUT); // output for motor rotation
timer_init(); // initialization software timer

void timer_init() {
uint8_t sw_autoOFF =; // read EEPROM "is activated or not stopping the car when losing connection"
if(sw_autoOFF == '1'){ // if activated
char var_Data[3];
var_Data[0] =;
var_Data[1] =;
var_Data[2] =;
autoOFF = atoi(var_Data)*100; // variable autoOFF ms
else if(sw_autoOFF == '0'){
autoOFF = 999999;
else if(sw_autoOFF == 255){
autoOFF = 2500; // if the EEPROM is blank, dafault value is 2.5 sec
currentTime = millis(); // read the time elapsed since application start

void loop() {
if (Serial.available() > 0) { // if received UART data
incomingByte =; // raed byte
if(incomingByte == cmdL) { // if received data for left motor L
command = cmdL; // current command
memset(L_Data,0,sizeof(L_Data)); // clear array
L_index = 0; // resetting array index
else if(incomingByte == cmdR) { // if received data for left motor R
command = cmdR;
R_index = 0;
else if(incomingByte == cmdH) { // if received data for additional channel
command = cmdH;
H_index = 0;
else if(incomingByte == cmdF) { // if received data for EEPROM op
command = cmdF;
F_index = 0;
else if(incomingByte == '\r') command = 'e'; // end of line
else if(incomingByte == '\t') command = 't'; // end of line for EEPROM op

if(command == cmdL && incomingByte != cmdL){
L_Data[L_index] = incomingByte; // store each byte in the array
L_index++; // increment array index
else if(command == cmdR && incomingByte != cmdR){
R_Data[R_index] = incomingByte;
else if(command == cmdH && incomingByte != cmdH){
H_Data[H_index] = incomingByte;
else if(command == cmdF && incomingByte != cmdF){
F_Data[F_index] = incomingByte;
else if(command == 'e'){ // if we take the line end
else if(command == 't'){ // if we take the EEPROM line end
lastTimeCommand = millis(); // read the time elapsed since application start
if(millis() >= (lastTimeCommand + autoOFF)){ // compare the current timer with variable lastTimeCommand + autoOFF
Control4WD(0,0,0); // stop the car

void Control4WD(int mLeft, int mRight, uint8_t Horn){

bool directionL, directionR; // direction of motor rotation L298N
byte valueL, valueR; // PWM M1, M2 (0-255)

if(mLeft > 0){
valueL = mLeft;
directionL = 0;
else if(mLeft < 0){
valueL = 255 - abs(mLeft);
directionL = 1;
else {
directionL = 0;
valueL = 0;

if(mRight > 0){
valueR = mRight;
directionR = 0;
else if(mRight < 0){
valueR = 255 - abs(mRight);
directionR = 1;
else {
directionR = 0;
valueR = 0;

analogWrite(M1, valueL); // set speed for left motor
analogWrite(M2, valueR); // set speed for right motor
digitalWrite(D1, directionL); // set direction of left motor rotation
digitalWrite(D2, directionR); // set direction of right motor rotation

digitalWrite(HORN, Horn); // additional channel

void Flash_Op(char FCMD, uint8_t z1, uint8_t z2, uint8_t z3, uint8_t z4){

if(FCMD == cmdr){ // if EEPROM data read command
Serial.print("FData:"); // send EEPROM data
Serial.write(; // read value from the memory with 0 address and print it to UART
Serial.print("\r\n"); // mark the end of the transmission of data EEPROM
else if(FCMD == cmdw){ // if EEPROM data write command
EEPROM.write(0,z1); // z1 record to a memory with 0 address
timer_init(); // reinitialize the timer
Serial.print("FWOK\r\n"); // send a message that the data is successfully written to EEPROM

The code uses a library to work with EEPROM AVR-memory. Arduino board by USART from the Bluetooth module receives data ready for the left and right engine. All basic calculations are performed in the Android application.

The project structure in Eclipse you can see on the screenshot above.

You can download the source code for the Arduino, and the project for Eclipse
DownloadAPK application for Android-device

The latest software version can be found on this page
Video of demonstration the virtual steering wheel mode (1.2 version and above):

P.S. Sorry for my bad english

10 People Made This Project!


  • Home and Garden Contest

    Home and Garden Contest
  • Make It Modular: Student Design Challenge

    Make It Modular: Student Design Challenge
  • Electronics Contest

    Electronics Contest



Question 3 years ago

Hi guys, i've just built something similar as part of my school project. Everything is all fine, except i can't code. i've downloaded sample codes from sites where i bought components, the problem since i cant code, is that i cant compile the code and edit it to do what i want it to do. for my project, i added gas sensor, temperature & humidity sensor and motion sensor. What i want is to run the motors for 60 seconds when 50ppm of carbon content is detected inn the air. Run for 120 seconds when motion is detected and run when temperature is at 55 degrees celsius, stop when the temp goes own to 30 degrees. any form of assistance would be greatly appreciated.


Answer 3 years ago

this is the sample code i have for now
// Include Libraries
#include "Arduino.h"
#include "DCMDriverL298.h"
#include "PIR.h"
#include "SoftwareSerial.h"
// Pin Definitions
#define PIR_PIN_SIG11
// Global variables and defines
String blehm10Str = "";
// object initialization
HardwareSerial& blehm10(Serial1);
// define vars for testing menu
const int timeout = 10000; //define timeout of 10 sec
char menuOption = 0;
long time0;
// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with electricity.
void setup()
// Setup Serial which is useful for debugging
// Use the Serial Monitor to view printed messages
while (!Serial) ; // wait for serial port to connect. Needed for native USB
//This example uses HM-10 BLE to communicate with an Android or iOS device.
//For Android download Hm BLE Terminal from google play store, or any other BLE app.
//For iOS download LightBlue from App Store, or any other BLE app.
//On both apps, pair and connect to your HM-10
//You should see this message your Smartphone
blehm10.println("BLE On....");
menuOption = menu();
// Main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop.
void loop()
if(menuOption == '1') {
// HM-10 BLE Bluetooth 4.0 - Test Code
//Receive String from bluetooth device
if (blehm10.available())
//Read a complete line from bluetooth terminal
blehm10Str = blehm10.readStringUntil('\n');
// Print raw data to serial monitor
Serial.print("BT Raw Data: ");
//Send sensor data to Bluetooth device
blehm10.println("PUT YOUR SENSOR DATA HERE");
else if(menuOption == '2') {
// L298N Motor Driver with Dual Hobby DC motors - Test Code
//Start both motors. note that rotation direction is determined by the motors connection to the driver.
//You can change the speed by setting a value between 0-255, and set the direction by changing between 1 and 0.
//Stop both motors
else if(menuOption == '3')
// Disclaimer: The Adafruit HTU21D-F Temperature & Humidity Sensor Breakout Board is in testing and/or doesn't have code, therefore it may be buggy. Please be kind and report any bugs you may find.
else if(menuOption == '4') {
// Infrared PIR Motion Sensor Module - Test Code
bool pirVal =;
Serial.print(F("Val: ")); Serial.println(pirVal);
if (millis() - time0 > timeout)
menuOption = menu();
// Menu function for selecting the components to be tested
// Follow serial monitor for instrcutions
char menu()
Serial.println(F("\nWhich component would you like to test?"));
Serial.println(F("(1) HM-10 BLE Bluetooth 4.0"));
Serial.println(F("(2) L298N Motor Driver with Dual Hobby DC motors"));
Serial.println(F("(3) Adafruit HTU21D-F Temperature & Humidity Sensor Breakout Board"));
Serial.println(F("(4) Infrared PIR Motion Sensor Module"));
Serial.println(F("(menu) send anything else or press on board reset button\n"));
while (!Serial.available());
// Read data from serial monitor if received
while (Serial.available())
char c =;
if (isAlphaNumeric(c))
if(c == '1')
Serial.println(F("Now Testing HM-10 BLE Bluetooth 4.0"));
else if(c == '2')
Serial.println(F("Now Testing L298N Motor Driver with Dual Hobby DC motors"));
else if(c == '3')
Serial.println(F("Now Testing Adafruit HTU21D-F Temperature & Humidity Sensor Breakout Board - note that this component doesn't have a test code"));
else if(c == '4')
Serial.println(F("Now Testing Infrared PIR Motion Sensor Module"));
Serial.println(F("illegal input!"));
return 0;
time0 = millis();
return c;


Question 3 years ago

what is the name of the android application?


Question 3 years ago

can i get a detailed virsion of the connections. I dont get any connections that happenned there.
My submission dates tomorrow. RIP ME

Abd ulrazaq
Abd ulrazaq

3 years ago on Step 10

great project

is there a same project using wifi esp8266 ?!!

i need it


3 years ago

Sir , howmuch money you spent on this project?i want to know some details about your project also so please provide your EMAIL ADDRESS????


4 years ago

How to set Motors. Both motors in Rear wheel or one motor in rear and other in front?
Plz help me.


4 years ago

OK guys built it and it works using 7.6 volts of power for the motors which I think may be two litte I might try and up that later

I found I had a socket failed for awhile this ended up being becouse I did not have my gnd set up right.


5 years ago

From where did i get diy car chassis?


Reply 4 years ago

just cheak ebay


5 years ago

what is the range and battery time


Reply 4 years ago

would depend on the quality of your batteries you need to buy ones with a high mAh


5 years ago

Hello sir, thanks for the tutorial, all done fine and what i want to ask is : what is the real command for this project if i want to send the command from "serial monitor" (such as H = horn ON, h = horn OFF).

please reply and thanks in advance.


Reply 4 years ago

did you work that out in the end going to do the same


4 years ago

two questions im using the arduno uno r3 which pins on the ardunio am I contenting to the motor ? or rather which pins conect to Int 1,2,3,4

and could I use a switch rather then a jumper for the blue tooth ?


4 years ago

Can somebody send here the links for those components on aliexpress? I can't find some products and I hope i'll not buy other things.


5 years ago

I qm unable to comple the code can u please provide me compiled code at

abdul hai
abdul hai

5 years ago

Okay so I tried what you said to do, but still keep getting socket fail, whenever I try it on my phone


Reply 5 years ago

you can use an app called ardudroid on the playstore to get the mac address so it can remove that socket fail, go open ardudroid and click connect me to a blutooth device and if your blutooth module is on then you should see the mac address of it, copy it down and go back to cxem car and enter the mac address, and it should work.