Build an ESP32-Controlled Coffee Roaster: Drum Drive, PID Temperature Profiling, and Roast Curve Logging
ESP32 DevKit Board
MAX31855 Thermocouple Amplifier Breakout
Type K Thermocouple Probe, Fast-Response
Zero-Cross Solid-State Relay, 25A+
Drum Roaster Base / Conversion Kit
Electrical Enclosure Box with Cable Glands
Inline Fuse Holder, Mains Rated
GFCI-Protected Outlet or Power Strip
Prices and availability as of Nov 22, 4:55 AM ET and subject to change. The price shown on Amazon at the time of purchase applies.
Home coffee roasting lives or dies on repeatability — the difference between a great batch and a scorched one is often a single minute of first-crack timing you can't quite remember from last time. An ESP32-controlled roaster fixes that by driving the drum motor and heating element through a proper PID loop, logging a real roast curve (bean temperature over time) you can review and repeat, and alerting your phone the moment first crack or your target drop temperature hits. This project converts a drum-style popcorn-popper or stovetop roasting rig into a controlled, logged machine — it does not cover building a roaster's heating chamber from scratch, which is a separate and much larger build.
Difficulty and What to Expect
This is an intermediate electronics and fabrication project. You'll need comfort wiring mains-voltage heating elements safely (this is the one part of the build where mistakes are dangerous, not just inconvenient), basic ESP32/Arduino programming, and access to a drum roaster mechanism — either a converted popcorn popper, a kit drum roaster base, or an existing roaster you're retrofitting with better control. Plan on a full weekend: wiring and safety work first, PID tuning and sensor calibration second.
Core Hardware
The build has three jobs: sense bean-mass temperature accurately, control heat output in proportion to that reading (not just on/off), and log the resulting curve. A fast-response thermocouple (Type K, read through a MAX31855 breakout) is the right sensor here, not a thermistor — the lag on a probe that's too slow will make you chase first crack by sound rather than temperature, defeating the point of the build. Heat control runs through a solid-state relay rated well above your element's current draw, driven by the ESP32's PWM output through your PID loop rather than simple on/off bang-bang control, which keeps bean temperature rising on a smooth, repeatable curve instead of oscillating.
| Component | Role | Notes |
|---|---|---|
| ESP32 DevKit | Main controller, WiFi logging | Any ESP32 variant with enough GPIO works |
| MAX31855 + Type K thermocouple | Bean temperature sensing | Probe positioned in the bean mass, not the chamber wall |
| Solid-state relay (25A+) | Heating element switching | Zero-cross SSR reduces electrical noise on the thermocouple reading |
| Separate low-voltage relay or MOSFET | Drum motor control | Keep isolated from the SSR's mains side |
| 120/240V enclosure with fuse | Mains wiring containment | Never leave mains wiring exposed on an open breadboard |
Mains Safety — Read This Before You Wire Anything
A roaster heating element draws real current at mains voltage, and this is not a project to breadboard casually:
- House all mains-voltage wiring (element, SSR hot side, power inlet) in a proper electrical enclosure with strain-relieved cable glands — not open on a bench next to your ESP32's 3.3V logic.
- Fuse the mains input at a rating matched to your element, and use a GFCI-protected outlet or circuit for the whole rig, since you're combining heat and occasional spilled chaff near electronics.
- Keep the low-voltage control side (ESP32, thermocouple amp) galvanically isolated from the mains side — the SSR itself provides this isolation if wired correctly, but double-check with a multimeter before first power-up, not after.
- Coffee chaff is combustible dust. Keep the roaster's exhaust path clear of accumulated chaff and never leave an active roast unattended, controller or no controller.
PID Tuning for a Roast Curve, Not Just a Setpoint
Reflow oven PID tuning (familiar to anyone who's built one for SMD soldering) optimizes for holding a flat setpoint; a coffee roast instead wants a controlled, steadily climbing curve with a flattening "turn" partway through called the rate-of-rise. Rather than one fixed PID setpoint, structure your firmware around a target ramp rate (degrees per minute) that the PID loop chases, with manually adjustable set points for the early drying phase, the Maillard phase, and the development phase after first crack. Start with conservative, slow P and I gains — overshooting in a roaster means scorching beans, not just a slightly off solder joint.
Logging and Alerts
Push live bean temperature, rate-of-rise, and elapsed time to a simple web dashboard served directly from the ESP32 (AsyncWebServer plus a lightweight chart) so you can watch the curve in real time on your phone from across the kitchen. Log each roast to a timestamped file on LittleFS or push it to a home server over WiFi, and set threshold alerts — a push notification or audible buzzer — for your target first-crack temperature range (typically 380-400°F bean temp) and your planned drop temperature, so you're not staring at the dashboard for the entire 10-12 minute roast.