Raspberry Pi Refrigerator

By David Crookes. Posted

If the power in your home is cut, there’s a real risk any food or other items placed inside a fridge or freezer will become spoiled. According to experts, refrigerated perishable food needs to be thrown out after four hours without electricity. Anything kept in the freezer will last 48 hours – but only if it’s full.

It’s a good idea, then, to create an alert system that will inform you if your fridge or freezer is suffering a drastic drop in temperature. One such solution has been created by Rick Kuhlman, who has sought to save the world’s frozen pies (and other foodstuffs, of course) from being destroyed by making good use of a Raspberry Pi computer.

Rick got to work after witnessing the devastating effects a power cut can cause when his wife lost months’ worth of breast milk during an outage. By connecting an Adafruit integrated temperature and humidity sensor to a Raspberry Pi Zero using a flat flex cable, he’s developed a near-perfect, low-cost solution.

Keeping cool

“Raspberry Pi Zero is inexpensive and extremely capable,” he says. “It’s especially nice for small headless projects with wireless LAN connectivity. But the biggest reason I turned to this computer is because of the community, documentation, and tutorials that already exist. Unknown issues can be solved quickly by learning from the shared knowledge the community constantly generates.”

A dashboard has been created in Initial State. It receives data every ten minutes, and allows for data to be viewed in real-time

At first, Rick played around with wireless sensors and items from the SmartThings platform. “It seemed elegant but the well-below-freezing temperatures totally degraded the batteries, and I wanted a reliable solution that didn’t require constant fidgeting to keep it working.”

He experimented with different wiring across a freezer’s vacuum seal and he considered ultra-thin thermocouple wire. “Ultimately, though, I wanted to use the Adafruit sensor because of its temperature range and simplicity of integration with Raspberry Pi. The flat flex cable was key to getting signals across the freezer seal without leakage.”

Avoiding the cut

Setting up the hardware proved straightforward. The relative difficulty came in creating the accompanying software. “Raspberry Pi OS Lite is great for headless applications, but it takes more configuration to set up and install the modules, libraries, and SDKs properly,” Rick says. “Getting wireless LAN setup headlessly, getting SSL access, and starting the app on bootup is not very discoverable either.”

Wires from the encased sensor are soldered to Raspberry Pi Zero. The maker wants to add a door sensor, too, for speedier alerts

But once he had everything in place, coding the app was smooth. Rick used the IoT platform Initial State, so Raspberry Pi Zero only needs to stream the data via Initial State’s Python SDK. “Without any extra coding on the device, I was able to create SMS/email triggers for temperature thresholds and data dropouts,” he says. “I also calculated and displayed the various statistics and unit conversions using the expression engine.”

You can view the status of the fridge online.

The device has been running flawlessly for six months, already sending alerts via text and email when the power was cut due to storms around his home in Nashville. It has also let Rick know when the door was left open for too long, heading off some potential meaty disasters. “I’m now able to sleep easy knowing my prime briskets are safe and sound,” he laughs.

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.