Clear a Saturday afternoon and about PHP 600 of parts, and you can end the weekend with a fridge that keeps its own logbook. Hunter McGuire built a refrigerator monitor around a Seeed Studio XIAO ESP32C3 that stores its temperature history on the board itself, then sends the network a short summary instead of a firehose of raw readings.
What he built
The monitor reads temperature every five seconds. That works out to 17,280 samples a day. Pushing all of those to a broker would be wasteful for a box whose temperature moves slowly, so the firmware keeps a 30-minute rolling window in a RAM ring buffer and publishes one summary per minute: 1,440 messages a day, a 92 percent cut in traffic. Every sixth sample is also written to MicroTetherDB, a BTree store that sits on top of the btree module bundled with MicroPython's ESP32 builds, configured to retain 60 records.
Local history is the point. A fridge can average a healthy 39°F and still hide a failing door seal or a compressor cycling far too often. Those show up in the shape of the curve, not in the current reading. Because the samples never leave the board, the ESP32-C3 can compute its own min, max and drift, raise a flag when something looks off, and hand over the raw records only when you ask for them.
Parts and cost reality
- XIAO ESP32C3 — 21 x 17.5 mm, RISC-V core, 400 KB SRAM, 4 MB flash, Wi-Fi and USB-C, around $5
- DHT22 temperature and humidity sensor, roughly $4, with a 10k pull-up resistor on the data line
- Three jumper wires, a small breadboard, and an MQTT broker on whatever Pi or PC you already leave running
Nothing here needs a soldering iron if your XIAO came with headers. The tricky part is placement: run the DHT22 on a short lead into the fridge cavity and keep the board outside, because condensation on a warm PCB will do more damage than a cold sensor ever will.
Spend your Sunday on this
Flash MicroPython, wire the DHT22 data pin to GPIO D0, and start with a plain five-second print loop before you add the ring buffer. Get the sampling right, then bolt on storage, then MQTT. The full write-up with the buffer and database code is at Hackster. If your readings come back as NaN, the DHT22 library is almost certainly polling faster than the sensor's 2-second minimum interval, so slow the loop before you blame the wiring.
Originally published on blog.circuit.rocks.
Top comments (0)