r/u_shanebou24

▲ 1.1k r/u_shanebou24+5 crossposts

Built a PS4-controlled RC lawn mower using an ESP32 — here’s how it works

So I’ve been building a remote-controlled lawn mower using an ESP32 and a PS4 controller, and I’m pretty happy with how the software has come together. Wanted to share the details for anyone doing something similar.
The hardware:
• ESP32 as the brain
• Two Cytron 13A MD13S DC motor drivers for the tank-style drive tracks
• Three relays — an arm relay, a mower motor relay, and a turbo relay
• PS4 DualShock controller connected wirelessly via Bluepad32
How the controls work:
The unit drives in tank mode. You can toggle between dual-stick (each stick controls one track independently) and single-stick (left stick Y = throttle, left stick X = steering mix) by pressing the PS button. The controller LED changes colour to show which mode you’re in — blue for dual stick, green for single stick.
The mower blade has a safety start sequence. When you press R1, an arm relay fires first and holds for 500ms, then the motor relay latches on and both stay high together. Press R1 again and both drop simultaneously. This gives a deliberate two-stage interlock before the blade spins up.
There’s also a turbo relay on Triangle that flashes the controller LED white while active.
The D-pad works as a secondary driving option. The speed ceiling is set by how hard you squeeze L2 — the harder you’ve squeezed it, the faster the D-pad will drive. L1 resets that speed back to zero. Clever for creep mode.
The analog sticks use a gentle S-curve so the low end is slow and precise, and it ramps up more aggressively toward full deflection.
On disconnect, everything shuts down immediately — motors stop, all relays drop. No runaway mower.
The PS4 LED tells you everything at a glance:
• Solid blue = dual stick mode
• Solid green = single stick mode
• Flashing red/blue or red/green = mower motor relay is latched on
• Flashing white = turbo active (white takes priority)
Why Bluepad32 over the PS4Controller library?
Bluepad32 pairs by just holding the PS button — no sixaxispairer tool needed. It also gives you proper analog trigger values, a cleaner API, and it’s actively maintained. Highly recommend it for any ESP32 gamepad project.
Happy to share code if anyone’s interested.

u/shanebou24 — 6 days ago