Roasting beans in a repurposed air popper

Lead Image © studiostoks, 123RF.com

Coffee Shop

Transform an old air popcorn popper into a coffee bean roaster controlled by a Raspberry Pi and a slick user interface.

A quest for delicious coffee led me to roasting my own coffee beans at home. Using fresh-roasted coffee beans produces coffee that is considerably better than even the most expensive commercial coffee. The home roasting process only requires two things: heat and a mechanism to keep the beans moving. The beans must be agitated so they are not burned when exposed to the heat. One device commonly used by home roasters is an air popcorn popper, which simply blows hot air into a chamber. The popper is ideal because it roasts the coffee beans and circulates them at the same time.

Coffee starts out as a green bean (Figure 1). Heat is applied over a period of 7 to 15 minutes to produce roasted coffee. The roasted coffee bean can reach temperatures close to 500°F (260°C). If the beans are roasted too fast, however, they can burn, imparting some unsavory flavors to the coffee.

Figure 1: Green coffee beans (top) and beans after they have been roasted (bottom).

The Setup

To get started, I visited a nearby thrift store, which resulted in the purchase of two identical Presto PopLite poppers for a total of $8. I began to use one popper immediately without modification. It roasted the beans in less than five minutes, which is too fast, so I began unplugging the popper for 30-second periods to slow the roasting process. This process grew tiresome quickly, so I extracted the fan and heater assembly from the second popper and added a thermocouple, an AC relay, some LEDs to simulate a flame, and a Raspberry Pi (Rasp Pi) to create the Electric Lights and Fire (ELF) coffee roaster (Figures 2 and 3). The smoke stack on ELF is the roasting chamber, and this is where the coffee beans are placed for roasting. Video of the ELF in action exists on my blog [1], and all the source code is available in a Bitbucket archive (see the "Downloading Source Code" box).

Figure 2: The outside of the ELF coffee roaster has the appearance of an old-fashioned wood stove. Green beans are placed in the smoke stack where they are roasted.
Figure 3: Inside ELF: The top image is the bottom section of ELF with the Rasp Pi and its breakout board, an AC relay, and an AC outlet. The bottom picture is the top of ELF, which has the heater/fan assembly from the popper with a thermocouple.

Downloading Source Code

The source code is kept in a Bitbucket archive, which is a tool to track changes made to all the source files for a project. To download the source, visit the link for the ELF source repository [2]. On the left-hand toolbar is a cloud icon, which, when clicked, will bring up a page where you can download the repository as a ZIP file. After downloading the repository, unzip it and go to the root directory of the unzipped source. From there, follow the directions in the README.md file located in the root directory of the project source to get your ELF up and running.

Measuring the Temperature

As I mentioned, the temperature inside the popper can reach close to 500°F. At these temperatures a thermocouple, which can withstand temperatures up to 2,300°F (1,260°C), is needed to measure the internal temperature. A thermocouple is made by welding two wires made of different kinds of metal together at the end and placing them where the temperature is to be measured. The two metals react differently to changes in temperature, producing a small electrical voltage. The K-type thermocouple chosen for ELF is shown in Figure 4 and was purchased from Adafruit [3]. It is the most common type of thermocouple, which is made from chromel and alumel, two alloys made mostly of nickel. The output voltage increases 2-3mV for every 100°F (38°C) increase in temperature.

Figure 4: K-type thermocouple used in ELF.

To gain access to the underside of the popper, where the heated air originally entered the popping chamber, I disassembled the popper and removed and took apart the heater/fan unit (Figure 5). The thermocouple fit nicely through a hole in the heater assembly (Figure 6), sitting beneath a screen through which heated air discharges. In this position, the thermocouple will not be damaged from the circulating beans or a spoon I sometimes use to stir the beans, and it will measure the air temperature immediately before the heated air enters the roasting chamber, resulting in an accurate reading of the roasting temperature.

Figure 5: Heater/fan assembly removed from the popcorn popper.
Figure 6: Thermocouple installation. (Top) The screen where hot air enters the roasting chamber. (Bottom) The thermocouple installed in the heater/fan unit, over which the screen will sit.

The MAX31855 [4] integrated circuit by Maxim Integrated Products reads the thermocouple voltage, determines the corresponding temperature, and provides the temperature digitally via a serial peripheral interface (SPI) bus. SPI [5] is a method for communicating between a master device, in this case the Rasp Pi, and one or several peripheral devices. Rasp Pi has hardware and software support for SPI communications. Python source code available from Adafruit [6] can be configured to use either hardware or software SPI to interface with the MAX31855. For the ELF unit, I chose to use hardware SPI. The schematic in Figure 7 shows how to connect the MAX31855 to the Rasp Pi (see the "MAX31855 Update" box). By default, the hardware SPI bus is disabled, so read the "Enabling SPI on the Rasp Pi" box for instructions on setting up SPI on your Pi.

Figure 7: Schematic for connecting the Rasp Pi to the MAX31855.

MAX31855 Update

The current version of the MAX31855 breakout board looks slightly different from the one shown in the schematic of Figure 7. As you can see in Figure 8, the pinouts have slightly different labels. Table 1 matches the old pin names with the new ones. Also helpful on the new board are the little triangles below the pins that indicate direction of information/ current.

Table 1

MAX31855 Pin Labels

Old

New

GND

GND

VCC

Vin

SO

DO

CS

CS

SCK

CLK

T-

Red-

T+

Yellow+

Enabling SPI on the Rasp Pi

Whether you enable SPI from the desktop or the command line, you have to reboot for your changes to take place. From the desktop, click Menu | Preferences | Raspberry Pi Configuration. In the resulting dialog box, click the Interfaces tab and the radio button next to SPI. Now click OK and Yes to reboot.

To do the same thing from the command line, open a terminal (if you're in the GUI) and enter sudo raspi-config, select Advanced Options and SPI, then choose Yes to the question Would you like the SPI kernel module to be loaded by default? The new setting should be reflected in the dialog box. Now, choose OK, Finish, and Yes to reboot.

Another option is to edit the /boot/config.txt file manually, which you can read about online [7].

Listing 1 shows the Python code, which uses the MAX31855 Python library provided by Adafruit [6] to create the Python object sensor. The get_temp_f function is called every 0.1 seconds when ELF is running. The sensor object reads the thermocouple temperature from the MAX31855 and puts it in temp. From this information, the heater is turned on if the temperature is below the desired setting and turned off if it is above.

Listing 1

thermo.py

01 # Raspberry Pi hardware SPI configuration.
02 SPI_PORT   = 0
03 SPI_DEVICE = 0
04 sensor = MAX31855.MAX31855(spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE))
05
06
07 def get_temp_f():
08     temp = sensor.readTempC()
09     return c_to_f(temp)
Figure 8: Different versions of the MAX31855. See Table 1 for equivalent pins.

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • GPIO Pinout – Rasp Pi 1 Model B+/Rasp Pi 2 Model B

    40-pin GPIO

  • GPIO Pinout – Rasp Pi 1 Rev1 and Rev2

    26-pin GPIO

  • Power to You

    Small-board computers (SBCs) are getting more and more powerful. The Raspberry Pi 3 (RPi3), which just came out in February of this year, is a case in point. This latest in the Rasp Pi line now has four cores running at 1200MHz with 1GB of RAM and on-board WiFi and Bluetooth. If you need even more power in a small computer, however, you are not left wanting. In this issue, we look at three SBCs with more cores, more memory, more ports, and more possibilities.

  • Cayenne for Raspberry Pi

    New to the whole Internet of Things (IoT) idea? The Cayenne platform provides a friendly gateway to the world of IoT. Built specifically for Raspberry Pi, this IoT platform can help you transform the little machine into a versatile IoT device and put it to some practical uses.

  • Building a Raspberry Pi greenhouse

    A greenhouse environment has to be just right. The temperature can't climb too high or sink too low, and the plants need water. Why not put your Raspberry Pi to work as the gardener?