In conjunction with a friend, we developed an ESP8266 development board called the CheeseBoard. This is a WiFi enabled micro-controller unit with a small OLED screen and 5 x RGB LEDs that can be individually controller. It also has a rotary encoder and push button for user input.
We thought it was great, we ran a workshop at our local hackspace and people thought it was good and developed interesting uses for them (chicken hutch door controller is the best one). But we have hardly sold any of them online. Maybe the reason is that they are too expensive (lots of online sellers do the individual parts for lower cost)? Or maybe the ESP32 is now out which is more powerful and only slightly more expensive. Maybe my photos are a bit rubbish? Anyway, whatever the reason, I have about 30 of them still in stock.
I'm a pretty amateur home-brewer. I make all-grain brews using my Grainfather (an all-in-one beer maker). This has temperature control and a nice display of temperature, which is useful for getting things right (I used to use an old thermometer which was in Fahrenheit and my beer was not as good..).
After making the beer you need to let it ferment, trying to control the temperature range from an ideal of around 18-22 C (depending on what you are making & the strain of yeast). I wanted to monitor this temperature accurately, remotely and with a record of what happens over time. So I thought - electronics can fix this!
This blog post covers a temperature unit using the CheeseBoard to monitor temperatures both on the screen and online. The LEDs are used to show over or under temperature. Data is streamed through the internet and can be monitored online anywhere.
So here is a blog post on the various steps to do this. Maybe it will show people what can be done with the CheeseBoard. If you are interested in this brewing monitor, either as a kit or a fully built unit, then please drop me an email and I'll see if there is enough demand to make up a few kits.
This solution could be used to monitor any environmental sensor. I am hoping to add on more sensors to this device.
Programming the CheeseBoard
The CheeseBoard is based on a NodeMCU, which is an ESP8266 WiFi system on a chip, along with a USB-Serial converter and some voltage regulation. This means we can plug in to the micro-USB on the NodeMCU. This will require the CH340 USB serial driver, which should be quite easy to find. This might work if you have the driver installed already.
You need to include the following URL to the preferences in Arduino. Go to File -> preferences -> Additional Boards URL then paste this line in there:
I usually need to restart the Arduino program. You can then go to Tools -> Board -> Board Manager. This will open up a list of available board core libraries. Search for ESP8266 and install that one.
You may need another Arudino program restart.
You should then see a number of additional boards when you open your boards (go to Tools-> Boards). For the NodeMCU included with the CheeseBoard you need to use "NodeMCU 1.0 (ESP 12E Module)".
Use the most recent version of this library as there are changes and updates all the time. I've found this method of programming the NodeMCU to be relatively easy. Programming the NodeMCU/ESP8266 takes a lot longer than an Arduino Uno, for example - this is because of the much larger memory within the ESP8266.
Connecting to WiFi
I wanted to be able top use this unit on any wifi network by entering the SSID and the password. I found the amazing 'wifimanager' library via the Arduino library manager. This stores the SSID and password information within the ESP8266. If the network is not in the saved list then the ESP8266 starts in access point mode (AP). You then connect to this access point and go to "192.168.4.1" in a browser. You can then scan for networks, click on your one and enter the password. The unit will then re-boot and connect to the network.
This will automatically connect if the SSID is already saved. It's a great library and saves me having to hard-code the wifi credentials.
Reading a Temperature
I'm using a DS18D20 1-wire temperature sensor. I first started with through-hole soldering packages, but I ordered some waterproof units, which are readily available via eBay.
There are suitable libraries to read these sensors already available for Arduino IDE. You need to install both the dallasTemperature library and the oneWire library. both are needed for the Dallas 1-wire sensors.
I am using the sensors in parasitic power mode, so I only need 2 wires to each sensors - a data/power line and a ground.
I have used these sensors many times before and thought this would be the easiest part of this project....
But I kept getting a returned value of 85C, which is an error code for 'not enough power'. I investigated (well, googled) a bit more and found that this is an error that other are getting too. The (hacky) workaround is to use a 1k pull up resistor, rather than the specified 4.7k pull up value. This also needs pulling up to 5V, rather than 3.3V. With a 1k resistor to pull up to 5V then the temperature sensors worked for me!
MQTT is a lightweight Machine to Machine Internet of Things protocol. It is simple and quite ubiquitous. At my local hackspace all messages (from ID of person entering the room via and RFID tag to the fridge temperature) are sent via MQTT with a local MQTT broker (Mosquitto) to monitor, record and respond to these requests.
MQTT requires a broker, which is either implemented locally/on your own server or one of a number of online services, some of which are free.
Channels are set up on the broker. The IoT unit can then subscribe to the channel. Any change to the value will spread out to all units that are subscribed. Units can also publish to the channel, which will update it to the broker and hence to all subscribed units.
I tried the AdafruitIO platform. This is free for up to 5 feeds and less than 30 updates per minute. Adafruit are a makers company who have extremely good customer support (I want to be more like them!), so I thought their platform would be suited to this applcation.
You need to create an account with Adafruit (this is free).
You can then log in and go to IO tab. This links you through to your IO dashboard.
I looked up their Adafruit IO MQTT API guidance. You will need you Adafruit IO username and your Adafruit IO Key. The Key can be generated using the dashboard on the top right corner. You want to keep your key safe. If any breach of the key the you will need to regenerate it and change on your IoT unit.
You need to install the Adafruit MQTT library via the library manager in the Arduino IDE. I followed the "Adafruit secure ESP8266" example to give me input into my code. It worked perfectly first time. This code sets up a feed called 'test'. I wanted to have a feed that was more informative than that. So I changed to code to give me a feeds for both "fermenterTemp" and "airTemp".
Here is a screenshot of the data. The dashboard is fully configurable, and I can also set up IFTT alarms to text/email if something changes.
I have also used ThingSpeak which is now owned by MatLab. This also worked well.
There is a very good library to implement all the publish and subscribe commands to a MQTT broker.
Displaying the Values
There is a small OLED screen on the Cheese Board. This can display text and graphics to pretty good resolution. The amazing U8g2 graphics library controls all the graphic write functions to the OLED screen.
I implemented a display control system to show several pages:
- All values with text
- Value 1 with large text
- Value 1 graph
- Value 2 with large text
- Value 2 with graph
The rotary encoder selects through those modes and the chosen mode is stored in EEPROM, so when the unit powers down it will start again with the same display. This uses the Button2 library in Arduino IDE.
This is expandable, so can display other pages if I need to in the future by adding more display modes and pages within the displayUpdate function.
Control the LEDs
I wanted a good, bright feedback control of when my fermenter is over or under the idea temperature range. The Cheese Board has five RGB LEDs onboard and I use all five of those to show a different colour - blue for under temp, red for over temp and green for 'just right'!
The LEDs are WS2812's (sometimes called NeoPixels). These can be controlled by the NeoPixel library from Adafruit. The Cheese Board has some additional code to easily control the LEDs on-board.
Displaying Data on a Webpage
While not essential, I wanted to be able to show the data from my MQTT feed on a webpage. As usual, Hackaday had already done a review and write up of this which looked at different MQTT and datalogging platforms. This article mentions that using ThingSpeak the data can be shown using an iframe within any other webpage. That'swhat I would like to do sometime, so I'm going to look into that in the future!
So hopefully this blog post has shown how you can use an ESP8266 unit to monitor your fermentation temperatures.The temperatures are displayed on the OLED screen and uploaded to Adafruit IO so can be monitored from anywhere using a browser.
Additional features would be a controller to turn on/off heating or cooling to try and maintain a temperature.
I don't use any active temperature control on my fermentation, so I'm really wanting to understand if the fermentation is within the range I expect. This will be more useful when the weather gets a bit colder.
Here are some photos of the unit and development. I made a laser cut enclosure for it as well: