Control a toy tank from any Android phone via Bluetooth. Built with Arduino, an HC‑05 module, and a DRV8833 motor driver. Perfect for beginners who want to learn about wireless communication, motor control, and embedded programming.
- Overview
- Features
- Hardware Requirements
- Software Requirements
- Wiring Diagram
- Installation & Build
- Usage
- How It Works
- Troubleshooting
- License
- Credits
This project turns a simple 2‑motor tracked chassis into a Bluetooth‑controlled tank.
Send commands from a joystick‑style Android app and watch the tank move forward, backward, left, or right.
The firmware uses PWM for smooth speed control and flashes the built‑in LED to indicate activity.
- ✅ Bluetooth serial communication (HC‑05)
- ✅ Proportional speed control via PWM (DRV8833)
- ✅ Simple command set:
1= forward,2= left,3= right,4= backward - ✅ LED feedback on pin 13
- ✅ PlatformIO ready (also works with the Arduino IDE)
- ✅ Uses the lightweight advancedSerial library for debug prints
| Part | Quantity | Notes |
|---|---|---|
| Arduino Uno / Nano / Any 5V Arduino-compatible board | 1 | 5V logic required |
| HC‑05 Bluetooth module | 1 | Pre‑configured to 9600 baud (default) |
| DRV8833 dual motor driver carrier | 1 | Alternatively use L298N (see Branches below) |
| Two DC gear motors (with suitable wheels/tracks) | 2 | 6‑12 V, current < 1 A per motor |
| External battery pack (6‑12 V) | 1 | Powers the motors; Arduino can be powered via USB or VIN |
| Breadboard & jumper wires | – | For prototyping |
| Optional: 10 µF electrolytic capacitor across motor supply | 1 | Helps suppress voltage spikes |
You can find many “Bluetooth Arduino Tank Control” apps on the Play Store – see the Android Application section.
- PlatformIO Core (CLI) or VS Code with PlatformIO extension
or the classic Arduino IDE (≥1.8.0) - advancedSerial library (included as a Git submodule)
- Optional: a serial monitor (e.g., PlatformIO’s built‑in monitor, Arduino Serial Monitor, or a Bluetooth serial terminal app)
Arduino HC-05 DRV8833 Motors
------ ----- -------- ------
5V --------> VCC VCC --------> Motor A VCC
GND --------> GND GND --------> Motor A GND
D2 (RX) <------ TX
D1 (TX) ------> RX
D4 --------> IN1 (Motor A1)
D5 --------> IN2 (Motor A2)
D6 --------> IN3 (Motor B1)
D9 --------> IN4 (Motor B2)
- Connect Motor A to OUT1/OUT2 of the DRV8833, Motor B to OUT3/OUT4.
- If your driver has separate
ENABLEpins, tie them toVCC(they are internally tied on many breakout boards). - Power the motor supply (
VM) from your external battery pack; keep the Arduino’sVINor USB separate unless you have a common ground.

(Add your own diagram or photo here.)
git clone --recurse-submodules https://github.com/yourname/ArduinoBluetoothTank.git
cd ArduinoBluetoothTankIf you already cloned without --recurse-submodules:
git submodule update --init --recursive# Install PlatformIO if you don't have it
pip install -U platformio # or follow https://docs.platformio.org/en/latest/core/install.html
# Compile the firmware
pio run
# Upload to your Arduino (make sure the correct port is selected in platformio.ini)
pio run --target upload- Open
ArduinoBlueToothTank/ArduinoBlueToothTank.ino. - Sketch → Include Library → Add .ZIP Library… → select the
lib/advancedSerialfolder. - Choose your board and port, then click Upload.
- Power the tank (connect the external battery to the motor driver, and power the Arduino via USB or VIN).
- Pair your phone with the HC‑05 (default PIN:
1234or0000). - Launch a Bluetooth joystick app (e.g., Bluetooth Arduino Tank Control).
- Push the joystick:
- Up → sends ASCII
'1'→ tank moves forward - Left → sends
'2'→ turns left - Right → sends
'3'→ turns right - Down → sends
'4'→ moves backward - Release or any other key → tank stops (see code).
- Up → sends ASCII
- The onboard LED (pin 13) flashes while a command is being executed.
The firmware is intentionally simple yet illustrative:
- Bluetooth Serial – We use
SoftwareSerialon pins 2 (RX) and 1 (TX) to talk to the HC‑05 at 9600 baud. - Command Parsing – Each received byte is stored in
state. The ASCII characters'1'‑'4'trigger specific motor patterns. Any other byte resetsstateto0(stop). - Motor Control – The DRV8833 expects PWM on its input pins to control speed. We use
analogWrite(pin, motorSpeed)wheremotorSpeedis set to150(≈ 60 % duty). For turning, we drive one motor forward and the other backward (or vice‑versa). - Safety Stop – After each movement command we call
stop(), which briefly sets all inputs LOW and adds adelay(100)to prevent drifting. - Debug Output – The
advancedSeriallibrary lets us print the received byte and action names to the Arduino Serial Monitor (helpful while developing).
SoftwareSerial mySerial(2, 1); // RX, TX
// ...
if (mySerial.available() > 0) {
state = mySerial.read(); // get command
Serial.println(state); // debug
// act on state …
}The advancedSerial instance aSerial is declared in the library and used for optional verbose logging (currently unused but ready).
| Symptom | Likely Cause | Fix |
|---|---|---|
| No response from tank | HC‑05 not paired or wrong baud | Re‑pair phone; ensure HC‑05 is set to 9600 baud (AT+UART=9600,0,0) |
| Motors jitter or don’t turn | Insufficient motor supply or common ground missing | Use a adequate battery (≥ 6 V, ≥ 2 A) and connect Arduino GND to motor supply GND |
| LED never flashes | Serial not receiving data | Check wiring: TX of HC‑05 → Arduino RX (pin 2), RX ←→ TX (pin 1). Verify with Serial Monitor. |
Compilation error: advancedSerial.h not found |
Submodule not initialized | Run git submodule update --init --recursive |
| Upload fails | Wrong port or board selected in platformio.ini |
Edit [env] section to match your Arduino model and port |
This project is released under the MIT License – see the LICENSE file in the advancedSerial submodule for details. Feel free to fork, modify, and share!
- advancedSerial library – https://github.com/klenov/advancedSerial
- HC‑05 Bluetooth module – ubiquitous cheap BT serial bridge
- DRV8833 motor driver – TI’s compact dual‑H‑bridge
- Android App – “Bluetooth Arduino Tank Control” by Garylcyhk (Play Store)
- You – for building and having fun!
Happy hacking! 🚀
If you make improvements, consider opening a pull request or sharing your build photos. Let’s keep the tank rolling!