Introduction: Arduino Controlled Bluetooth-bot

Picture of Arduino Controlled Bluetooth-bot
This instructable will show you how to convert an old toy R/C car from the thrift-store ($1.50) into a bluetooth controlled robot. To make the conversion, you will need an Arduino (any type), an L298N dual 2-amp motor-controller (or similar), and a bluetooth serial adapter from

We will first remove all existing circuitry from the old toy and prepare it for its new brains. Then we will install the Arduino, motor-controller, and bluetooth adapter onto the top of the frame and wire everything up. Lastly, there are a few steps to complete on your computer to pair it with the bluetooth adapter on the robot. The building process is simple and straightforward, using hot-glue to secure each circuit board - which is easily removable later if desired.

To control this bot, I have assigned several keys on the keyboard to carry out various movements from the robot’s motors. By opening a terminal after pairing the Bluetooth-bot to your computer, you can send serial commands by pressing the “i” (forward), “j” (left), “k” (reverse), and “l” (right) keys to command the bot in any direction.

Here is a short video of the bluetooth-bot in action:

All parts can be purchased at, and the motor-controller can either be purchased as a shield (Ardu-moto shield), or built from scratch using the provided PCB layout files. You can download any of the files needed for this project (code and PCB files) from here:

Tools needed:
  • wire stripper/snips
  • soldering iron
  • small screwdriver
  • hot-glue gun

Parts list:

This project was left over from my new book titled “Arduino Robotics” from Apress publishing. I decided to add it online for anyone to build. If you like this and want to see more Arduino based projects like it (including the Lawnbot400, ridable Seg-bot, GPS guided robo-boat, and many more), check out the book webpage:

Arduino Robtics

You can also check out some other projects that I have posted online at my website.

Step 1: Toy Brain Surgery

Picture of Toy Brain Surgery

The PCB that came installed in the toy tank/car base had a small crystal for use with a AM radio transmitter and a few transistors to make a small H-bridge circuit for each motor. We will replace the old circuitry with an Arduino, a Bluetooth serial adapter, and an L298n dual motor-controller IC. The Arduino is reprogrammable, so you can obtain a variety of different behaviors with your bot, though I have only set up basic movement commands (fwd, rev, left, right).

First, strip the R/C car you got from the thrift-store, of all its electronic guts. This includes the motor-controller, R/C crystal, and any other PCB's installed. We will only need two wires to each motor and a set of wires to the battery compartment. The code for this project is intended for use with a "tank-steer" type robot, utilizing one motor on each side of the robot, like a tank. With bi-directional control of each motor, we can turn the robot in a circle without moving forward or reverse (called a "zero-turn radius"). This type of control is extremely effective, especially at slower speeds.

Note: You do not have to have find a toy vehicle with tank tracks, there are many R/C toys at the thrift-store that have wheels, but utilize tank steering - just make sure your vehicle has a drive motor installed on each side. I was able to find several "tracked" tank-steering vehicles at my local thrift-store, with regular visits and a few months time.

Once you remove the old electronic circuits from the toy, we will need a place to mount the Arduino board, the motor-controller PCB, and the small Bluetooth adapter (we will use the battery compartment built in to the toy). If you use an Ardumoto shield for the Arduino, you will only need a place to mount the Arduino. I used a hot-glue gun to add a small blob of glue to the top of the toy base - then mount the Arduino. Using low-temp glue will keep the Arduino securely attached, but also allow you to remove it later without damage if desired.

I designed a small PCB that uses an L298N dual motor driver IC to control (2) DC motors in either direction and with full speed control. The PCB files were created using the freeware version of Eagle CAD and can be used to build your own motor-controller. If you would not like to build your own PCB, you can buy the Ardumoto motor-controller from which uses a surface mount version of the same L298N IC (control pin reassignment may be required in the code).

Download the Eagle files for the L298N motor-controller and code for this project here:

Step 2: Wiring Connections

Picture of Wiring Connections

To get a robot running using Bluetooth, there are very few connections. (3) wires to control each motor from the Arduino to motor-controller, (2) wires for the Bluetooth serial adapter to Arduino, the (4) motor wires, and a few power wires. I used male-pin headers to make patch cables from the Arduino to the motor-controller PCB (both using female headers). If you are using the Sparkfun Ardumoto shield, you will not need to wire the motor controller to the Arduino, just the Bluetooth adapter and power.

The L298N motor driver IC uses 3 inputs for each motor (input A, input B and Enable) to determine both speed and direction. Speed control is most easily accomplished by setting the inputs A and B to determine the direction and using the Enable pin to apply the PWM speed control signal.

See the provided wiring diagram for specific connections.

Step 3: Test (with Kitties)

Picture of Test (with Kitties)
Once you have made the connections between the Bluetooth mate, Arduino, and L298N motor-controller, it is time to install the batteries into the battery compartment. and load the code to the Arduino.

With the code loaded, you will need to "pair" the bluetooth adapter and Bluetooth Mate on your computer. The process to do this will be slightly different depending on what Operating System you are using. First plug in any standard bluetooth adapter

The following steps will describe how to pair your Bluetooth device using Ubuntu 10.10:

Step 1. Turn On Bluetooth-bot and make sure the power LED on the Bluetooth mate is On (blinking red).
Step 2. Open your bluetooth manager (System > Preferences > Bluetooth Manager) - if not installed, open terminal and type:
"sudo aptitude install blueman", and then continue.
Step 3. Click the Search button to discover new devices.
Step 4. Right click on the Bluetooth Mate from the list (mine was listed as "FireFly - A4C7") and select the option for "Serial port" - you might also see your cell phone show up on the list if available, make sure you select the correct device.
Step 5. Now you will see a dialog box asking for the passcode of the Bluetooth Mate - mine was set by default to "1234".
Step 6. With the passcode entered, your Bluetooth Mate should now be connected to your PC - the red blinking light on the Bluetooth mate will turn solid green to let you know that it is connected.
Step 7. To control the bot, open a terminal and type the following: "screen /dev/rfcomm0 115200"

The full instructional video on how to set up your Bluetooth-bot with your PC is here:

Now you should be controlling your robot using the keyboard. Make sure the Caps lock is turned Off and use the following keys (lower-case i, j, k, and l) to make your robot move. Holding a key down will result in constant movement, let go and the bot should stop:

forward = "i"
reverse = "k"
left = "j"
right = "l"

speed value UP = "."
speed value DOWN = ","
max speed = "/"

Additionally, you can change the speed value that is written to the motors by pressing the period, comma, and back-slash keys. The "comma" key is used to lower the speed value (from 0-255), the "period" key is used to raise the speed value (increments of 5), and the "back-slash" key is used to set the speed_value to 255 (max).

Any other key that is pressed on the computer keyboard with the terminal open, will yield a response (the LED will blink), but no motor action will be commanded. If you would like to assign different keys to the control functions, simply open the serial monitor (at 115,200 bps) and press the key you would like to use - the Arduino will display the BYTE value on the serial monitor of any key that is pressed, so you can record the value shown and modify the sketch accordingly.

Once you get your Bluetooth-bot working, feel free to add more movement functions and modify the code as you please - if you mess it up, just download the original code again. The code is also available on the next page for viewing.

Step 4: Code

Picture of Code

This code can be downloaded from the book website:

// Bluetooth-bot v1
// Arduino Robotics unofficial chapter 14
// use Bluetooth Mate serial adapter to receive commands from PC
// Arduino decodes commands into motor movements
// Creates high-speed wireless serial link for robot control using keyboard
// Uses keys "i" = forward, "j" = left, "k" = reverse, and "l" = right
// speed control is also implemented using "," = speed down, "." = speed up, and "/" = max speed.

// L298 motor control variables
int M1_A = 12;    // if using Ardumoto, change to pin 13
int M1_PWM = 11; 
int M1_B = 10; // if using Ardumoto, remove this variable

int M2_A = 4;   // if using Ardumoto, change to pin 12
int M2_PWM = 3;
int M2_B = 2;    // if using Ardumoto, remove this variable

// LED pin attached to Arduino D13
int LED = 13;

// variable to store serial data
int incomingByte = 0;

// variable to store speed value
int speed_val = 255;


void setup(){

TCCR2B = TCCR2B & 0b11111000 | 0x01; // change PWM frequency for pins 3 and 11 to 32kHz so there will be no motor whining

// Start serial monitor at 115,200 bps

// declare outputs
pinMode(LED, OUTPUT);

pinMode(M1_A, OUTPUT);
pinMode(M1_PWM, OUTPUT);
pinMode(M1_B, OUTPUT);

pinMode(M2_A, OUTPUT);
pinMode(M2_PWM, OUTPUT);
pinMode(M2_B, OUTPUT);

// turn motors Off by default




void loop(){

// check for serial data
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte =;
// if available, blink LED and print serial data received.
digitalWrite(LED, HIGH);
// say what you got:
Serial.print("I received: ");
// delay 10 milliseconds to allow serial update time

// check incoming byte for direction
// if byte is equal to "46" or "," - raise speed
if (incomingByte == 46){
speed_val = speed_val + 5;
// if byte is equal to "44" or "." - lower speed
else if (incomingByte == 44){
speed_val = speed_val - 5;
// if byte is equal to "47" or "/" - max speed
else if (incomingByte == 47){
speed_val = 255;

// if byte is equal to "105" or "i", go forward
else if (incomingByte == 105){
// if byte is equal to "106" or "j", go left
else if (incomingByte == 106){
// if byte is equal to "108" or "l", go right
else if (incomingByte == 108){
// if byte is equal to "107" or "k", go reverse
else if (incomingByte == 107){
// otherwise, stop both motors
else {


else {
digitalWrite(LED, LOW);

void test_speed(){
// constrain speed value to between 0-255
if (speed_val > 250){
speed_val = 255;
Serial.println(" MAX ");
if (speed_val < 0){
speed_val = 0;
Serial.println(" MIN ");


/////////// motor functions ////////////////

void M1_reverse(int x){
digitalWrite(M1_B, LOW);
digitalWrite(M1_A, HIGH);
analogWrite(M1_PWM, x);

void M1_forward(int x){
digitalWrite(M1_A, LOW);
digitalWrite(M1_B, HIGH);
analogWrite(M1_PWM, x);

void M1_stop(){
digitalWrite(M1_B, LOW);
digitalWrite(M1_A, LOW);
digitalWrite(M1_PWM, LOW);

void M2_forward(int y){
digitalWrite(M2_B, LOW);
digitalWrite(M2_A, HIGH);
analogWrite(M2_PWM, y);

void M2_reverse(int y){
digitalWrite(M2_A, LOW);
digitalWrite(M2_B, HIGH);
analogWrite(M2_PWM, y);

void M2_stop(){
digitalWrite(M2_B, LOW);
digitalWrite(M2_A, LOW);
digitalWrite(M2_PWM, LOW);


TrevorB23 (author)2017-07-19

Hi! I was wondering if you ran into the same problem I did when I made RC Arduinos with a class- when the motor bridge does its thing, it drops about 2V, so using the battery cases that came with the vehicles turned out to not work in a lot of cases- for example, a 4 x AA vehicle which was either 4.8 or 6 volts ended up not being able to even move the car after the voltage drop.

calinezul (author)2016-12-22

Very useful tutorial how to make a bluetooth controlled robot

Dhiviyansh Punamiya (author)2016-09-04

Is it really ok to pit an electric current greayer than 5 volt into the arduino ??

Dhiviyansh Punamiya (author)2016-09-03

I am Dhiviyansh. The bluetooth module 'bluetooth mate gold' is out of my budget. So can i us a 'HC -06' module

DishantS6 (author)2016-06-17

can you use an android phone for these wiring connections?, plz help me i have to show that wiring for different purposes can work for other builds using same wiring. plz plz plz help me, anyone

LakvinduN (author)2016-05-06

what application sending commands

LakvinduN (author)2016-05-06

is there is only two motors.

sajith906 (author)2016-04-15


DangA3 (author)2016-02-02

Hi, I have a problem with serial read, it received wrong values when I press a key in terminal window. Can you help me with this problem

aditya narainm (author)2014-11-17

i am trying to make this project with a l298nIC will it work with that ?I just don't know than which pin on the l298nIC is used for supplying the voltage to the motors

iranasak (author)aditya narainm2015-10-17

motors can get their power from ic boot the -vcc shoulde get from battery

vinay0745 (author)2015-06-17

you are talking about terminal in step 7 which terminal is to get that??

bsampangi (author)2015-03-24

Does it work for a smartphone

gwinasta sinisuka (author)2015-02-21

does it work for a mobile phone

osdoyi made it! (author)2015-02-03

Thanks a lot

johndavid400 (author)osdoyi2015-02-03


magomi79 (author)2015-01-23

cual es el valor de las resistencias del l298n

psycho.maggot (author)2014-11-30


akevingeorge (author)2014-11-04

how to control it from computer is there any software

akevingeorge (author)2014-11-04

how to control it from computer is there any software

akevingeorge (author)2014-11-04

how to control it from computer is there any software

I didn't understand the computer's side. How are we sending different values by pressing different keys??

yanz67 (author)2014-08-13

Thank you for the reply. Just to clarify. Are you connecting the L298 and arduino in series to the batteries? I bought a L298 driver board that has a 5v regulated output. Do you think it is a good idea to use it to power arduino and i will have a bluetooth shield on top of it? I read that arduino requires more then 5v connected to Vin. I guess when you connect it with usb then it only gets 5v anyway.

I am just starting out in electronics :)

Have a good day!


johndavid400 (author)yanz672014-08-14

Yes, you can power the Arduino with 5v, but I would not use the regulated output from the L298 driver... I would connect the full battery power to both the L298 VIN and the Arduino VIN pins. The Arduino can accept up to 12v at the VIN pin (between the two GND pins and A0 pin) and it will regulate down to 5v from there. If you power the Arduino with a regulated 5v output, it will work but you will only have as much current available as the L298 regulator will support (probably 1amp).

As a sidenote, you should not power the Arduino by connecting a power source to the 5v pin (regulated or not), as the 5v pin on the Arduino is on the regulated side of its internal regulator... always power it via the VIN pin with a source from 5v to 12v unregulated.

Poppy Ann (author)2014-06-08

good instructable, you could use one of these:-

this saves using a arduino plus a motor controler.

also why not use the arrow keys on the keyboard (easier to remember) or a android phone.

johndavid400 (author)Poppy Ann2014-08-14

sure, I have played with Dagu and it should be sufficient as long as your motors don't require more than 1amp. It would definitely work on the toy tank that I bought... and should work on most toys.

Also, you can map the controls to any keys you want... though all keyboards have I, J, K, L, so I just used those. Most keyboards have up/down arrows, so that should work just fine. You would just need to open the serial monitor and see what code is sent across when you press those keys.

You can also use an android phone, but at the time of writing this, I didn't have an android that would allow me to pair to the bluetooth module... might try this with my newer phone.

yanz67 (author)2014-08-12

Hi. This is a great instructable. I have one question. How do you power the power shield, motors and arduino. Do you use one 12 volt battery and connected in parallel to the arduino and shield or it is two separate power sources?


fswan (author)2014-01-25

hey mate

was wondering, is this usable on windows at all??I have all the components but I'm not sure how to control it

love the project

eagerly awaiting your reply :)

44389 (author)2013-12-29

Can you use the arduino motor shield? Instead of the L293D

robotteen (author)2013-07-17

will this work with the arduino app for like apple or android devices

us241098 (author)2013-06-04

Yeah does the same code work for L293D? please answer.

us241098 (author)2013-06-04

Yeah does the same code work for L293D? please answer.

speak2sainow (author)2013-05-13

sir does the same code works for the L293D motor driver Ic ??

ksharma10 (author)2013-04-20

sorry for the late reply,
tthe manner in which you are controlling the bot, the same manner i want to apply.. as long as the user presses i,j,k,l.. the bot should perform the same action.
the user must not press enter to feed the instructions for directions.

ksharma10 (author)2013-04-16

will this program also work over using xbee??
also how to give continuous input for direction control without pressing enter.. pls help.. need it for project.

johndavid400 (author)ksharma102013-04-16

sure it will work over xbee, just without the pairing process used with the bluetooth... xbee is actually far easier to set up and has a far better range, but is more expensive to buy 2 xbee radios than one bluetooth adapter and a bluetooth module.

what method of control are you going for? I assume you would like to press forward once and let it go forward until you press another button?

el_puchungo (author)2012-12-10

Is there a way to use a PS3 controller (bluetooth) to control the robot? It would make it a lot easier to control the robot using a hand held controller rather than a keyboard. Please let me know.

adagio15 (author)2012-10-16

Can it work with Windows, You said that the video will explain connecting it to your PC, But it only shows using Ubuntu...
Nolan5683 asked an interesting question... Is it possible?


something1 (author)2012-07-13

How did you make the motors run as long as you pressed the button. And what terminal did you use.

evilcomputer (author)2012-06-12

can you give me the componets list for the motor controller i can't find the list anywhere,even in the arduino robotics book please

R. Butch (author)2012-05-21

I am new to all this Arduino business and I have no idea what you are really talking about. Is t possible to do this kind of thing, but putting the programming on a Macintosh MacBook. If it is, please tell me!

niceguy960 (author)2012-05-15


I am kind of new to the robot-building-scene, but I really want to give it a try. So I want to apologize in advance for the dumb question.

But I still have one thing that I don't understand and I was hoping someone could help me out here.

Wouldn't you have to have a (java) program running on your pc in order to send the commands to the bot? or in other words, how does your pc send the info to your bluetooth transmitter?

thanks to anyone willing to help!!

DirtyMex (author)2012-04-30

would this work the same if it were a "walking" instead of a "driving" bot?

manikantak136 (author)2012-04-26

can you please tell me whare to connect bluetooth mate gold.if i am using Sparkfun Ardumoto shield.please tell me

David97 (author)2012-02-21

Hi there, I am trying to build a rc tank with the lawnbots cade, What are the en1 and en2 connections for?

dude44389 (author)2012-02-11

im having trouble getting my bluetooth bot to work can please send a more detailed list of instructions so i can get mine to work I used a(n) arduino uno, bluetooth mate silver and a motor shield please respond soon

David97 (author)2012-01-28

Is that the linus line bot in tthe pics?

nick003 (author)2012-01-25

where do you get the tracks from

akinich (author)2011-12-31

hey is it possible to do this with a ps3 controller without the computer at all?
thanks in advance

francisroan (author)2011-10-15

hey wat u said i perfetly coorect we cannot connect the dongle to the arduino...but we can make a usb host shield do u have any idea to make and the atmega8u2 i thought that can act as a host!!!???

About This Instructable




Bio: I have always been one to take things apart to figure out how they work, so most of what I own has been dismantled. If ... More »
More by johndavid400:Arduino controlled Bluetooth-botCore3duinoArduino R/C Lawnmower (painted)
Add instructable to: