A simple robot vehicle built on Arduino and controlled via Bluetooth
This tank is built on Arduino MEGA 2560 using PlatformIO. It is equipped with several sensors and a bluetooth module, so it can be controlled remotely via a web app.
The control app is a regular web application written in React.js and uses Web Bluetooth API for connecting and communicating with the bluetooth module of the tank.
Once the connection is established, you can read sensor values from the board and also control the tank movement with the buttons.
This tank is equipped with several sensors to measure the surrounding environment. Here's the block diagram of the whole board.
Distance measuring is possible thanks to the HC-SR04 ultrasonic sensor.
| HC-SR04 sonar | Arduino |
|---|---|
| Trigger | D32 |
| Echo | D30 |
| GND | GND |
| VCC | 5V |
For direction detection the robot uses the HMC5883L compass which uses the I2C communication protocol.
| HMC5883L compass | Arduino |
|---|---|
| SCL | SCL |
| SDA | SDA |
| GND | GND |
| VCC | 5V |
Measuring temperature and humidity is handled by the SHT-40 sensor which uses the I2C communication protocol.
| SHT-40 thermometer | Arduino |
|---|---|
| SCL | SCL |
| SDA | SDA |
| GND | GND |
| VCC | 3.3V |
This robot uses two DC motors that are integrated into the tank chassis and uses the TB6612FNG driver for controlling the motors.
| TB6612FNG motors driver | Arduino |
|---|---|
| AIN1 | D2 |
| AIN2 | D3 |
| PWMA | D4 |
| BIN1 | D6 |
| PWMB | D7 |
| STBY | D8 |
| GND | GND |
| VCC | 5V |
This tank uses the HM-10 Bluetooth 4.0 module which supports Bluetooth Low Energy (BLE) and thus can be used for connecting to the controling app running in a browser.
| HM-10 Bluetooth | Arduino | Notes |
|---|---|---|
| RX | D13 | Connected via a voltage divider. See the diagram below. |
| TX | D12 | |
| STATE | - | Connected to the blue LED through a 220R resistor |
| VCC | 3.3V | |
| GND | GND |
When connecting with Arduino, we need to add a voltage divider between RX pin of the bluetooth module and TX pin of the Arduino board, as they are working on different voltage levels (5V vs. 3.3V). The electric circuit can be seen on the diagram above.
The robot uses the following LEDs for different purposes.
There is white (FRONT) and red (REAR) LED that serve as lights.
Once the program is loaded and everything is initialized, the green LED (STATUS) will blink at the beginning of each loop.
Lastly, we have the blue LED (BLUETOOTH) that turns on once the Bluetooth connection with the controlling app is established.
| LED | Arduino | Notes |
|---|---|---|
| STATUS | D52 | Through a 330R resistor |
| FRONT | D50 | Through a 330R resistor |
| REAR | D48 | Through a 330R resistor |
| BLUETOOTH | - | Connected to the BT module, through a 220R resistor |


