← All projects
esp32 c++ platformio servo

Let's Automate Henrique's Coffee Machine

This project upgrades Henrique's perfectly good coffee machine into a slightly overengineered, fully automated caffeine robot.

Press a button on a web page and an ESP32 presses the machine’s power button, waits for it to heat up, pulls the brew lever with a servo, holds it, and puts it back.

Nothing on the machine is modified permanently. The ESP32 drives the existing controls, so it’s still a normal coffee machine you can use by hand.

How it works

Three lines connect the ESP32-S3 to the machine:

  • Button: simulates a press on the power/brew button
  • Ready signal: reads when the machine reports it’s heated
  • Lever servo: moves the brew lever between rest and brew

A brew runs as a state machine, and every step has a timeout. If the machine never reports ready, the cycle stops with an error instead of hanging, and the lever always returns to rest.

IDLE → PRESS_BUTTON → WAIT_READY → ACTUATE_LEVER → BREWING → RETURN_LEVER → DONE

Controlling it

The firmware joins the Wi-Fi and serves a small web UI at coffee.local, with its own access point as a fallback. There’s a REST API too: POST /api/start brews a coffee.