Smart Light Switch
ESP32-based servo-actuated wall switch with WiFi scheduling
A mechatronic retrofit for a standard wall switch. An ESP32 drives a servo that physically actuates the toggle, a web interface running off the ESP's own WiFi access point handles scheduling, and the whole thing installs in place of the existing switch plate. No cloud, no app. Just a local scheduler that works.
Retrofit a standard wall switch with programmable scheduling while keeping it fully self-contained and not dependent on any external service.
- Must fit within a standard single-gang wall box
- Must work without any internet connection or cloud service
- Servo actuation needs to reliably toggle the physical switch without slipping or stalling
- ESP32 hosts its own WiFi access point. The scheduler is accessible from any device on the local network without a router.
- Servo bracket designed to accommodate the small tolerances of consumer switch plates
- Web UI stored in ESP32 flash, no external hosting
- 01
Servo bracket prototyped and iterated in PLA for fit before final fabrication
- 02
ESP32 firmware: FreeRTOS task for servo control, separate task for web server
- 03
Scheduling logic stores events in NVS (non-volatile storage) so they survive power cycles
Works. Reliably schedules the physical switch toggle. Web UI loads in under 200ms on the local network.
- Servo torque needs significantly more margin than the nominal spec when actuating against spring-loaded switches
ESP brownout: traced to servo voltage spikes
Tracked down why the ESP32 would accept a firmware upload exactly once, then become completely unreachable on every subsequent attempt.
Root cause: the servo was generating voltage spikes on the shared power rail that were browning out the ESP immediately after it started driving the servo. The ESP wasn't crashing or locking up. It was losing power. Confirmed by decoupling the servo from the rail: ESP stayed up indefinitely. Fixed with a dedicated supply for the servo and a decoupling capacitor on the ESP rail. The fix took about ten minutes once the cause was known; finding the cause took much longer.
Tools & Methods
Specs
- MCU
- ESP32
- Actuation
- Servo-driven physical toggle
- Interface
- Local WiFi AP + web scheduler

