Electric Lights and Fire (ELF) Raspberry Pi Coffee Roaster

Here is a video of the ELF roaster in action:

I stumbled upon a video of someone using a popcorn popper to roast coffee. It seemed simple and a used popper can be acquired cheaply at a thrift store. This was the start of ELF, a roaster designed to produce the world's best cup of coffee.

My first visit to my local Goodwill produced two Poplite Poppers for the whopping total of $8. I immediately started to use one and experienced beans blowing out of the popper. An extended chimney, made from 3” ductwork from the local hardware store, resolved that issue.

First Roaster

The first batch roasted in under 5 minutes. To slow down the roast I began unplugging the unit for 30 second intervals during the roast. This allowed me to extend the roast to 7-8 minutes.

Tired of unplugging the popper I decided to retrofit the second popper with a thermocouple, ac relay, a raspberry pi, and some web code and the Electric Lights and Fire (ELF) roaster was born.

EFL LED flame
ELF with web controller

The major components, along with a schematic, of ELF are described below. A parts list is also provided at the end of the article.


This thermocouple from SainSmart is ideal as the small probe end allows it to be installed directly underneath the screen where the heated air is blown. The MAX31855 breakout board is also needed as it reads the thermocouple temperature and provides it to the Raspberry PI via a SPI interface.

To install the thermocouple:
First, remove the fan/heater module from the popper by removing the bottom, top, and the wiring nuts. Next unscrew the four screws holding the fan/heater module together. This will allow access to the area underneath the screen. Insert the thermocouple through the hole as shown in the diagram and reassemble the fan/heater module.

Thermocouple threaded through hole below heater screen
Thermocouple wire (gold colored) routed along side ac power wires

 AC Relay

This AC relay works well for cycling the power to the heater on and off. I initially connected a GPIO pin from the Raspberry Pi to the relay. This failed as the GPIO pin does not provide enough current to activate the relay. I discovered, however, that the 5V power from the Raspberry Pi would activate the relay. Thus, I used an NPN transistor connected to a GPIO pin that, when set high, will apply the 5V power from the Raspberry Pi to the relay which powers the Poplite heater.

Temperature Control

A python process is started on powerup that controls the roaster. It reads configuration values from a file to get the desired temperature and attempts to achieve the desired temperature once the roaster is activated though the web page controls. It applies the temperature setting every second. Within that second it will read the thermocouple temperature every 10 milliseconds. If the temperature is above the set value the heater is turned off. Conversely, the heater is turned on if the temperature is below the set value. This process also logs all relevant data to a comma separated file that can be exported to Excel.

Flickering Flame

The flickering flame on the front is produced using four LED’s: two yellow and two red. Each LED is connected its own GPIO pin on the Raspberry Pi with a 330 Ohm resistor to limit the current. The intensity of the LED is controlled using pulse-width-modulation (PWM). A PWM cycle frequency of 22 Hz was chosen as it produces a nice flickering effect. A higher value reduces the flickering and a lower value makes the flickering too slow. When the heater is turned on a random value is chosen for the red and yellow LEDs. This makes it appear more like a fire with occasional flare ups.

User Interface

The UI was developed using django, a framework for developing web pages using python.  The UI is made up of mostly images. The old-style LED numbers are image files with an image file for each digit. The temperature gauge was made by rotating the dial image on the gauge background in 5 degree increments and saving a file for each increment. The gauge can show temperatures between 140 and 550 in 5 degree increments requiring 82 image files for the temperature gauge. All the images must be loaded by the browser before the UI can be used to control the roaster. This takes between 30 and 60 seconds. This allows the browser to run smoothly with no delay which could be caused by waiting for an image to download.

If you would like a copy of the code please send me an e-mail.

Inside of ELF

ELF Bottom
Raspbery Pi breakout and AC relay


Parts List Here

ELF was featured in issue #46 of "Mag Pi" magazine (page 38).
ELF was also featured in issue #18 of "Raspberry Geek" magazine.