I wanted to be able to measure the bean mass temperature in my Gene Cafe coffee roaster to help improve my roasts. This is a little tricky in this roaster because of the way the drum rotates (because there is no axle to pass a stationary probe through).
I developed a battery powered bean mass probe that attached to the rotating part of the coffee roaster and sent data back to a computer using Bluetooth. Although this worked pretty well, I struggled a little bit with the reliability of the Bluetooth connection. As a result, I developed the second generation system that is documented here.
The purpose of the bean mass probe is to measure and report the temperature of the mass of coffee beans as they roast. This can help you monitor and adjust the roast on the fly. In my system the temperature is measured with a type K thermocouple that is inserted into the Gene Cafe rotating roast chamber.
Thermocouples require an amplifier to condition the signal (a very very small voltage generated at the thermocouple junction that is a non-linear function of temperature) before it can be read by a micro-controller. Fortunately the MAX31855 breakout board from Adafruit that I use here makes all of that very simple.
Once the temperature signal is available, a micro-controller is used to capture and process the data and communicate it back to a data collection program or display system. I have chosen to use an ESP8266 as it can handle the signal processing an also has integrated WiFi to accommodate communication back to a central server. Again, Adafruit makes this very easy by providing a breakout board for the ESP8266 called the Huzzah.
I have elected to use MQTT as the communication protocol from the bean mass probe to the central server (in the case of MQTT this server is called a message broker). This is a very simple, flexible, and well-supported protocol that makes the data from IoT devices available to any connected system that may wish to use it. Adafruit has a public broker set up called AdafruitIO that also has a very simple to use dashboard display. This tutorial shows how to set up the bean mass probe using the AdafruitIO system but there are many other ways to set this up and use the data.
This is the basic block-diagram for the V2 bean mass probe:
The MQTT broker here is AdafruitIO. The MQTT Client is the web interface to Adafruit IO.
The wiring diagram and parts list are shown here. Note that you need to connect the thermocouple directly to the thermocouple amplifier without any other connections or lead wires. If you need to make a connection in the thermocouple, it is important that you use proper thermocouple connectors or you will create very significant inaccuracies in your temperature readings.
The thermocouple is installed in the end of the roasting chamber opposite of the door. I found that the measurements obtained with the thermocouple on the door end were far less accurate (more on that later). To install the thermocouple, first drill a small hole (3/16″ will do nicely) in the location shown here all the way through into the roasting chamber
The thermocouple junction is just two wires of dissimilar material twisted together. You can purchase sheathed thermocouples but what has worked best for me is a simple bare, fine-gage thermocouple wire. It is important that the thermocouple is small so that it will respond to temperature changes quickly.
Insert the junction into the chamber about 1 1/2″. I found that by doing this, you can later bend the wire into position and allow some adjustment to get it where you want it be in the shifting mass of coffee beans.
At this point, you should leave plenty of wire to route to where you are mounting the thermocouple amplifier and micro-controller. For this tutorial I am mounting these components on the handle of the roast chamber but as you can see in other posts on this page, I have tried a number of different locations. The thermocouple wire will lay nicely in the corner between the flat part of the end of the roast chamber and the transition to the inlet.
Secure the thermocouple wire in place and seal the hole using Sugru. This material seems to handle the temperature well though it is at the top end of its rating. You will need to know where you are going to place the thermocouple amplifier before you do this. The installation I show here has the amplifier attached to the drum which eliminates the need for a thermocouple connector. I have also experimented with mounting the electronics off the drum on the rotating part of the roaster — this is a little less convenient as you have to disconnect the thermocouple when removing the drum to load your coffee
Check the fit of the modified roast drum into both the drum stand and the roaster itself to make sure the Sugru covered thermocouple wire does not interfere with them.
Bend the thermocouple so that the twisted end of it is tucked into the corner of the shield inside the roast chamber. You are trying to keep the junction immersed in the rotating bean mass as much as possible but you also need to keep the junction away from hot surfaces. As the drum rotates, the beans will periodically come in contact with the thermocouple (about half of the time). Because of this, the temperature the thermocouple reads is the temperature of the bean mass only some of the time. The rest of the time it is measuring the environment temperature (which is much hotter during the roast). I correct for this in the software simply by detecting the lowest temperature in each revolution and assuming that this is the bean mass temperature. It seems much closer than I had originally thought it would be.
Attaching the Electronics
I have been looking for the perfect solution to attaching the electronics to the roaster. If you mount things on the drum itself, you have to deal with the fact that 1) the drum gets very hot and 2) there is not a lot of space to package things. If you mount the electronics off the drum you still have to use a surface that rotates with the drum and you also have to deal with connecting / disconnecting the electronics every time you replace/remove the drum. I designed the simple mounting system shown below to eliminate the need for connectors. This works pretty well but makes it difficult to handle the drum since you can’t grasp the handle as well.
The yellow parts are 3D printed and the STL files are available on thingiverse. The bracket is intended to be attached to the drum handle using zip ties. The Huzzah is mounted to the bracket using #2 machine screws and nuts. The amplifier is mounted to the bracket using short pieces of filament inserted through the mounting holes like rivets. The LiPo battery is mounted to the battery clip using zip ties. VERY IMPORTANT NOTE: Make sure that the battery clip can not slide down the handle and allow the battery to contact the hot drum. Overheating LiPo batteries can cause explosions and fires.
Step 1: AdafruitIO (MQTT Broker & Dashboard)
The easiest way to consume data from the bean mass probe is to use the AdafruitIO MQTT broker. Go sign up for access to this nifty tool. It has a nice dashboard feature to display data in real time and also to plot graphs. Here is a screen shot of some recent roasts I did.
There is a bunch of information on the Adafruit site on how to use this tool. Take a look at some of the tutorials there to get a feel for how it works.
Once you have your AdafruitIO account, take note of your userid and your AIO key. You will need these things to set up the bean mass probe code to send data to AdafruitIO. Go to the AIO settings page to get the AIO key.
The program that I wrote to run on the ESP8266 will produce three data feeds that correspond to the most recent maximum temperature reading from the thermocouple as well as the most recent minimum. Additionally the current temperature reading is sent. The feeds are sent to your account on AdafruitIO with the names MaxT, MinT, and CurT. You will need to set up each of these feeds in your account on the “Your Feeds” page. Once you have set up the feeds, you can create a dashboard like the one shown above to display the data however you wish to see it.
Step 2: Programming the Huzzah
Follow the instructions on setting up the Huzzah on the Adafruit site. You will also need to get the Arduino library for the Max31855 thermocouple amplifier.
Note: The Adafruit MAX31855 library will not work out of the box with my code. You need to edit the Adafruit_MAX31855.cpp file as follows:
- On windows you will likely find the file (after you have installed the library) at this location: C:\Users\YOURUSERNAME\Documents\Arduino\libraries\Adafruit_MAX31855_library\Adafruit_MAX31855.ccp
- Find this section of code
And change it to:
#define _delay_ms(ms) delayMicroseconds((ms) * 1000)
#define _delay_ms(ms) delayMicroseconds((ms) * 1000)
- Get my code for the Huzzah from github. Note that you will need to edit the code to allow the bean mass probe to connect to your network and to talk to your AdafruitIO account. Following are the lines you will need to edit:
#define WLAN_SSID "YOUR SSID"
#define WLAN_PASS "YOUR WLAN PASSWORD"
#define USERNAME "YOUR ADAFRUIT IO USERNAME"
#define PASSWORD "YOUR ADAFRUIT IO KEY"
The rest you can leave alone if you wish. Once you load this up and apply power, the Huzzah will begin transmitting the temperature data to your AdafruitIO account.
Fire up your roaster and enjoy!