Itinerant Ham

Home » Electronics » Smart Freezer Controller

Smart Freezer Controller

One of the natural spinoffs from doing an radio license is that you get a natural interest in electronics.  So it has been for a few years but I’ll leave the history for another day.

Its been a few years since my friend Rick build his own fridge controller for the Danfoss compressor that keeps the food cool on his boat. I was tempted to build my own but it wasn’t until the ESP8266 came along that I decided to get going with it.

I had a false start or two with a board I got from Aliexpress that didn’t have all the required pullups on it and this was at the stage where there was very little information available on how to correctly use the device. Along with that and never having done any hardware or firmware development, it was challenging.  Happily I’d done some programming but never C or C++.

20160917_102049 20160917_102119

Anyway, This design has now transitioned from breadboard to PCB and is ready for final testing and connection.

The main processing is done by the ESP8266 with the addition of a PCA9685 to run the PWM.  I took the decision to use the PCA9685 since it has the dual benefits of having a better PWM output, particularly at higher frequencies and it will allow me to sleep the ESP8266 and reduce the overall power consumption.

The aim of the project is to make the freezer smarter.  The current controls for the Danfoss consist of a fixed resistor for compressor speed control and a simple thermostat.  This system has many disadvantages. The compressor speed is fixed and therefore consumes more power than optimal. The controller cannot take advantage of power when it is available such as when the engine is running or the solar bank has charged the batteries.  The new controller is wifi connected to the boat network and is controlled by MQTT that reports the battery voltage so that it knows what mode to run in. It uses node-red and node-red dashboard for monitoring. Other smart features built in (to the node-red nodes) are features that switch the freezer off during HF marine radio nets as the BD-50 controller is known for producing RF interference. Should the worst happen and the wifi go down, the controller will revert to a fallback mode and keep everything frozen but without the benefit of some features.

Other features for easier management when installed on the boat (think cramped spaces and things hidden away in corners) are the ability to update the firmware OTA.

Update: I’ve had a few requests for more detail and what’s been holding me back is that since I’ve been learning C++ as I go along, the code is truly shockingly bad so I’m reluctant to release it.  However, this is a very straightforward project.  Can I say at this point that its ONLY for DC DANFOSS COMPRESSORS and I TAKE NO RESPONSIBILITY FOR ANY DAMAGE YOU DO TO ANYTHING OR PERSON. You assume all risk 🙂

Anyway, all you need is an ESP8266 – a 12 or better if you can since the added memory will allow you to do the OTA. In addition you will need:

  • PCA9685 board from Adafruit or somewhere else
  • DS18b20 – get one with a longer lead – preferably the waterproof, sealed type – you’ll need a resistor pullup
  • I also use a single channel 4N25 optoisolator which is driven by one channel of the PCA9685

The software uses the Adafruit PCA9685 library and also the excellent DallasTemperature library.  I especially like the DallasTemperature library since it provides access to the DS18b20 sensor ID.  I’ve used this feature in another project I’ll write about soon.

I started by wiring up the DS18b20 and reading temperatures from it.  Then I added the PCA9685 (I went via using the ESP for PWM to modulate the output voltage but I found that there was a bit of a hiccough when the wifi was working. I wanted the output to be as smooth as possible and therefore chose the PCA9685.

So after I got the temperature side is working, I looked at the output side and implemented the PCA 9685 – I had to resist the temptation to fill the fridge with flashing LEDs as to use up the other channels!  The Adafruit library makes this very easy.

 

Then I wrote the control loop that switches the output on the PCA9685 according to the temperature of the fridge.  You can have a lot of fun with this!

Anyway, there’s a quick update – the solution is up and running reliably on the bench – now I need to get it installed on the boat – more later!

Advertisements

3 Comments

  1. arduinojantje says:

    I think this is really interesting. I want to make something similar to have my freezer have a lower set temperature during low cost electricity. Do you have more technical details?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Older Posts

%d bloggers like this: