← Projects
electronics intermediate 15 days ago ◑ 28 views ◯ 4 min read

Build an ESP32-Controlled Coffee Roaster: Drum Drive, PID Temperature Profiling, and Roast Curve Logging

Build time: A full weekend (wiring and mains safety work first day, PID tuning and calibration second day)
Tools needed: Soldering iron, multimeter, drum roaster base or popcorn-popper conversion mechanism, electrical enclosure fabrication tools, basic Arduino/ESP-IDF programming environment
esp32coffee roastingpid controlthermocouplehome roastingiot
Parts List

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.

ComponentRoleNotes
ESP32 DevKitMain controller, WiFi loggingAny ESP32 variant with enough GPIO works
MAX31855 + Type K thermocoupleBean temperature sensingProbe positioned in the bean mass, not the chamber wall
Solid-state relay (25A+)Heating element switchingZero-cross SSR reduces electrical noise on the thermocouple reading
Separate low-voltage relay or MOSFETDrum motor controlKeep isolated from the SSR's mains side
120/240V enclosure with fuseMains wiring containmentNever 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:

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.