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 = EEPROM.read(0); // 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] = EEPROM.read(1);
var_Data[1] = EEPROM.read(2);
var_Data[2] = EEPROM.read(3);
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 = Serial.read(); // 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(EEPROM.read(0)); // 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

<p>does anyone have the code with no error to send me pls. koffih81@gmail.com</p>
<p>motor is not running,,, what should i do???</p>
See wires
Hello tolik777.a message &quot;socket failed&quot; appeared on my cxem apps when i tried to control it.what does it mean?please help me.
<p>all are ok.. motors also gating power but not moving</p>
<p>This is my first project with arduino , so can anyone please modify the sketch for an RC car where one motor steers the front wheels and the the other motor moves the car forward and reverse? </p>
<p>Hi, I made a similar project, you can find it here:</p><p>http://www.roboremo.com/rc-car.html</p>
<p>This is the project I need, but could we modify the app with speed regulation?(PWM)</p>
<p>Hi, the RoboRemo app is user configurable, check this: </p><p>http://www.roboremo.com/arduino-bluetooth-rc-car-2.html</p>
<p>Hello.</p><p>How can I modify this project to 1. movement motor and 2. front direction motor?</p><p>Movement motor also with PWM from Android!<br>I have the power PCB, it needs only one pin for FORWARD movement another pin for REVERSE movement and the same for direction.<br>Anibody can help with a project like this?</p><p>The android app in what IDE was created, from where can I download it?</p>
<p>Motors are not moving .</p><p>Motor driver requires 6 input pins 2 for PWM and 4 for direction control.</p><p>But in this project there are only $ input pins for motor driver 2 PWM and @ direction.</p><p>Here is a link of Motor Driver working principal</p><p><a href="http://www.instructables.com/id/Arduino-Modules-L298N-Dual-H-Bridge-Motor-Controll/?ALLSTEPS" rel="nofollow">http://www.instructables.com/id/Arduino-Modules-L2...</a></p>
<p>Socket Failed..how can I solve this problem..how can I find my Bluetooth modiul mac address..plzzz tell</p>
<p>plese give me connection between andrino and motor driver </p>
<p>thank you for your information for me, and this your letter i will use for education in my student </p>
<p>Hi soory i've copied the code into the arduino software and when i verificate it, appears this error: Arduino:1.6.5 (Windows 8.1), Placa:&quot;Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)&quot;</p><p>sketch_jul10d.ino: In function 'void loop()':</p><p>sketch_jul10d:62: error: expected ')' before 'AVAILABLE'</p><p>sketch_jul10d.ino: In function 'void Flash_Op(char, uint8_t, uint8_t, uint8_t, uint8_t)':</p><p>sketch_jul10d:173: error: expected '}' at end of input</p><p>expected ')' before 'AVAILABLE'</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> activala desde Archivo &gt; Preferencias</p><p>someone can help me please</p>
<p>i think this is for arduino mini 328 and not for Mega</p>
Plz tell me which app did u use
<p>Good evening sir. I already downloaded the Android Application but it's not the English version. it's different language. where can I find English version sir? Thank you in advance</p>
<p>i get a socket failed on the cxem app as well, what could be the problem? The LED on my bluetooth module is blinking also. Can the arduino uno and motor driver be on at the same time?</p>
<p>Solution for your &quot;Socket Failed&quot; is:</p><p>Go to setting OR Tap menu button or [. . .] button and press setting. </p><p>then tap MAC address, and enter you Bluetooth Module MAC address (the one which is connected to your arduino)<br>save settings. and you are Ready to go ! </p>
<p>May I know do I still need to load any program to the arduino or it will be loaded once I connect my android to the bluetooth module? Do I need to supply voltage to VCC of the motor driver? and where does D13 connect to? Thanks.</p>
<p>Arduino: 1.6.3 (Windows 7), Board: &quot;Arduino Uno&quot;</p><p>Sketch uses 3,624 bytes (11%) of program storage space. Maximum is 32,256 bytes.</p><p>Global variables use 231 bytes (11%) of dynamic memory, leaving 1,817 bytes for local variables. Maximum is 2,048 bytes.</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xa1</p><p>avrdude: stk500_recv(): programmer is not responding</p><p>avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xa1</p><p>Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.</p><p> This report would have more information with <br> &quot;Show verbose output during compilation&quot; <br> enabled in File &gt; Preferences.</p>
<p>Try to disconnect the wire TX from the Bluetooth module</p>
<p>thx bro </p><p>can u help me with a recomandation for future work what can i do next using the same equipment</p>
<p>Thank you :) for sharing such a brief tutorial. </p>
<p>what phone app did you use i can't find the cxem app</p>
<p>the download link for the CXEM app is available in last steps. I used the same app that was provided. the only thing I needed, was to put MAC address into this app for SYNC purpose. </p>
<p>The app isn't in the app store</p>
<p>i need help please , when i use the android application to control the car .. the phone show me an error message called &quot; socket failed &quot; .. i need help as soon as possible ! </p>
<p>I have encountered the same problem. Did you able to solve it? If yes, how?</p>
<p>Hey I completed all the steps and all my LEDs are connected. However after connected the bluetooth to my phone, I am unable to make the rc car move. do you know what could be the problem? Tahnk you</p>
Plz put it on amazon
<p>i looked at video and observe in the end view of cables, i didn't see where does GND of controller and GND of motor driver go? in general, what is the right way, i need to connect all GND and minus of each battery together and connect this heap to metal carcass? or just together without connect to carcass?</p>
<p>about cables, are used just simple cables or specific?</p>
<p>Hello! I am interested in this project, but i am newbie/, i have some questions(part of them meybe stupid), but help me please=). So:</p><p>-if i am using <a href="http://www.ebay.com/itm/MINI-USB-Nano-V3-0-ATmega328P-CH340G-5V-16M-Micro-controller-board-Arduino-/161403910939?pt=LH_DefaultDomain_0&hash=item25946c3b1b" rel="nofollow">http://www.ebay.com/itm/MINI-USB-Nano-V3-0-ATmega3...</a> this kind of controller, i need arduino tx and BT rx level shifter?</p><p>-from the diagram, 3V3 from controller goes to 3V3 BT, what pin is 3V3 BT on the BT?, where are RX, TX, GND and VCC, so i suppose that 3V3 BT is VCC</p><p>-and one newbie question: so i must have 3.7V power on controller and 7.4V on motor driver, in diagram is showed just each has one connection(+) but where goes second(-)? i suppose that goes to GND or it's wrong?</p>
<p>Hello, can I ask if I could use Intel Galileo gen 2 for this project? I am a newbie! :D</p>
<p>can you use the arduino motor shield instead of the motor controller </p>
<p>sir can arduino uno R3 can be used in this project with the same arduino code?</p>
<p>i m a new beginner in this field so i want a total coading of arduino uno328 for robot movement via my android mobile bluetooth</p>
<p>you can use any type of arduino </p>
<h3>Android RC Control Adrian $10</h3>
<p>hiiii, </p><p>i have made this project and its successful, </p><p>I just want to ask that how can i add an hc sr04 sensor into it, plz give me the details for doing this,,,,</p><p>what will be the arduino coding for adding this distance sensor, plz. help me in this existing arduino coding. any help should be highly appreciated.</p><p>you can also email the coding at- mirnal.mannu123@gmail.com</p>
cool I'll try it
<p>Really an amazing steps for mobile control. There is a search engine where anyone can find the RC toys and accessories with various types of model and variety.</p><p>http://www.whichhobbystory.com</p>
<p>Can anyone help me by converting the same program in the instructables for arduino nano v3.0. The details of arduino nano v3.0 and motor driver is attached in below post...</p><p>Please some one help me. </p>
<p>Can anyone help me by converting the same program in the instructables for arduino nano v3.0. The details of arduino nano v3.0 and motor driver is attached in below post...</p><p>Please some one help me. </p>

About This Instructable


908 favorites


Bio: I like Electronics, Robots and Arduino!
More by tolik777: Android controlled RC Vehicle with real-time Video via Bluetooth & Wi-Fi CxemCAR 1 - Android Control RC Car over Bluetooth Arduino Ampermeter (ZXCT IC's)
Add instructable to: