
Recently my garage beverage refrigerator decided to break. The condenser would either never run, or never turn off. So either everything was room temperature (yuck), or frozen no matter how we set the internal thermostat.
After a few weeks of room temp beverages I decided it was time to fix this.
I dug in my miscellaneous parts drawer and pulled out an Arduino and also found a DHT11 temperature sensor.
The Arduino I found was an UNO R4, it is more recent and has a small built in LED array and built in WiFi. Arduino’s can now be programmed from a cloud site so no need to download much more than a simple USB driver.

In a few minutes I had a simple Sketch that would read the temp from the sensor and output to the LED.
It was pretty straight forward to add a temp that we would need to turn off the refrigerator and a couple degree dead band before it turns it back on. I found that the sensor was a few degrees high in the measurements and also only accurate to 1°C at a time. I altered my set points, so the LED display is 3-4°F high.
I also had a spare Kasa Smart plug to plug into the fridge to help control it. However the Kasa has no public APIs to directly control it from the Arduino.

A few Google searches lead me to this post for a way to mimic what the Kasa phone application does to control the switches.
The Ardunio has WiFi capabilities built in so simple enough to code a PHP page to toggle the switch on and off. Using the example code I had the UUID of my device and the PHP page built to toggle it on/off added to the sketch.
Since I had to code the ability to call a website I might as well create a page to log the temperature readings every 15 minutes. And using that data show a nice graph on a webpage as well.
So now the sketch will check the sensor about every 30 seconds, it will update the LED when the temp changes and every 15 minutes log the current temp to the server. If the temp goes above the set point dead band temp it will turn on the fridge via the Kasa Smartplug and turn it off when the temp goes below the set point.

Every 15 minutes it also retriggers the Kasa smartplug just to make sure it is in the state that the Arduino expects it to be in.
The sketch can be downloaded from here if interested. And the temp logger and graph PHP is here. Note: the URLs have been changed, so no need to try to spam my logger. 🙂
Next up is a 3D printed case to properly mount it on top of the fridge. All in all a fun project and best of all a working beverage fridge again.
Leave a Reply