Build the hardware
Print the case, make three connections to the ESP32, and flash the controller. When you're done, one button powers the Pi on, starts recordings and shuts everything down.
Print the enclosure
Both parts are in hardware/, exported from Fusion as .3mf. Start with the small plug test. It tells you if the plug fits before you commit to the full case.
Wire the controller
The ESP32-C3 stays on all the time. It reads the button, signals the Pi, and switches the PowerBoost's 5V output through a 2N2222.
GPIO 3 never drives voltage into a powered-off Pi. The Pi's pull-up holds the line high, and the ESP32 only pulls it low.
The transistor "presses" the PowerBoost K pin. One tap turns 5V on, a double tap turns it off.
INMP441 mic to the Pi's I2S pins, recording LED to BCM GPIO27. [ADD MIC PIN MAP]
Flash the ESP32
- Open
controller/esp32_controller/esp32_controller.inoin the Arduino IDE. The folder name must match the sketch. - Board: ESP32C3 Dev Module (esp32 core by Espressif).
- Turn on USB CDC On Boot for serial output.
- Upload, then open the Serial Monitor at 115200 baud.
Tune the feel: debounce, click window, long-press threshold and pulse lengths are constants at the top of the sketch.
Check: try every gesture
With the Serial Monitor open, each gesture should print a log line. The lower trace shows the signal the controller sends.
Single click
Toggles recording on the Pi.
Triple click
Powers the Pi on.
Long press
Fires on release. Shuts the Pi down cleanly, then cuts power.
