Arduino-controlled DIY Coffee Roaster

24,294

119

41

Introduction: 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.

Supplies

The following is a list of parts I used. You might want to read ahead before ordering, as some depend on your exact setup.

Tools:

  • Soldering iron.
  • Wire cutters and strippers.
  • Crimp tool for ring/spade connectors.
  • Drill.

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.

Earth

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.

Step 3: Modifying the Popcorn Machine: Overview

Now that we understand how the popcorn machine works out of the box, let's have a look at the changes we'll make. For my setup, I have opted to keep the original housing of the popcorn machine, and add a separate enclosure for the control electronics. That means that inside the popcorn machine, I only rewired the fan and heater so that they are powered separately and routed those wires outside the machine. I also added two temperature probes (K-type thermocouples), one to measure the temperature of the incoming hot air and one to measure the temperature inside the roast chamber.

For the controller, I used an Arduino Uno and a TC4+ shield, which is made specifically for coffee roasting and has all the necessary electronics. In addition, we need a solid state relay (SSR) for heater control, and either a DC power supply for a DC fan, or an AC PWM dimmer board for an AC fan. Our goal is not only to be able to switch heater and fan on and off independently, but to gain fine-grained control of their heater output and fan speed.

In the following, we will go through the modifications one by one: Heater control, fan control (DC or AC), thermocouples. The attached diagrams show the wiring for each of these individually, and a complete wiring setup with a DC fan.

Controlling a heating element

For the heating element, this is very easy. Because the heating coil doesn't change temperature instantly when switched on or off, we can get away with simply switching it on and off relatively slowly, usually once per second. If we wanted, say, 70% heater output, we would switch the heating element on for 0.7 seconds, and then switch it off of 0.3 seconds. To do this, we can use a solid state relay (SSR), which is essentially an electronically controlled switch. We simply connect the AC-side of the SSR in series with the heating element, on the live side. The DC (control) side of the SSR connects to one of the SSR drivers (OT1) on the TC4+ shield.

My popcorn machine has a voltage divider with primary and secondary heating coils, so I used only the primary heating coil. This puts the coil at 230V mains voltage, instead of the roughly 212V it was before. On the bright side, that means slightly higher heating power (ca 1240W) than the original setup (ca 1100W), on the other hand also a higher risk of overheating. Depending on the specs of each heating element in your setup and the magnitude of the resulting increase in peak heating power, you might want to avoid running the heater at 100\% power to be safe. It is also imperative that the thermal fuse remain in place.

Controlling a DC fan

Controlling a DC fan is also easy, and works in a similar manner to the heating element: We simply turn power on and off, except for a motor we need to do so much more frequently, hundreds or thousands of times per second for smooth running. This is called pulse-width modulation, and is luckily something that microcontrollers excel at. The TC4+ has the electronics for this on board, so we only have to connect the DC fan and the DC power supply to the respective terminals on the TC4+. Internally, the electronics work much in the same way as before: The TC4+ has a MOSFET (the DC version of a SSR) in series with the fan motor.

You will have to place a flyback diode across the motor terminals, to protect the DC driver from overvoltage generated by the motor when slowing down. This is simply a diode across the motor terminals, opposite to the usual direction of current flow. You can reuse one of the diodes from the bridge rectifier for this.

You will need a DC power supply that matches the DC fan's voltage (slightly higher might be fine). The rated current of the power supply should exceed the fan motor current. I would aim for at least twice the rated power. When a DC motor is turned on, the current draw (``inrush current'') is momentarily much higher than the steady state current - bear this in mind. If you find that the power supply resets if you turn the fan on, you can try increasing the fan duty in several steps to limit the inrush current.

If the popcorn machine PCB has inductors and/or capacitors in series or in parallel with the fan motor, keep them. They are for filtering out electrical noise generated by the motor brushes.

Controlling an AC fan

With an AC fan motor, things are a little more complex. Due to the way AC works, we cannot simply switch power on and off hundreds of times per second. Instead, we need to do what an old-school dimmer switch does, and turn on power part-way through each half-sine wave of the AC waveform. The easiest way to do this is to use an AC PWM dimmer board, which does all the timing required for this internally. To the TC4+ and Arduino, this will look the same as a DC fan, making the software side easy. There are several such boards available on Tindie, for instance this model: https://www.tindie.com/products/bugrovs2012/pwm-ac-light-dimmer-module-50hz-60hz

If you get a different AC PWM dimmer board, make sure it is one that only needs a PWM input and does the timing internally. If the board has a zero-cross output, it likely requires the Arduino doing the timing, making things more complex.

A small side note: You might not strictly need fine-grained fan control. On some setups, it is necessary to start with a high fan speed and then gradually lower it toward the end of the roast. This is because the raw beans are relatively heavy, so stronger airflow is required to move them; On the other hand, once the beans get lighter toward the end of the roast, a lower fan speed allows for a higher peak temperature. But, this isn't always necessary. On my roaster, I am able to keep the fan speed constant. So you could try simply connecting the fan to another SSR, or even a physical switch, in the first instance, and see how that goes. For a DC fan, you get fine-grained control ``for free'' with the TC4+ board, since this already has a DC PWM driver on board; But with an AC fan you could try to see if you can get away without the extra AC PWM dimmer board.

Thermocouple temperature probes

We will add two thermocouple probes to measure the temperature of the coffee beans and that of the incoming hot air. These will connect directly to the thermocouple interface on the TC4+ board.

Step 4: Modifying the Popcorn Machine: Disassembly and Thermocouples

With all the theory out of the way, let's get down to business. We'll start with modifying the internals of the popcorn machine, and then we'll go through wiring up the TC4+ and Arduino.

Disassembly

First, start by taking apart the outer housing of the popcorn machine. You will likely have to remove a lid at the bottom of the unit. The outer housing is usually two parts held together by several screws. On my machine, these were at the bottom of the unit, below the ``chin'' at the front of the machine, and one at the back of the unit. The screw at the back was a security screw on mine, but easily removed with some needle-nose pliers. I replace it with a standard M4 bolt on reassembly.

Bean temperature probe

First, we will place a thermocouple probe inside the roast chamber. This is easiest with a "flexible tip" thermocouple probe (widely available on eBay). I used one with 2mm tip diameter K-type thermocouple probe, and I would recommend getting one with a shielded wire. To place the probe, drill a hole with matching diameter into the side of the roast chamber. Place it about 10-15mm above the level where the heater housing meets the roast chamber: You want the tip of the probe not too close to the incoming hot air (so you measure more of the bean temperature and less of the air temperature), but still well within the mass of beans. If unsure, measure about 100g of coffee beans and put them inside the roast chamber. Drill the hole a little below the top of the beans.

Then, stick about 10mm or so of the thermocouple tip through the hole. I then fixed the body of the probe to the outside of the heater housing using high-temperature sticky tape ("Kapton tape").

The exact location of the probe is not too important, as long as it is inside the coffee beans. But, you want to fix it in place tightly, so that it always measures the exact same spot. This makes measurements comparable across roasts. If the probe moves even slightly, the temperature measurements might change, and you might have to dial in your roast settings again.

Air temperature probe

Next, we do the same for a thermocouple measuring the temperature of the incoming hot air. This is not strictly required, but useful to have. For this, I used a simple, unshielded, bare K-type thermocouple, like the ones that often come with multimeters. I drilled a hole into the top of the heater housing, and stuck the thermocouple probe about 10mm deep into this, putting it close to the openings in the bottom of the roast chamber. I then taped it in place with Kapton tape.

Step 5: Modifying the Popcorn Machine: Heating Element

For the heating element, we want to route the wires connecting to the (primary) heating coil directly outside the popcorn machine. If you have a voltage divider with two heating coils, we first need to find the correct two wires. You can figure this out by looking at the PCB: The main coil is the one connected in series with everything else, usually with one wire at AC live. The secondary coil is connected in parallel with the bridge rectifier and DC motor. On my PCB, the AC live wire is on the left edge of the board, and the mid-point wire is on the right edge of the board, with the neutral wire in between. This may be different on your PCB, so check that you can see the traces on the board matching the diagram shown in Step 2.

If you can't figure it out from the PCB, you could cut all three wires at the PCB, and measure the resistance between each pair with multimeter. The primary heating element will have a relatively large resistance; the secondary a much smaller; and both together the sum of both. For instance, if you get 42 Ohm, 7 Ohm and 49 Ohm, then the first pair of wires is the primary coil, the second the secondary, and the third both in series. In this case, you want to take the two wires with 42 Ohm between them.

If you still cannot figure it out, take apart the heater and fan housing, and take out the heater assembly. You should be able to see how each wire is connected to which coil. The larger coil should usually be the primary, and might be connected to the wires through the thermal fuse and/or thermostat. The secondary coil is of a smaller diameter, and only easily seen from the side.

It can't hurt to check out the heater assembly anyway, to make sure a thermal fuse (and possibly a thermostat) is connected in series with the primary heating coil. I strongly advise leaving this thermal fuse in place. I have seen some guides online that claim they had to bypass the thermal fuse and thermostat, as otherwise the popcorn machine supposedly did not get hot enough. That is a bad idea, as the thermal fuse is the number one protection against overheating and starting a fire. Furthermore, I have not had a problem getting hot enough with my popcorn machine, so at least some models have no problem getting hot enough at stock. If your machine can't get hot enough, try a different model rather than perform unsafe modifications. You can also try reducing fan speed toward the end of the roast to get a little extra temperature inside the roast chamber. It is also quite difficult to modify the heater assembly anyway - for obvious reasons you cannot use solder here, and I have not found a way to crimp those eyelet connectors. I have managed to burn out my thermal fuse on my roaster a couple of times in the past, when I accidentally turned on the heater but not the fan. In those instances, I bought a new popcorn machine to replace the entire heater assembly, because I could not figure out how to replace the thermal fuse safely.

Once you have found the correct two wires, and made sure your setup is safe, you have to connect them to a new power cord. I crimped tab connectors onto the wires coming from the heating coil, but other connectors can work. Screw terminal blocks are less safe, as the wires can slip out more easily. If you have two coils, there is now a third wire left dangling free, so make sure you insulate the end. I then used a piece of a mains power cord (three wires inside a PVC insulation) to route the AC power outside. Make this about 40-50cm long at least (see below). You could also use individual wires for this, but with mains AC I prefer extra insulation. I crimped matching connectors onto the end of each wire, and connected live and neutral to the heater wires.

Step 6: Modifying the Popcorn Machine: Fan Motor

DC fan

For my DC fan motor, I modified the PCB to connect this to the TC4+. Essentially, you want to remove the wires, AC capacitor, and bridge rectifier from the PCB, and connect new wires where the output of the bridge rectifier was. This way, we keep the inductors and capacitors around the fan motor, which are useful for filtering out noise. If you remove the PCB entirely and solder wires directly onto the motor terminals, you might have problems with electrical noise making its way down to the TC4+ and messing with your thermocouple readings (or worse).

To remove the wires, simply cut them. To remove the rectifier diodes and AC capacitor, heat the solder on the bottom of the PCB with a soldering iron, while carefully pulling on the component with tweezers. Once you have removed them, you can solder new wires in place of the bridge rectifier. Make sure you identify the correct solder pads. There should be traces going from them toward the fan motor (possibly with inductors in between). If the wires are too thick to push through the holes in the PCB, you can either (i) carefully cut some of the conductors, if it is stranded wires, until the remaining ones fit through, or (ii) very carefully widen the holes with a drill, or (iii) solder the wires onto the solder pads rather than through the holes.

Lastly, we have to put a flyback diode across the motor. I simply reused one of the diodes from the bridge rectifier. I then found two solder pads on the PCB that were connected to each terminal of the motor, and the correct distance apart. Then, I soldered the diode onto the PCB. To do this, I pressed one leg of the diode against the solder blob, and heated both with a soldering iron. Make sure you get the polarity correct: The flyback diode goes against the usual flow of current.

I again only put short pieces of wire here, and then crimped tab connectors onto them. Then, I used two longer wires with matching crimp connectors to route these connections outside. This way, I can disconnect all the power wiring from the popcorn machine, if I want to work on only a part of the setup. (Sadly the same is not easily possible with the thermocouple wires, as those are special wires. Don't try to cut and extend those unless you know what you are doing.) Make the longer wires about 40-50cm long at least (see below).

AC fan

For an AC fan, proceed as with the heating element: Tab connectors on each wire, and a power cord to route outside.

Step 7: Modifying the Popcorn Machine: Earthing and Reassembly

Earth

Before we finish up, make sure all the metal parts are still earthed. I again crimped a tab connector on the original earth wire, and connected this to the earth wire from the AC power cord I used for the heater power wires.

Reassembly

That is all for the popcorn machine! Pull all the wires through the opening in the bottom outer housing. You might have to widen the hole that held the original power cord. Then, put the outer housing back together. On my machine, it was tricky to align the screw holes in the bottom part with the threads on the fan assembly, but with a bit of wiggling everything eventually fell in place. Secure everything by putting all screws back where they were. You should now have several wires and cables coming out of the popcorn machine: Two AC wires for the heater, two AC or DC wires for the fan motor, one earth wire, and two thermocouple cables.

In my setup, I have the popcorn machine and the box with the control electronics separate, and connected with about 50cm of wiring. This way, I can lift off the popcorn machine only, which makes it easy to pour out the roasted beans at the end. I have seen others screw the popcorn machine directly onto their control enclosure, saving on wiring, but then you'd have to lift the whole thing to get your beans out, and you have to be extra careful to secure all your electronics in place. If you want to keep the popcorn machine separate from the electronics, use at least about 40-50cm of wiring. I used a braided wire sleeve to get all the wires together - the resulting "cable" is quite thick, but keeps everything tidy.

Step 8: Wiring Up the Control Electronics: Enclosure, Display, Routing Wires

You will want some sort of enclosure for all your electronics. I used a plastic box from IKEA that I had lying around, but there is plenty of enclosures specifically for electronics projects too. Mine is on the small side for everything that goes inside, but fits perfectly on my windowsill, which is where I keep the roaster. You will want to drill one hole for a mains AC power cord, and one big hole for the wiring going to the popcorn machine. Get an AC power cord ready, and all the wiring coming from the popcorn machine.

If you want a display, you can also cut out a space for this. Tip: Cut out a rough shape, and then mask it. I used some white silicone bathroom sealant I had about, but silicone epoxy should work too, for instance. For straight edges, mask the area outside with tape, then put the sealant or epoxy, and then remove the tape before it sets.

Inside the box, I used a perforated metal plate to secure all components, and to provide earthing. This way, a loose live connector is likely to touch earth and trigger the RCD. (This obviously only applies if you have a RCD / GFCI - check with a local qualified electrician if you are unsure about any of this!)

Get all your components ready: Stack the TC4+ onto the Arduino, and get your SSR, DC PSU or AC PWM dimmer module, and plenty of wires and connectors.

The attached pictures show my final enclosure, and all the control components.

Step 9: Wiring Up the Control Electronics: Step by Step

When everything is inside my slightly-too-small enclosure, it gets a bit messy, so I wired things up outside the enclosure for nicer pictures. You might want to do this inside your enclosure. If you do it outside the enclosure, make sure you already route all the incoming wires through the holes you drilled in the enclosure!

We will now wire everything up step by step. The attached pictures show each step with annotations, and a close-up of all the connections on the fully wired-up TC4+.

First, connect earth from the mains power cord to the metal plate, DC PSU, and the earth wire from the popcorn machine. For the connection to the metal plate and to the DC PSU I used crimped ring connectors, for the one to the popcorn machine again a crimped tab connector.

Next, connect live and neutral from the AC power. Since these need to go to both the DC PSU and the heater, I made a Y-splitter by crimping to wires onto a tab connector. One set of live and neutral I then connected to the DC PSU, again using ring connectors. The other neutral connector goes straight to the neutral wire from the popcorn machine. The remaing live connector goes to one of the AC terminals of the solid state relay. The other SSR AC terminal connects to the live wire from the popcorn machine.

Next up, DC power: Connect V+ and V- on the DC PSU to VIN and GND on the TC4+. For the DC fan, connect the positive and negative fan wires coming from the popcorn machien to DC+ and DC- on the TC4+. (Skip this step and read below if you have an AC fan.)

Then, the SSR control: Connect the DC (control) side of the SSR to the TC4+. OT1+ goes to the positive SSR terminal, OT1- to the negative terminal. Again you can use ring connectors on the SSR side of the wires. On the TC4+, you can just use bare wires in the screw terminal.

Lastly, connect the thermocouples to the TC4+. By custom, the bean temperature often goes to channel 2 on the TC4+ (the leftmost two pins on the 8-pin screw terminal), and air temperature to channel 1 (the next two pins). Each thermocouple has two leads, and it can sometimes be difficult to tell which is which. If you can't see any markings on the wires, simply try one way. Then, once you have everything up and running, try if everything works as expected. Turn on the fan and heater and see what the temperature reading does: If it goes up, you got the polarity right. If it goes down, you have the two wires reversed.

If you have a display, connect this to the TC4+ too. In my setup I use a Bluetooth module with the TC4+, if you want to use this, follow the instructions on the TC4+ website. If not, connect a USB cable to the Arduino too.

Then, secure everything inside your enclosure, and close the lid. We're almost done now!

If you have an AC fan, skip the DC power step. Instead, connect the control side of the AC PWM dimmer board to the IO3 header on the TC4+; connect an incoming live and neutral wire to the AC IN terminal of the dimmer board; and connect the AC fan wires to the AC OUT terminal of the dimmer board. In this setup, you could power the Arduino through USB, either connecting it directly to your computer, or using a USB power supply if you're using Bluetooth.

Step 10: Modifying the Popcorn Machine: Chimney

Only one thing is missing now, which is a chimney. This is to keep the coffee beans inside the roaster, and to let chaff and smoke go out the window. I found a glass chimney on eBay that was meant for old oil lamps, and which had roughly the same outer diameter as the opening in my popcorn machine. I then got a piece of high-temperature aluminium exhaust duct, again with the same diameter. I used several layers of Kapton tape to make the glass chimney fit the roast chamber snugly, and also to attach the exhaust duct to the top of glass chimney. When roasting, I put the exhaust duct out my kitchen window, but obviously be considerate of your neighbours with that.

Step 11: Software: Arduino Sketch

That's it for the hardware. For software, there is two things left to do, flash the Arduino firmware, and download and configure Artisan.

On the Arduino side, unless you ordered a pre-flashed Arduino, you will have to flash a firmware onto it.

You can use one of two (related) Arduino sketches for this: aArtisan or aArtisanQ_PID. The former is simpler, the latter has a few more features. Which you use is up to you. Download the Arduino IDE ( https://www.arduino.cc/en/Main/Software ) and install it. Then, download the aArtisan or aArtisanQ_PID sketch (https://github.com/greencardigan/TC4-shield/tree/master/applications/Artisan/aArtisan/trunk/src/aArtisan or https://github.com/greencardigan/TC4-shield/tree/master/applications/Artisan/aArtisan_PID/trunk/src/aArtisanQ_PID) and required Arduino libraries (https://github.com/greencardigan/TC4-shield/tree/master/applications/libraries/trunk/libraries). Copy the libraries to your Arduino library folder (usually Documents/Arduino/libraries), and open the aArtisan sketch in the Arduino IDE. Select the user.h tab on top, and check through the options. If you're using aArtisanQ_PID, you want to select CONFIG_PWM. Other parameters you might want to edit are IIC LCD display address, for instance. Most of the other options you canleave them as they are unless you have a reason to change them. Flash the sketch onto the Arduino.

Step 12: Software: Artisan Roaster Scope

On your host computer, download Artisan ( https://artisan-scope.org/ ) and install it. The configuration is the same as for the TC4 board, and there are already a few very good guides on setting up Artisan to work with this. For instance, check out this youtube video: https://www.youtube.com/watch?v=0-Co-pXF2NM

The two base things to configure are:

  • In Config -> Device and Port: Configure the TC4 device, and choose the correct serial port.
  • In Config -> Events: Configure buttons and sliders to set heater and fan levels. You must configure serial commands for each of those: OT1 sets heater level, IO3 sets fan speed. For buttons, you can write "OT1,100" to set the heater level or "IO3,50" to set fan speed. For sliders you can write "IO3,{}" to control the fan speed, and "OT1,{}" for heater level. See the attached screenshot for a basic setup.
  • In Config -> Events: By default Artisan has a device setup that is more geared toward drum roasters than hot-air fluidbed roasters. You might want to reduce the controllable "event types" to only a heater and a fan.

The attached screenshots show those configuration options. There are many more features in Artisan, but for the beginning this basic setup should get you going.

Once you click "On", Artisan will connect to your roaster and display current temperature readings. Click "Start" to start recording temperature. Use the buttons and sliders to control fan and heater level. Make sure to turn on the fan before the heater, or you will burn out your heater in seconds!

Step 13: Done! Let's Roast Some Coffee.

That's it! You now have a fully controllable coffee roaster at your disposal. To get started roasting, use about 100g of green beans (this might vary depending on your exact setup). Start by getting the bean temperature up to about 100C, and then increase from there. You want to hit just over 200C after about 15 minutes, and you want the temperature increase to slow down over the course of the roast. If you listen closely, you might be able to hear the beans cracking when you approach 200C. If you want a light roast, you can stop thereabouts, otherwise continue slightly longer. Once you want to finish the roast, turn off the heater, but keep the fan on full speed, to cool the beans down. Remove them from the roaster once they're approaching room temperature. The attached screenshot from Artisan shows how a typical roast might look like, with bean temperature in blue.

For more information on home roasting, check out these websites:

If you want to delve deeper into Artisan and automation, have a look at PID control, for instance here:

Another extra project can be to add Bluetooth connectivity. Follow the guide on the TC4+ website for this:

And in any case, enjoy your freshly roasted coffee! Thank you for reading my Instructable.

Arduino Contest 2019

Second Prize in the
Arduino Contest 2019

3 People Made This Project!

Recommendations

  • Home Decor Challenge

    Home Decor Challenge
  • Explore Science Challenge

    Explore Science Challenge
  • Arduino Contest

    Arduino Contest

41 Comments

0
Thoskje
Thoskje

4 months ago

Hi. Thanks you for the information! It really helped me understand this system better. I would want to try it in the feature. But first i would like to try a simpler modification where I only want to be able to switch of the heating element to delay the roast time using the original switch. And my thought was that the fan motor starts immediately when i plug it in.
I tried once with no good result. I was able to switch on the heating element with the switch, but i could not get the fan motor to run.

Do you have an idea on how i would be able to do that by only re-wiring?

I will post pictures of what i did, and maybe you can see what i did wrong.

Thanks alot!

BCF8DA58-FB02-41EF-AD21-6427E0D18892.jpegD4C5CF37-49A9-44F0-BDF0-FF0ECF7B7F98.jpeg
0
art_tech
art_tech

Reply 4 months ago

In order to do that you would have to provide DC power to the fan. I'm not 100% sure from your photos what you did, but I don't think there's any way to switch the heater without getting a separate DC PSU for the fan, as the heater and fan are usually wired in series. You can still more or less follow this guide, just skip the TC4+, so to speak. Wire then fan motor directly to a DC PSU, and the main heating element to AC mains via a switch (which I think you've done already). All that said, if this is not something you 100% understand, please get professional help.

0
jamiejones13675
jamiejones13675

5 months ago

Having just modded my Severin according to the instructables article, all is working apart from I am struggling to reach higher temperatures when the fan is above about 50%.
https://www.instructables.com/Arduino-controlled-DIY-Coffee-Roaster/

This is problematic as I really would like the fan on high to keep the beans moving, but am having to turn it down and then stir manually to get over about 120 degrees C and towards first crack.
Just wondering if this is to be expected with the modded popper or if I may have done something wrong in the build.

A bit more info for reference (measured with DMM):
18V PWM going to the fan
230V going to the primary heating coil (42 Ohm) controlled by the SSR
An image of my first roast profile as well here as well - https://imgur.com/m5t2PJN
Naturally this went longer than I would have liked but was cut off at about 15 mins. You can see though that I had to keep stepping down the fan in order to push the heat up whilst the heat was set to 100.

Thanks in advance

0
art_tech
art_tech

Reply 5 months ago

No, that shouldn't happen. How much coffee are you roasting in one batch? Did the popper get hot enough pre-modification (if you tried that)?

0
jamiejones13675
jamiejones13675

Reply 5 months ago

Hey art_tech,

Thanks again for the reply and fantastic instructable by the way.

I was using 70g on this occasion (I started with 100g and the fan on full but quickly emptied out some of the beans when I saw the temp stalled at about 120 degrees C. From here you will see from the profile I had to continue stepping down the fan in order to drive the BT north.

Before modding it easily blew through to first crack in about 4-5 mins so I think the popper as a baseline was good.

I've checked voltage to the fan is reading about 234V and the resistance of the coil I've wired up is just shy of 42Ohm. Haven't measured the current with heat on full but will double check this as well.

Just wondering what sort of fan/power levels are expected by others who have done these mods? i.e. some sort of reference to check if I am in the right ballpark with my build.

I should also add that I am roasting indoors at room temp as well not outside!

Thanks, Jamie

0
art_tech
art_tech

Reply 5 months ago

I mean in principle if you have the fan and heater on at 100% constant, then it should perform more or less as it did unmodified. The only difference is that you're bypassing the secondary heating coil, and possibly a different fan voltage. Did you measure the resistance of the secondary coil, and/or the stock fan voltage? If for some reason on your popper the fan was at a lower voltage originally then you might inadvertently have created much higher airflow.

You could also try wiring the modified popper up without the TC4+ just to rule out any issues with that or Artisan. Just connect the fan motor directly to the DC PSU and the primary heating coil directly to AC.

0
jamiejones13675
jamiejones13675

Reply 5 months ago

Measure the current at 2.42A but realised my DMM only measures DC current so not sure how/if to interpret this.

Yeah the coil measures 42Ohm as per the guide so that seems OK.

I never took any measurements of the fan beforehand.

I can try to bypass the TC4 as a last resort, but just to check on your popper do you achieve a strong ROR on full fan? ie you have enough headroom to control the roast by varying the heater power?

I should mention that I haven't added a chimney so feel like I'm losing a huge amount of heat through the top.

0
art_tech
art_tech

Reply 5 months ago

It could be that the secondary coil has a different resistance though, which would result in a different fan voltage. Basically, make sure you're driving the fan at the right voltage.

Not having a chimney could also be at least part of the issue. I've found that can make a huge difference. I only have first-hand experience the opposite way (restricted outflow resulting in burnt coffee), but I suppose that not having one at all could lead to too much heat loss. Worth trying to add one I think. Don't you have beans flying all over the place anyway without one toward the end of the roast?

In your roast profile, is blue really BT and red ET? ET seems very low. BT actually doesn't look too unreasonable. Bear in mind that thermocouple placement can shift your readouts a few degrees up or down as well. How did the coffee turn out in that roast?


0
aichilang
aichilang

6 months ago

Thank you for sharing your build. I did order the TC4+ and will try build up roaster. Do you have any ideas using the infrared temperature sensor to measure coffee beans in this project?

0
jensbenz
jensbenz

Question 7 months ago

Hi art_tech

Once again thanks a lot for your great instructable. I have now finished making a replica. I use a severin popper and my only modification is that I have used a 19V laptop PSU instead of the PSU in your instructable.
So far, my temperature probes work, but I have not been able to turn on the fan or the heater (have only tried to turn on both for 2 secs or so). I am a bit unsure, what my problem could be. The only thing I can think of, is that when I installed the aArtisan ino on the Arduino the first time, it got stuck downloading without me knowing it, and I connected the popper to the electricity without a working Arduino. Can that harm anything? I see that there's only one red light on my tc4+, could it have anything to do with that?
I have double checked the wiring and the modification of the popper itself, but I cannot seem to find the error.

I would be super thankful if you have any ideas of what could be the matter.

In advance, thank you very much:)

Best,
Jens

IMG_3124.JPG
0
samjameshardy
samjameshardy

Question 8 months ago

Hi,
I’m currently trying to replicate this setup but I’m having issues with my DC PSU buzzing and not reacting to any commands sent via Artisan (my ports say COM rather than V- which is probably the issue).
Could you please share the link to the DC PSU on your set up? I have the same Severin, etc. as yourself.
Thanks,
Sam.

0
art_tech
art_tech

Answer 8 months ago

I don't have a specific link I'm afraid. I got if from eBay and the exact item doesn't seem to be there anymore. But COM vs V- shouldn't make a difference. Does everything else work, is the issue only the DC fan? Or is the entire setup not reacting? Try removing the PSU and powering the Arduino via USB, to check if that is the issue.

0
samjameshardy
samjameshardy

Reply 8 months ago

Thanks for the swift reply!
I swapped the VIN and GND wires over going to the DC PSU, I must have got them crossed.
However, since I’ve done that, as soon as I plug the Severin in, the fan is on at full speed regardless of if the Arduino is powered up. I don’t seem to have any control over the fan or heater via the Artisan app but I can get a BT reading from the thermocouple.
Sorry if this is a simple solve, I am new to all of this and trying my best to learn.
I’ll attach a photo of my setup for reference.
Thanks again,
Sam.

4020E05D-24ED-4739-8C51-EA8F5F9CFA90.jpeg
0
art_tech
art_tech

Reply 8 months ago

Could be that you fried the MOSFET in the DC driver with the reverse voltage. That's fairly easy to repair yourself though if you have a soldering iron. Just get a new IRF540N and desolder the old one. Not sure what would be up with the heater. Does the OT1 LED flash when you set the heater to 50%?

0
samjameshardy
samjameshardy

Reply 8 months ago

I will order a replacement up now and see if that solves the issue, thank you.
Yes the LED does flash when I set the heater to 50% and if set to 100% then it’s on solid, no doubt I’ve cooked the heating element while I’ve messed about trying to get the fan working.

0
jensbenz
jensbenz

Question 8 months ago

Hi art_tech
Thanks for sharing your very impressive project and the great instruction! I am very interested in hearing about your experience roasting with the above setup. Can it actually do profile roasts ok similar to the ones of a sample roaster like the ikawa for instance?
I am wondering if the two temperature probes that you discuss in one of the below comments is a problem for doing profiles: If it is actually the temperature of the air going through the roasting chamber that is being measured rather than the beans', will the two probes then be correlated to much? Or will the hot air temperature be affected enough by the bean temperature to use it as a meaningful measurement?
Once again thanks a lot!

0
art_tech
art_tech

Answer 8 months ago

Yeah, the two probes are fairly correlated, that is just a limitation of fluid bed roasters. You can still do profile roasts, it's just that the profile needs to be tailored to this type of machine to account for what is being measured, and really to your specific machine to account for minor differences in thermocouple placement.

0
PSidRJ
PSidRJ

Question 1 year ago

Hi thanks. Great job, taught me a lot.
I am trying something similar but simplifying some steps. Please allow me a question, and forgive me if it's too silly ... It would be feasible to connect the DC source to the PCB at the connection points of the gray and black (18V) wires and consider that the rectifier bridge itself would already perform the function of flyback?

0
art_tech
art_tech

Answer 10 months ago

Huh, good question. I hadn't thought of that before, but actually yes, it might work. I suppose you would lose a small amount of voltage as you'd be going through the diodes on the forward path as well, but probably not an issue. Otherwise I don't see any reason why this wouldn't work.

0
peterpatter
peterpatter

Question 1 year ago

This is amazing, thanks so much for putting this together and for explaining everything so clearly and in detail! I have a severin popcorn popper and I'm going to give this a try. I just had one question, does it matter what version of the UNO I use, would it work with the ARDUINO UNO WIFI REV2? and if so would that give me the ability to monitor roasts in artisan wirelessly?