Build it step by step
0 of 7 doneTest the motors
On the bench with propellers off.
Pair the phone
Send letters and see the motors move.
Build the hull
Foam with a flat bottom.
Waterproof the box
Silicone and a tissue test.
Fit the motors
Propellers at the back.
Test in a bath
Slowly and under watch.
Add the charge port
A sealed socket.
How do you build a bath-tub Bluetooth boat?
A foam boat with two small motors steers by speed difference and is driven from a phone. You need ESP32 DevKit V1, MX1508 dual motor driver, N20 micro metal gear motor × 2, Li-Po battery 3.7 V 1000 mAh, TP4056 module with protection (USB-C) and MT3608 Boost Module. It takes 7 steps and about 180 minutes.
- Level
- Beginner
- Time
- About 180 min
- Parts
- 6
Wiring
| From | To | Why |
|---|---|---|
| LiPo plus and minus | Power switch, then MX1508 VCC and GND | Motor supply |
| LiPo plus | MT3608 boost input, output set to 5 V | Logic supply |
| MT3608 output | ESP32 VIN | Power the board |
| MX1508 IN1 and IN2 | ESP32 GPIO25 and GPIO26 | Left motor |
| MX1508 IN3 and IN4 | ESP32 GPIO27 and GPIO14 | Right motor |
| Motors | MX1508 OUT1 and OUT2, OUT3 and OUT4 | Propellers |
| TP4056 OUT and LiPo | In parallel with the cell | Charging |
| All grounds | Joined | Common ground |
Code
Steering works by running one motor faster than the other, with no rudder, and the speed is a digit from 1 to 9. The boat stops the moment the phone disconnects, so it cannot run away. Use a phone app such as Serial Bluetooth Terminal and pair with the name BathBoat. Seal the electronics in a small waterproof box with silicone around the shaft holes; the motor shafts are the weak spots, so use grease and small rubber sleeves, and test the box with paper tissue inside before putting in electronics. A LiPo cell is a hazard if it gets wet or damaged: use a protected cell, never charge it while wet or unattended, never leave it in a hot car, and replace it if it swells. Use the boat only in a bath, a pond or a pool with an adult watching; propellers should be guarded, hands out of the water while it runs, and small parts kept from young children. Never use it near people swimming. The sketch needs the arduino-esp32 package 2.0.x for the LEDC calls shown.
Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Bath boat: control over classic Bluetooth. Send F, B, L, R or S from a Serial Bluetooth Terminal app. Board: ESP32 Dev Module.
#include "BluetoothSerial.h"
BluetoothSerial bt;
const int L1 = 25, L2 = 26, R1 = 27, R2 = 14;
int speedVal = 200;
void drive(int l, int r) {
ledcWrite(L1, l > 0 ? l : 0); ledcWrite(L2, l < 0 ? -l : 0);
ledcWrite(R1, r > 0 ? r : 0); ledcWrite(R2, r < 0 ? -r : 0);
}
void setup() {
int pins[4] = {L1, L2, R1, R2};
for (int i = 0; i < 4; i++) ledcAttach(pins[i], 1000, 8); // ESP32 core 3: PWM is set up per pin
bt.begin("BathBoat");
drive(0, 0);
}
void loop() {
if (bt.available()) {
char c = bt.read();
if (c == 'F') drive(speedVal, speedVal);
else if (c == 'B') drive(-speedVal, -speedVal);
else if (c == 'L') drive(speedVal / 3, speedVal); // turn by running one side slower
else if (c == 'R') drive(speedVal, speedVal / 3);
else if (c == 'S') drive(0, 0);
else if (c >= '1' && c <= '9') speedVal = (c - '0') * 28;
}
if (bt.hasClient() == false) drive(0, 0); // stop if the phone disconnects
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| F | Both motors forward |
| L or R | Boat turns |
| Phone disconnected | Motors stop |
| Tissue test | Dry |
If it does not work
No pairing
Check the BathBoat name and the ESP32 board package.
One motor reversed
Swap its two wires.
Boat leaks
Redo the seals.
Brownout resets
Check the battery and the boost converter.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the bath-tub Bluetooth boat?
ESP32 DevKit V1, MX1508 dual motor driver, N20 micro metal gear motor × 2, Li-Po battery 3.7 V 1000 mAh, TP4056 module with protection (USB-C) and MT3608 Boost Module.
How long does the bath-tub Bluetooth boat take to build?
About 180 minutes for a beginner maker, in 7 steps.
How do I know the bath-tub Bluetooth boat works?
F: Both motors forward. L or R: Boat turns. Phone disconnected: Motors stop.
No pairing: what should I check?
Check the BathBoat name and the ESP32 board package.
One motor reversed: what should I check?
Swap its two wires.
Boat leaks: what should I check?
Redo the seals.
Brownout resets: what should I check?
Check the battery and the boost converter.
