AI Coffee Roaster: How We Built One from a Raspberry Pi and Two Relays

May 28, 2026

An AI coffee roaster is a drum or fluid-bed roaster modified — or purpose-built — so that a computer controls the heat and airflow in real time, executing a roast profile generated by artificial intelligence rather than adjusted by a human hand. The human loads the green coffee and monitors the process. The machine does the rest.

This is not a product you can buy off a shelf. The commercial machines that come closest — Bellwether, Stronghold — are automated roasters that accept human-designed profiles, not AI-generated ones. A true AI coffee roaster, where the creative and technical decisions about the roast are made by an AI before the coffee ever hits the drum, requires custom hardware and custom software. We built one.

What Makes a Roaster an AI Coffee Roaster

Most people use the phrase loosely to mean any roaster that uses software assistance. By that definition, every Cropster-logged roast qualifies. But there’s a meaningful distinction between software that helps a human roast better and a system where the AI is doing the thinking.

A genuine AI coffee roaster has at least three components: a sensor-equipped roaster that generates real-time data; a control layer that actuates heat and airflow based on digital input; and a model that generates the roast profile from scratch — choosing the target development, the time-temperature curve, the airflow ramp — based on the specific bean, ambient conditions, and target cup profile. The third part is the hard one. That is where the AI actually is.

The Commercial Options

Bellwether Coffee

Bellwether makes an electric, ventless roaster designed for cafés and small-batch roasters. It accepts a roast profile and executes it — heat, airflow, drum speed — without real-time human adjustment. The profiles are created by human roasters on Bellwether’s platform. The machine executes them with high consistency. This is automation, not AI. The creativity and technical judgment come from a human roastmaster; the machine is a precise executor.

Stronghold

Stronghold’s electric roasters have rich sensor arrays — bean temperature, drum temperature, exhaust temperature — and detailed logging. That data can train models and inform profiles. Stronghold doesn’t generate profiles autonomously, but it creates the data environment where AI-assisted roasting becomes possible. The sensors are the foundation; the intelligence is still external.

Artisan + Third-Party Automation

Artisan is the industry-standard roast logging and control software. It can control heat and fan on compatible roasters via serial connection, and it accepts alarm files — sequences of time-triggered events — that function as automated roast profiles. The alarm file is the bridge: an AI generates a curve, a script converts it to Artisan alarm format, and Artisan executes it. This works on any roaster with a supported serial interface. It requires a compatible machine — not all drum roasters have one.

Building an AI Coffee Roaster from Scratch

Our roaster is a drum roaster. It is not USB-capable out of the box — no serial interface, no external control port. Artisan cannot talk to it directly. So we bypassed the machine’s own control board entirely and wired the heat source and fan to solid-state relays controlled by a Raspberry Pi 5.

This is a more invasive approach than a serial-connected build. It is also more flexible. The Pi is the controller for everything: it reads temperatures from four sensors, actuates two relays, and runs a Python control loop that executes the AI-generated roast profile second by second. The roaster’s original control panel still exists. It is no longer in the loop.

The Hardware

Four sensors feed the control loop. Three MAX31856 universal thermocouple amplifier boards read bean mass temperature, drum environment temperature, and exhaust air temperature. A fourth sensor — an SHT31 — reads ambient room temperature and relative humidity before the roast begins. All four connect to the Pi over SPI and I2C. The Pi reads them at 1 Hz throughout the roast.

Two 25-amp solid-state relays sit between the Pi and the roaster’s AC circuits. One interrupts the heating element line. One interrupts the fan circuit. The Pi sends a PWM signal to each — effectively setting a duty cycle for heat output and a discrete level for airflow. The SSRs switch accordingly. No moving parts, no mechanical relays, no arcing.

Total cost of the sensor and relay hardware: under $130. The Raspberry Pi 5 was already on hand.

The Software

The control script — execute_roast.py — reads a JSON roast profile and enters a 1-Hz control loop. Each second: read all four sensors, compare bean mass temperature to the profile curve, adjust the heater relay duty cycle and fan relay level, and log the result. At the end of the roast, when bean mass temperature hits the target drop temperature, the loop terminates.

The Python stack is Adafruit Blinka with the CircuitPython MAX31856 and SHT31 drivers. The Pi 5 uses a new I/O chip (the RP1) that is incompatible with the older RPi.GPIO library — Blinka is required. Everything else is standard library.

The log output — timestamped readings for all four sensors, plus relay state — writes to a JSON file. That file feeds the Artisan profile generator, which produces a downloadable .alog file for each roast. The real temperature data from the actual roast replaces the weather-API fallbacks and hardcoded defaults we used before the sensors were in.

The AI’s Role

The AI doesn’t run during the roast. It runs before it — typically at 4 AM, before the roastmaster arrives.

Given the day’s green coffee (selected from a live supplier catalog by the same AI), the AI generates a complete roast profile: charge temperature, target drop temperature, total roast time, development window, and the full heat and fan curves as time-indexed step arrays. It considers the bean’s origin, processing method, density, and the target cup character. The output is a JSON file.

execute_roast.py reads that file. The roastmaster loads the hopper, confirms the charge temperature, and starts the script. From that point, the roaster runs the AI’s plan.

The roastmaster retains override authority throughout. If something is wrong — a crack that comes early, a temperature anomaly, a sensory signal the sensors can’t read — the roastmaster can intervene. The AI is the plan. The human is the judgment.

What It Actually Produces

Every bag we sell carries a roast profile. The curve is real — it is the profile the AI generated and the roaster executed. The Artisan .alog file is downloadable from the product page. The sensor data behind it — four channels at 1 Hz for the full roast duration — is stored for every batch.

This is what distinguishes our approach from AI-washed marketing copy. The AI generated the profile. The hardware executed it. The data proves it. The bag is the output of that specific computation on that specific morning.

The profile-generation half of this runs as a free tool: our coffee roast profile generator takes your green coffee and your roaster model and returns the same kind of step schedule this machine executes, translated onto whatever you own. No Raspberry Pi required.

Where It Goes Next

The current build gives the AI complete control of heat and airflow execution. The next layer is closed-loop feedback: instead of executing the profile as a fixed plan, the control script will use live sensor data to make second-by-second adjustments — keeping the curve on target even if ambient conditions shift or the bean behaves differently than the profile anticipated.

The data foundation for that is already in place. The sensor logs from every roast feed a growing dataset. As that dataset builds, the profiles the AI generates will become more accurate, and the feedback loop that corrects for deviation will have more signal to work with.

The end state is a roaster that is fully autonomous from profile generation to drop, with a human present to handle the physical machine and catch anything the sensors can’t. That is not a finished product. It is a direction.

System Control Flow

How the roast day works, end to end: the AI generates the profile before the roastmaster arrives, the Pi executes it, sensors feed data back into the loop, and the SSRs actuate heat and airflow in real time.

CONTROL FLOW — ROAST DAY AI MODEL 4 AM · daily generates profile roast_profile.json heat_steps[] fan_steps[] · targets Raspberry Pi 5 execute_roast.py 1 Hz control loop roast_ history .json SENSORS (SPI + I²C) MAX31856 × 3 — BT · ET · Exhaust SHT31 — room temp · humidity read at 1 Hz throughout roast feedback SSR × 2 SSR-1 → Heater SSR-2 → Fan 25A · AC load DRUM ROASTER

Hardware Wiring

The Raspberry Pi 5 is the hub. Three MAX31856 thermocouple boards connect over SPI — one chip-select each. The SHT31 connects over I²C. Two solid-state relays receive GPIO signals from the Pi and switch the roaster’s AC circuits.

HARDWARE WIRING — RASPBERRY Pi 5 Raspberry Pi 5 SPI0 — GPIO 8/7/25 (CS) I²C1 — GPIO 2/3 (SDA/SCL) GPIO → SSR-1 · GPIO → SSR-2 Adafruit Blinka · Python 3 SPI0 MAX31856 Bean Temp (BT) · CE0 K-type thermocouple MAX31856 Drum Temp (ET) · CE1 K-type thermocouple MAX31856 Exhaust Temp · GPIO 25 K-type thermocouple SHT31-D Room Temp · Humidity I²C · addr 0x44 SSR-1 Heater 25A solid-state relay interrupts AC heater line SSR-2 Fan 25A solid-state relay interrupts AC fan line DRUM ROASTER (AC)

For a broader look at how artificial intelligence is changing coffee — from roasting to farming to the cup — see our complete guide: What Is AI Coffee? For a deeper dive into the software and industry platforms behind AI-assisted roasting, read: AI Coffee Roasting: How Machine Learning Is Changing the Roast.