A discussion of a new series of articles about using the PSoC 6 + 43XXXX Wifi/Bluetooth combo chips to implement a data collection system for the Tilt2 Hydrometer. Even if you aren’t specifically interested in hydrometers, this is a general purpose discussion of the design of an IoT device.
In the middle of the Covid lockdown my 21-year-old daughter suggested that we start brewing beer. This was always something that I have been interested in so I said “Sure!”. What does this have to do with IoT you might ask? I am an engineer and I love data. Two of the key pieces of data that you are interested in while fermenting beer are:
- The gravity of the beer
- The temperature of the beer
If you don’t know anything about brewing beer, it is simple (people have been doing it a long time… even with no IoT)
- Start with grain
- Mill the grain
- Heat the grain with water to turn it into sugar water (called wort)
- Add yeast
- Wait while the yeast converts the sugar in the wort into alcohol and carbon dioxide
- Bottle the beer (or keg)
Back to the metrics. The “specific gravity” or just “gravity” is just the ratio of the density of your solution to plain water. This is an indication of sugar in the wort solution. At the start of the fermentation you will have “lots” of sugar, and no alcohol. By the end you will have “lots” of alcohol and not much sugar. You can tell how things are going by monitoring the gravity of the beer, which is a proxy metric for how much sugar has been converted to alcohol.
There are two common ways to measure the gravity:
- A float hydrometer – sugar water is denser then water, so a “float” will float lower in the solution as the sugar gets converted to alcohol.
- A refractometer – the index of refraction of the solution changes as the sugar concentration changes (this is an amazing old-school technology
As I was learning about this whole process I found the tilt hydrometer. This device has
- A Bluetooth MCU (u-blox BMD-300)
- An I2C accelerometer (NXP MMA8451Q)
- An I2C temperature sensor (Microchip MCP9808)
- Enclosed in a sealed plastic tube of known volume and weight (known density)
As the gravity of the beer changes, the device floats at a different angle (because it floats lower/higher). They use the accelerometer to measure the apparent angle of gravity to calculate the angle of the device. This angle is then used to calculate the density of the solution it is floating in. They then broadcast the calculated gravity and temperature in Apple Bluetooth iBeacon format.
When I saw this, I thought “perfect” I know what to do with that. I should build a device that can collect all of the data, display it, save it to an SPI flash and put it into the cloud. It should look something like this: (each Tilt is identified by 1 of 8 colors… pink in this case).
Yes, I know they have an iPhone app, but I want to build a single device that sits in my brewery all of the time. And yes I know they have a Raspberry Pi app, but that isn’t the point.
My device will have the following characteristics:
A Display with:
- A Splash Screen
- A Table of all Tilts, Gravity and Temperature
- Single: One screen per tilt with the specific data including debugging
- Single: A graph of the active data for one specific tilt
- Single: A table of all of the recordings from that specific tilt
- The WiFi Status
- The Bluetooth Status
Bluetooth System that can:
- Record tilt data as broadcast in iBeacon advertising packets
- Repeat tilt data (maybe)
- Introducer WiFi (probably)
CapSense button GUI to:
- Next Screen
- Auto Mode
- Reset current
- Dump recorded data to the SD Card
- A UART based command line to debug & learn
- Mass Storage to see files
- USB <-> UART Bridge
Power Supply via USB Port
- Plug in Type-C using Cypress BCR
- MQTT Publish to AWS
- NTP – to find the time
- Local webserver
- Keep Track of current Time
SPI NOR Flash
- Record the data
- Dump the fixed SPI Flash recordings to a removable SD CARD & remove data from the SPI Flash
If you put a Bluetooth device floating in a bunch of beer, surrounded by a metal fermentation container, you will not be able to hear the Bluetooth signal. To solve this problem the Tilt people made a repeater which can rest on the top of the fermenter. It listens for the weak signal, then rebroadcasts with a higher gain antenna.
Here is a list of the articles that I plan to write
This series is broken up into the following 12 articles with a few additional possible articles.
Tilt Hydrometer: LittleFS & SPI Flash (Part ?)
Tilt Hydrometer: WiFi Introducer (Part ?)
Tilt Hydrometer: WebServer (Part ?)
Tilt Hydrometer: Amazon MQTT (Part ?)
Tilt Hydrometer: Printed Circuit Board (Part ?)
You can get the source code from firstname.lastname@example.org:iotexpert/Tilt2.git This repository has tags for each of the articles which can be accessed with "git checkout part12" You can find the Tilt Simulator at email@example.com:iotexpert/TiltSimulator.git.