As an Amazon Associate we earn from qualifying purchases.
A Bluetooth controlled robot is a small moving vehicle that you drive wirelessly from a phone or computer. A microcontroller reads commands sent over Bluetooth and switches a motor driver, which turns the motors forward, backward, left or right. It works within Bluetooth range, so it suits indoor use, classroom demos and learning projects.
This article covers the design and construction of such a robot: how it works, what you need, the circuit diagram, the full program and the PCB layout. It also includes testing tips and a short FAQ.
How the Bluetooth controlled robot works
The robot is a moving object controlled by Bluetooth technology. A microcontroller and a driver circuit run the DC motors. The microcontroller cannot power motors directly, which is why the driver circuit sits between them. According to the signal from the Bluetooth device (connected to a phone or computer), the robot moves along the path you give it. It can be driven by a stepper motor or a DC motor.
The project was divided into two phases:
- Phase one: demonstrate Bluetooth communication for coordinated robotic search.
- Phase two: control the robot’s movements, with information sent through the master Bluetooth device.
Information flows in two ways. Commands go from the phone or computer to the robot to control its direction and other functions. The program below also sends each received character back to the sender, so you can confirm that a command arrived.
On an Android phone, the up/down and left/right arrow keys of the controller app move the robot. Each key press sends a single character over Bluetooth, and the program turns that character into motor movement.
What you need
- An Arduino-compatible microcontroller board
- A Bluetooth serial module (an HC-05 or similar)
- A motor driver circuit, or driver board, for the DC motors
- DC motors (or a stepper motor) and a chassis with wheels
- A separate battery supply for the motors, plus a stable supply for the board
- An Android phone with a Bluetooth controller app that sends the characters listed below
- Jumper wires, or a PCB if you want a permanent build
The exact parts depend on the circuit diagram below, so check it before you buy. If you are new to serial Bluetooth, it helps to read how to use Bluetooth with Arduino first, because the same ideas apply here.
CIRCUIT DIAGRAM
The diagram shows the microcontroller, the Bluetooth module and the motor driver. Some points apply to almost every build of this kind:
- The Bluetooth module connects to the board’s serial pins (TX to RX, RX to TX). The program uses the hardware serial port at 9600 baud.
- The motor driver inputs connect to digital pins 5 to 12, which the program sets as outputs.
- All grounds must be common: the board, the Bluetooth module and the motor supply.
- Power the motors from their own battery, not from the board’s regulator.
How the commands map to movement
The program reads one character at a time and calls a helper function to set a pair of output pins. These are the commands it understands:
- F: pins 5 and 6 set for forward
- B: pins 5 and 6 reversed, for backward
- L and R: pins 7 and 8 set in opposite directions, for left and right
- G, I, H, J: a drive command and a turn command combined (forward-left, forward-right, backward-left, backward-right)
- W/w, U/u, V/v, X/x: extra outputs on pins 9 to 12, each switched on for 100 ms
- Any other character: all outputs are switched off and the robot stops
From this layout, pins 5 and 6 appear to drive the main motor and pins 7 and 8 the steering motor, as on a car-style chassis. If your robot uses two driven wheels instead, you may need to change which pins each command sets.
PROGRAM
void setup()
{
Serial.begin(9600);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}
void loop()
{
if(Serial.available() > 0)
{
char a =Serial.read();Serial.write(a);
if(a=='F')
{
frd(5,6);
}
else if(a=='B')
{
frd(6,5);
}
else if(a=='L')
{
frd(7,8);
}
else if(a=='R')
{
frd(8,7);
}
else if(a=='G')
{
frd(5,6);frd(7,8);
}
else if(a=='I')
{
frd(5,6); frd(8,7);
}
else if(a=='H')
{
frd(6,5);frd(7,8);
}
else if(a=='J')
{
frd(6,5);frd(8,7);
}
else if((a=='w')||(a=='W'))
{
frd(9,10);
delay(100);
}
else if((a=='u')||(a=='U'))
{
frd(10,9);
delay(100);
}
else if((a=='v')||(a=='V'))
{
frd(11,12);
delay(100);
}
else if((a=='X')||(a=='x'))
{
frd(12,11);
delay(100);
}
else
{
stp(5,6);
stp(7,8);
stp(9,10);
stp(11,12);
}
}
}
void frd(int a,int b)
{
digitalWrite(a,HIGH); digitalWrite(b,LOW);
}
void stp(int a,int b)
{
digitalWrite(a,LOW); digitalWrite(b,LOW);
}
The helper function frd(a, b) sets pin a high and pin b low, which turns a motor one way. Swapping the arguments reverses it. The function stp(a, b) sets both pins low, which stops that motor.
The program only stops the motors when it receives a character it does not recognise. Most controller apps send a stop character when you release a button, so the robot stops moving. If your app does not, the robot will keep moving until you send something else.
PCB LAYOUT
Once the circuit works on a breadboard, you can move it to a PCB for a more reliable build. Loose jumper wires are the most common cause of robots that stop responding when they bump around. Keep the motor power tracks short and wide, and keep them away from the Bluetooth module where you can.
Testing and troubleshooting
Test in stages instead of powering everything at once.
- Upload the program with the Bluetooth module’s connection to the serial pins removed. These pins are shared with USB uploads, and a connected module can make the upload fail.
- Reconnect the module and pair the HC-05 module with your phone if that is the module you used. The pairing step is covered in a separate guide.
- Open the controller app, connect, and send a character. Because the program echoes characters back, a serial terminal shows whether they arrive.
- Lift the robot off the ground and check each direction before you put it on the floor.
If something does not work, check these first:
- No response: check the TX/RX wiring and the baud rate. The module must be set to the same 9600 baud as the program.
- A motor spins the wrong way: swap that motor’s two wires, or swap the pin numbers in the command.
- Board resets when the motors start: the supply is probably sagging. Use a separate motor battery with a shared ground.
- The robot never stops: check which character your app sends when you release a button.
Ideas to extend the project
After the basic robot works, you can add more features. A Bluetooth controlled fire robot adds a sensor and an extinguishing mechanism to the same idea. If you prefer automatic movement, a line follower robot with Bluetooth control combines sensors with manual override. A larger vehicle like our Android controlled land rover shows how the same approach scales up.
FAQ
How far can a Bluetooth controlled robot go from the phone?
It works only within the range of the Bluetooth link. Typical modules are meant for short distances, and walls and other obstacles reduce the range. Check your module’s datasheet for its rated range.
Can I control the robot from a computer instead of a phone?
Yes. Any device that can send characters over a Bluetooth serial connection can drive it. The robot only needs to receive the same characters the program expects.
Can I use a stepper motor instead of DC motors?
Yes, the design allows either. A stepper motor needs a suitable driver and a different control sequence from the simple on/off pin pairs used here, so the code would need changes.
Why does the program send each character back?
The line Serial.write(a) echoes the received character. It makes testing easier, because you can see on the sending side that the command arrived.