All we know that Arduino is an excellent prototyping platform, principally because it uses a friendly programming language and there are a lot of extra incredible components that provide us great experiences.
We can integrate the Arduino with differents shields or modules and build fantastic things. In this project i will show you how use the Bluetooth module to control a robot platform through commands coming from a smartphone.

Step 1: Parts


  1. Arduino Uno
  2. Motor Shield L293D Driver
  3. Bluetooth Module
  4. Robot platform


  1. Arduino IDE
  2. Bluetooth RC Controller (you can download this app here)

Step 2: Mount the Hardware

The mounting of the robotic platform is very easy. If you buy one like that, you will receive a manual with all steps.

To connect the electric circuit, you have to fit the shield on the Arduino and then connecting the motors to the shield. After that you have to connect the bluetooth module. The module pins depends on what you are using, but basically it has: VCC (connected to the 5V pin of the Arduino), GND (connected on GND on Arduino), RX (connected to the TX pin of the arduino) and TX (connected to the RX pin of the Arduino).

Step 3: Software

The code is also uncomplicated.

- To control the motors, i used the library <AFMotor.h>.

- The communication between the smartphone and the Bluetooth module was done using the serial communication arduino.

- The app "Bluetooth RC Controller" send to the bluetooth module the following commands:

  • Forward -> F
  • Back -> B
  • Left -> L
  • Right -> R
  • Forward Left -> G
  • Forward Right -> I
  • Back Left -> H
  • Back Right -> J
  • Stop -> S
  • Front Lights On -> W
  • Front Lights Off -> w
  • Back Lights On -> U
  • Back Lighst Off -> u
  • Horn On -> V
  • Horn Off -> v
  • Extra On -> X
  • Extra Off -> x
  • Speed 0 -> 0
  • Speed 10 -> 1
  • Speed 20 -> 2
  • Speed 30 -> 3
  • .
  • .
  • .
  • Speed 90 -> 9
  • Speed 100 -> q
  • Stop All -> D

In this project was used just the basic commands: Forward, Back, Left and Right.

The entire code is available for you to download.

Step 4: You Are Done

Now you have all you need to build your own robot controlled by a smartphone via Bluetooth. Easy and Funny.


<p>Hi, when I compile the sketch I get a lot of error messages. Could you please help me?</p><p>Arduino: 1.8.1 (Windows 7), Board: &quot;Arduino/Genuino Uno&quot;</p><p>C:\Users\user\Documents\Arduino\libraries\arduino_723047\src\Temboo.cpp: In member function 'int TembooChoreo::run(IPAddress, uint16_t, uint16_t)':</p><p>C:\Users\user\Documents\Arduino\libraries\arduino_723047\src\Temboo.cpp:281:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]</p><p> if (!m_client.findUntil(&quot;HTTP/1.&quot;, HTTP_EOL)) {</p><p> ^</p><p>C:\Users\user\Documents\Arduino\libraries\arduino_723047\src\Temboo.cpp:301:62: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]</p><p> if (m_client.findUntil(&quot;x-temboo-time:&quot;, HTTP_EOH)) {</p><p> ^</p><p>C:\Users\user\AppData\Local\Temp\cchwJani.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0':</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:7: undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:8: undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'</p><p>C:\Users\user\AppData\Local\Temp\cchwJani.ltrans0.ltrans.o: In function `Stop':</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:74: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:75: undefined reference to `AF_DCMotor::run(unsigned char)'</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:76: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:77: undefined reference to `AF_DCMotor::run(unsigned char)'</p><p>C:\Users\user\AppData\Local\Temp\cchwJani.ltrans0.ltrans.o: In function `back':</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:50: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:51: undefined reference to `AF_DCMotor::run(unsigned char)'</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:52: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p>C:\Users\user\AppData\Local\Temp\cchwJani.ltrans0.ltrans.o: In function `right':</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:66: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p>C:\Users\user\AppData\Local\Temp\cchwJani.ltrans0.ltrans.o: In function `forward':</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:42: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p>C:\Users\user\AppData\Local\Temp\cchwJani.ltrans0.ltrans.o: In function `left':</p><p>Multiple libraries were found for &quot;AFMotor.h&quot;</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:58: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p> Used: C:\Users\user\Documents\Arduino\libraries\arduino_723047</p><p> Not used: C:\Users\user\Documents\Arduino\libraries\arduino_668460</p><p> Not used: C:\Users\user\Documents\Arduino\libraries\arduino_668460</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:59: undefined reference to `AF_DCMotor::run(unsigned char)'</p><p> Not used: C:\Users\user\Documents\Arduino\libraries\arduino_668460</p><p> Not used: C:\Users\user\Documents\Arduino\libraries\arduino_668460</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:60: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p>C:\Users\user\AppData\Local\Temp\cchwJani.ltrans0.ltrans.o: In function `right':</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:67: undefined reference to `AF_DCMotor::run(unsigned char)'</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:68: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'</p><p>C:\Users\user\Documents\Arduino\FOF4YFTIA0WX947/FOF4YFTIA0WX947.ino:69: undefined reference to `AF_DCMotor::run(unsigned char)'</p><p>collect2.exe: error: ld returned 1 exit status</p><p>exit status 1</p><p>Error compiling for board Arduino/Genuino Uno.</p><p>This report would have more information with</p><p>&quot;Show verbose output during compilation&quot;</p><p>option enabled in File -&gt; Preferences.</p>
<p>I'm trying to add an LCD, HC-SR04 sensor powered by a servo motor, and LM35 temperature sensor to the robot but when I tried adding those codes to the existing code, only the LCD would run. Please advise. I am trying to get the car to work with these added things. I can attach the code if that helps.</p>
How to I connect 4 geared dc motor with arduino bluetooth via and is it's arduino code for control it by bluetooth please send me pdf about it at my gmail gautamthakkar786@gmail.com please
<p>what is the code if i use L298N motor driver?</p>
<p>sir you can send me circuit diagram at my gmail gautamthakkar786@gmail.com</p>
It's not working.............errors are appeared &quot; unable to rename ;core.a&quot;.............plz help me
<p>sorry, but, my car only go to left and right, someone can help me? , and something interesting , when i connect to the computer its run all the forward backward left and right, but when i use batteries, four AA it run only left and right, Why?</p>
<p>Built the car as instructed but when we went to run it neither motors are running. Bluetooth module and Arduino lights are on and there are no errors in our code. Is this the complete code? Using the <a href="https://cdn.instructables.com/ORIG/FOF/4YFT/IA0WX947/FOF4YFTIA0WX947.ino" rel="nofollow">carBluetooth_V01.ino</a> code. Please advise. </p>
<p>#include &lt;AFMotor.h&gt;</p><p>AF_DCMotor motor2(2);</p><p>AF_DCMotor motor4(4);</p><p>char command;</p><p>void setup()</p><p>{</p><p> Serial.begin(9600);</p><p>}</p><p>void loop()</p><p>{</p><p> if(Serial.available() &gt; 0)</p><p> {</p><p> command = Serial.read();</p><p> switch(command)</p><p> {</p><p> case 'F':motor2.run(FORWARD);</p><p> motor4.run(FORWARD);</p><p> break;</p><p> case 'B': motor2.run(BACKWARD);</p><p> motor4.run(BACKWARD);</p><p> break;</p><p> case 'L': motor2.run(BACKWARD);</p><p> motor4.run(FORWARD);</p><p> break;</p><p> case 'R': motor2.run(FORWARD);</p><p> motor4.run(BACKWARD);</p><p> break;</p><p> }</p><p> }</p><p>}</p><p>Hey man try this code. I had used motor2 and motor4. You just replace it with your motor number. This code worked well. I have not tried using the above code, I made mine one. </p>
<p>The app is connecting with the bluetooth module, but when I click any of the arrow keys (on the app) the motors do not move. Can anyone help?</p>
Check whether you gave 2 different supplies for motor shield as well as aruino and installed the adafruit library. Also check the connection of bluetooth module with the arduino, i.e RX n TX of bluetooth module to TX n RX of arduino respectively.
<p>The only thing that I have done wrong is the 2 power supplies, but when I tried that there was still no change. On top of that even through the serial monitor (COM 3), It still doesn't work. No matter what button I press the motors don't turn.</p>
<p>The &quot;above code&quot; refers to that of the author.</p>
<p>Thank you. I renamed my motors and its working</p>
<p>Hello,</p><p>I am wondering if someone could help me...</p><p>I build the RC Car according to this tutorial, and it 's working as expected except with one minor issue... the motor spin is not as fast as I hoped so... the car is very slow, maybe 1 full spin per 2 seconds.</p><p>I used the exact motors as it was used in this tutorial, the same motor driver L293D and Bluetooth module HC-05.</p><p>The motors support max 6V and 300mA to full capacity, and the L293D driver can provide 600mA per motor, so this is not the issue. The two motors are connected to motor1 and motor2 inputs of the driver. The arduino board is powered by an external battery via USB of 5V, 1A. The motor shield is powered directly from arduino (the jumper is included).</p><p>I used the same code and library as in this tutorial with little modifications made by me.</p><p>If someone encountered this issue, a little help is most welcome.</p><p>Thank you.</p>
Instead of taking supply from arduino to the motor shield use a different power source for motor shield. This may solve your problem.
<p>I have same motor driver and bluetooth module and im using Arduino Uno R3 but dont see how i can connect wires from HC05 when the moteor shield is in situ as the shield takes up all the pins needed. How did you get around this is it just wire wrapped around the motor shield pins on TX RX and Ground and Voltage </p>
same bro here also..
<p> i faced same problem. but finally soldered then on L293D motor driver shield</p>
<p>Iam having the same issue it would be great to get a solution </p>
circuit please
<p>not able to upload code in arduino. some error message is coming.</p>
same error occurred for me.. but after adding the afmotor.h library the problem solved. search on google to get the zip file and place on somewhere u can easily find and in arduino ide select sketch option and select include library and select the zip file and ur done. and then compile the code.
<p>works perfectly, thanks.</p>
<p>how to control the speed</p>
<p>Add motor4.setSpeed(255); in void setup. 255 refers to the highest speed.</p>
<p>could you send me the code pls</p><p>Armando.Adame15.5@gmail.com</p>
<p>guys, i just made a full program with leds on and off. if anyone want it then comment your gmail or email id i will send it. i will soon launch my instructable. with full code (Lights turn on and off. , horn and speed control.</p>
<p>I am interested. Please email me camaranjeri1@gmail.com</p>
<p>I am interested in the horn part :).</p><p>Could you please send it to me? stanbogdanandrei22@gmail.com</p>
<p>can someone send me the code? jeremy.fox@principia.edu?</p>
<p>We are having trouble with this, can't get the software to work. Anyone willing to help?</p>
<p>Very good tutorial.</p><p>i can perfectly control my shieldh without the BT via COM3.</p><p>but i cant control anything with the app. please help me</p>
have you connected the hc 05 module with your phone via bluetooth?
<p>Hello. Can you elaborate how you connect the PX and TX pins Bluetootn? The photo is not visible as you have them soldered.</p>
Hi. The motor control shield difficults the access to Arduino pins. So, i used thin wires to connect Tx, Rx and supply voltage pins of the Bluetooth module with the shield.
<p>Could you make a few photos?</p>
i soldered and applied hot glue in it to keep it secured
<p>Hi. Thanks for the video. But just confused how to hook up the bluetooth module. Did you tie around the wires to the pin of the motor shield and then located the shield on the arduino? Having trouble with that..</p><p>Thanks!</p>
He used jumper wires
<p>bro if we are addng a led for head lights how is it possible to contolr via bluetooth?</p>
<p>In this case, you can use the following commands:</p><ul> <br><li>Front Lights On -&gt; W<li>Front Lights Off -&gt; w</ul><p>Add these commands in &quot;switch case&quot;, like that:</p><p>switch(command){</p><p>case 'W'</p><p>digitalWrite(led, HIGH);</p><p>break;</p><p>case 'w'</p><p>digitalWrite(led, LOW);</p><p>break;</p><p>}</p>
where to connect LEDS on motor shield ?<br>
Thanx bro<br>
It was easy to make. i just have prepared my modules and boards. once the car chassis is been shipped. i will send the full pic of assembled car
<p>how to connect LEDS with the module?</p><p>Plz send me the program and schematic on &quot;wadiaraj7@gmail.com&quot;</p><p>if you send me the code and schematic on my gmail id then plz first reply to this comment so that i get notified .</p>
<p>can i use hc-05 bluetooth module ?</p>
<p>yes you have to use HC 05 bt module</p>
<p>In function 'void loop()':</p><p>carBluetooth_V01:20: error: 'Stop' was not declared in this scope</p><p> Stop(); //initialize with motors stoped</p><p> ^</p><p>carBluetooth_V01:25: error: 'forward' was not declared in this scope</p><p> forward();</p><p> ^</p><p>carBluetooth_V01:28: error: 'back' was not declared in this scope</p><p> back();</p><p> ^</p><p>carBluetooth_V01:31: error: 'left' was not declared in this scope</p><p> left();</p><p> ^</p><p>carBluetooth_V01:34: error: 'right' was not declared in this scope</p><p> right();</p><p> ^</p><p>exit status 1</p><p>'Stop' was not declared in this scope</p><p>cant figure it out </p>
<p>have you added the full void forward() { </p><p>thing</p>

About This Instructable




More by caiomoraes:How to control an arduino car via Bluetooth (for beginners) 
Add instructable to: