Arduino-controlled DIY Coffee Roaster
In this Instructable we will have a look at modifying a hot-air popcorn machine to turn it into a fully automatic and temperature-controlled home coffee roaster. Roasting coffee at home is surprisingly simple, and even something as basic as a frying pan can do the trick with enough patience and practice. In most basic terms, the roasting process involves heating coffee beans gradually to around or just over 200 degrees Celsius. As they heat up, the beans undergo various chemical reactions and their colour turns from green through yellow(ish) to brown. The beans expand, eventually audibly cracking.
The key to getting the taste of the roasted coffee just right (and doing so repeatably) is two-fold. First, we want to control the temperature during the roast process very precisely, so we can control how much time the beans spend in different temperature zones. This controls which sorts of chemical reactions happen to what extent, and ultimately the flavours in the roasted beans. Second, we want to make sure the beans constantly get mixed and turned, so that the temperature is even throughout.
Hot-air popcorn machines are a perfect solution to issue number two: They blast a batch of popcorn with hot air from below, hard enough to constantly whirl the popcorn kernels around a small container. Since it just so happens that coffee beans are about the same size and weight as popcorn kernels, this also works for roasting coffee. Even an unmodified hot-air popcorn machine can be used to roast coffee reasonably well, but for the perfect roast we also need to address issue number one – fine-grained temperature control. This is what this Instructable is all about: We will modify an off-the-shelf popcorn machine so as to add a temperature probe inside the “roast chamber”, gain precise control of the heating element and fan motor, and interface this with a host computer through and Arduino microcontroller. Once we’re done, we will be able to monitor and control the roast process through an industry-standard open source software called Artisan.
There are already a number of guides available for this, but I found that these are all very specific to one particular model of popcorn machine. I therefore had to piece together information from several sources when I first built my own roaster. So, I wanted to create a guide that I hope can abstract away and work for a wide range of specific setups. At times this will go into a lot of detail – feel free to skip ahead wherever something does not seem relevant to you.
The rest of the guide is structured as follows:
In steps 1 and 2, we will take a look at how a popcorn machine works. First we will look at the main mechanical parts, then we will discuss how fan and heater are connected electrically. We will pay particular attention to the differences between different models, and what you might encounter in your own machine.
In step 3, we will give a high-level overview of the modifications we will make. Again, we will detail the differences in what you will have to do for different types of popcorn machines.
Steps 4-10 will walk you through modifications of the popcorn machine, and then through wiring up the control electronics. In these, we use a particular popcorn machine model for real-world photographs, but we will still include a general discussion where applicable.
Steps 11-13 will detail software configuration, and give you pointers for a successful first roast.
Important safety notice:
In this guide we’ll be dealing with mains electricity, and with significant heating power. If you are not sure about how to follow this guide safely, stop, or ask a qualified electrician for help. Never work on your roaster while it is plugged in, and never leave it unattended while powered on.
The following is a list of parts I used. You might want to read ahead before ordering, as some depend on your exact setup.
- Hot-air popcorn machine, e.g. Severin PC3751 available on Amazon in Europe. Similar models available on eBay or Amazon elsewhere.K
- TC4+ Arduino shield, available on Tindie https://www.tindie.com/products/artisanaltech/tc4-coffee-roaster-shield-tc4-plus/ or website https://coffee.gerstgrasser.net/
- Arduino UNO, available on Arduino website, Amazon, eBay.
- Optionally IIC LCD display, 20×4, widely available on eBay, Amazon.
- Solid State Relay, DC-AC, e.g. Fotek SSR-40DA.
- For DC fan: DC PSU matching fan, e.g. 18V LED power supply, or laptop power brick, available on eBay, Amazon, etc.
- For AC fan: AC PWM dimmer module, e.g. https://www.tindie.com/products/bugrovs2012/pwm-ac-light-dimmer-module-50hz-60hz/
- K-type flexible tip thermocouple, shielded wire, e.g. https://www.ebay.co.uk/itm/K-Type-Temperature-Sensor-Probe-1-5M-Cable-1-3mm-x-100-300mm-Probe-Thermocouple-/382878838907 but many others available on eBay or similar.
- A second K-type thermocouple, plain tip, e.g. https://www.ebay.co.uk/itm/K-Type-Thermocouple-Probe-Sensor-TM-902C-Meter-Temperature-Controller-500-C-UK/292813853636
- High-temperature sticky tape, e.g. Kapton tape.
- Glass chimney matching diameter of popcorn machine roast chamber, e.g. https://www.ebay.co.uk/itm/DUPLEX-Round-Bulge-OIL-LAMP-CHIMNEY-Single-Glass-10-X-2-5-NEW/352484391524 (Make sure diameter fits!)
- Aluminium exhaust duct of same diameter
- Electronics enclosure
- Various electrical wires and cords
- Ring and spade connectors
- Braided wire sleeve
- Soldering iron.
- Wire cutters and strippers.
- Crimp tool for ring/spade connectors.
Step 1: Anatomy of a Hot-air Popcorn Machine: Mechanical
Before we get going, let’s have a look at how a hot-air popcorn machine works internally, and what its main parts are. The following should essentially be the same on all models of hot-air popcorn machines – I have also added a few sketches to abstract away from the specifics of any particular model.
Looking at the assembled popcorn machine, we see something that looks a little like a miniature trashcan: A cylindrical (ish) outer housing with an opening at the top, and a transparent plastic hood. The outer housing is usually two parts, held together with a handful of screws on the sides and at the bottom of the unit. We will keep that outer housing, but the plastic hood will be useless for our purposes.
If we take apart the outer housing, we see a big assembly of metal and plastic parts. From the top, this comprises:
- A cylindrical, metal roast chamber. This has slits or holes near the bottom, for letting in the hot air from below.
- The roast chamber usually sits half-inside another metal part, the heater housing.
- Below this, held together by screws, we have the fan housing. This is often a single assembly together with the fan motor and possible a circuit board below.
If we take apart heater and fan housing, we get to the interesting part:
- Inside we have a heater assembly, comprising heating coils, wires, and a thermostat and thermal fuse.
- Below this, we have a plastic fan, connected to a fan motor.
- Below this, depending on the type of fan motor, we might find a PCB containing some electronics.
- Note that on my model, the fan, fan housing, fan motor, and PCB, all form one assembly that cannot be taken apart without breaking it.
When running, the fan sucks in cold air from below, pushes it through the heater assembly heating it up, and then through the openings in the bottom of the roast chamber, creating a vortex of hot air inside the roast chamber.
Step 2: Anatomy of a Hot-air Popcorn Machine: Electrical
The electrical makeup of a popcorn machine depends largely on the type of fan used. Two kinds of fans are commonly found in popcorn machines: Mains voltage AC fans, and (lower voltage) DC fans. You can tell which type of fan you likely have by looking at the wiring inside your popper: If there are two wires going into the heater assembly, and no circuit board, you likely have an AC fan. If there is a circuit board on the base of the fan motor (or elsewhere) and three wires going into the heater assembly, you likely have a DC fan with a voltage divider circuit.
We will quickly go through both versions. The AC fan version is very simple, so we will discuss it first; but it is also more complicated to control, so if you have the choice, I would opt for a DC fan machine.
Mains voltage AC fan (Picture 1)
In the most commmon AC fan variant, both the fan and heater are mains voltage. They are usually wired in parallel, as if they were both just plugged into a power outlet each. This might mean live and neutral wire going to the fan first, and then continuing onto the heater; or they could be branching once they enter the popcorn machine. The live wire might go via a power switch.
The first attached diagram shows this simple setup: Fan and heater in parallel connected to live and neutral.
In this setup, you would not typically find a PCB under the fan motor. Instead, both fan motor and heater are directly connected to the incoming AC power wires.
DC fan with voltage divider and rectifier (Picture 2 onwards)
The DC fan variant is a little more complex, because a DC fan needs, well, direct current, and usually a lower voltage (18 or 24V) than mains (110 or 230V). So to power such a fan, popcorn machines first create a lower AC voltage, then rectify this lower voltage, making essentially the lower-voltage DC source required.
For the first step, creating a lower AC voltage, the popcorn machine uses the heating element as a voltage divider. A voltage divider essentially uses two appropriately chosen resistances in series to create a lower voltage at the midpoint. For this reason, DC fan popcorn machines often actually have two heating coils inside the heater assembly. The primary heating coil will have the bulk of the mains voltage across it. The secondary coil and the DC fan circuit will be wired parallel with each other, and in series with the primary coil. With the resistances of primary and secondary coils chosen just right, this will leave exactly the right voltage across the DC fan circuit.
To convert the AC voltage to DC, usually a full bridge rectifier is used. This is essentially four diodes arranged so that the positive half-sine of the AC waveform passes through, and the negative half-sine is flipped. The result isn’t quite the same as a constant DC voltage, but close enough. On my machine, there are also inductors and capacitors around the fan motor, which further smooth out the rectified AC wave.
The attached diagrams show these steps one by one: First lower the voltage with a voltage divider, then rectify it, then filter it.
Physically in this setup, you might find that the incoming live wire also first goes to the fan PCB. This is because there is often an AC filtering capacitor between AC live and neutral wires. From the PCB, three wires connect to the heater assembly, one for the midpoint between both coils, and one each for the other end of each heating coil. Due to the AC filtering capacitor, the neutral wire on my machine is the middle wire on the PCB, and the mid-point wire on the corner of the PCB. The final diagram attached shows this setup. The live wire might go via a power switch, and if the switch is illuminated, a neutral wire might branch off from the PCB to the switch too.
On the PCB, you can make out the different parts of this setup. On my unit, one can see capacitors and inductors placed around the motor for filtering electrical noise. In the middle of the PCB, four diodes (black cylindrical components) make up the bridge rectifier. On the far end of the board, you can see the wiring: Live on the left side, neutral in the middle, and the mid-point between the primary and secondary heating coils on the right. You can also see a capacitor between AC live and neutral, for additional filtering of electrical noise. Take a look at the PCB if your roaster has one, as we will modify it later to directly connect to the DC motor.
The attached photograph shows the wires on the PCB in my roaster, and a diagram shows the layout of the PCB with wires & AC filter capacitor, bridge rectifier, and DC filter circuit.
Later on, we will want to know the voltage of the DC fan. There are a couple of ways of figuring this out. One, you could measure to voltage directly with a multimeter, when the popcorn machine is turned on. Personally, I don’t like messing with live mains electricity though when I don’t have to, so I did not opt for this. Instead, I measured the resistance of the motor and both heating coils – this you can do with a multimeter even when the machine is turned off. I got about 42 Ohms for the primary heating coil, and about 3.5 Ohms for the secondary coil and fan motor in parallel (or about 7 Ohms each), which works out to 18V across the motor. I could also just about make out a marking on the body of the fan motor reading “RS-385SA-2065”. Searching for this online only finds a 2065R-variant, but that one is listed as 18V nominal, which fits the measurement.
AC fan with voltage divider: I have also read a forum post once about a popcorn machine that used a lower-voltage AC fan, and thus has a voltage divider but no bridge rectifier. I don’t think this variant is common, however.
Some machines will also have an earth wire (green and yellow) connected to all the metal parts (roast chamber and heater housing, in mine). This is an important safety feature – make sure you reconnect or leave connected the earth wire when modifying the machine.
Read more: Arduino-controlled DIY Coffee Roaster