Having recently bought a smoker, and not being very good at it, I thought it would be a good idea not only to document the process for repeatability (on the occasions I get it right!), but to be alerted if temperatures exceed a preset range. This project uses a MAX31855 K-type thermocouple amplifier, along with a TPS61291 low power switching regulator for maximum efficiency and, of course, a way to transfer data wirelessly.
Data is sent over long-range 802.15.4 protocol and logged in Grafana. Out of range temperatures are forwarded to a small IFTTT Applet that sends a notification to a phone, so no need to regularly check on the smoker itself!
Ultra low power consumption was a goal for this project. For the most part, the system sleeps and only wakes up periodically for measurements. The MAX31855 uses about 1 mA in standby mode, so the circuit includes a PNP transistor to turn it off between readings. It's also necessary to run that IC at around 3V, otherwise it becomes a bit unreliable. By default, the regulator is set to pass battery voltage through, saving a few microamps, but if the battery drops below 2.9 V, the microcontroller enables the regulator's boost mode to 3.3 V during measurements. This allows the system to run very efficiently, as the CC1312 will work down to 1.8 V, allowing boost mode to be enabled only during a measurement.
Once the hardware was finalized, I needed a (cheap) way to measure consumption as I developed the firmware. At the heart of it is a CurrentRanger, which is able to switch from the nA to uA and mA range automatically. What I felt was missing was more advanced tooling to analyze power consumption. A small change to the CurrentRanger's firmware allowed me to feed a Grafana time series, for which I created power analysis dashboard to suit my needs. Power Analyzer on the cheap!
I initially had brown-outs with the CR2032 battery during tests as current demand increased suddenly during radio transmissions. Felix over at lowpowerlab.com was super helpful with suggestions, and it turns out the issue was battery impedance being too high for measurements. During tests, using a couple of D batteries solved the problem:
I chose Redis and redis-timeseries for Grafana to store power samples at 1 ksps. Besides modified firmware, I put together a small python script to send data over to Redis, and created the power analysis dashboard:
In the image above, you can see temperature being taken every 5 minutes, and corresponding energy consumption. While sleeping, the system uses around 80 nA, and temperature readings use ~25 mA (radio + 31855). The dashboard shows ~25 uA continuous consumption, meaning a lifetime of about a year on a 220 mAh CR2032 battery.
The detailed view of a sample/transmit event shows, first the temperature sample measurement, roughly 6 mA for 100 ms, which is just about as short as possible, since the 31855 needs some time to stabilize after waking up. Then, radio transmission takes place for about 200 ms at ~25 mA. The radio is configured for long range (5 Kbps) and relatively high transmit power (13 dBm in the image below).
There is a good opportunity to improve power consumption by lowering tx power. For example, a 0dBm transmit power more than doubles life expectancy, but still retains excellent range (averaging around 10uA continuous):
The next opportunity for savings is shortening transmission time. Increasing data rate from 5 Kbps to 50 Kbps, transmissions are roughly 10 times faster at about 20 ms, yielding the best power savings so far (3.4 uA continuous!):