I ordered another two relay board with the same relay as a replacement. I seems almost all of the relay boards for the Arduino use exactly the same relay. When I looked at the specs more carefully, they are rated for 10 amps, but only a fraction of a horsepower. I'm pushing them at the limit by running the compressor through them. But, ... I can get replacement relays for about twenty cents if I buy 10 or more of them, so maybe I'll just put in a relay socket and rotate the relays on some schedule. I could also come up with my own shield board and use a nice big quarter horsepower relay in there. I'll look into that later, but I needed the freezer running properly; I installed the new board with the two relays paralleled to (hopefully) double the life by cutting way down on the surge current each relay had to handle.
A few days later I had visitors with small kids. The kids were fun and enjoyed the desert and especially the pool when the afternoon was around 115F. However, the frequent trips to the freezer to get ice and little hands managed to leave the freezer door open a little bit and the evaporator on the bottom froze up.
I drug out the heat gun and melted the ice and the freezer took off and started working again, but this was the second time in less than a month that the freezer had given me trouble. Clearly, I needed to monitor it somehow.
I thought about using various methods to look for ice build up on the evaporator, or sense the airflow that should be moving through it, but they were too complex for a simple job like this, so I decided to just monitor the temperature in the freezer and set off an alarm of some kind (email, text message, big red light, siren) when the temp reached some level. I already have a temperature monitor that runs on batteries <link>, but I didn't really want to put one of those inside the freezer. Mostly because I'm not sure it would work at temps below zero Fahrenheit, and the moisture would probably kill it anyway. Since I already had an Arduino in the top of the freezer running the defroster, why not just attach a temperature sensor to it and get the reading that way?
Also, since the Arduino has an XBee attached to transmit when the defroster is running, I could transmit the temperature to my house controller and actually log it to my database server up in the attic.
It took a couple of hours to come up with the first version of the Arduino code and another couple of hours to figure a way to get the temperature sensor inside the freezer. I wound up actually drilling a hole in the freezer and feeding the sesnsor down inside where it could catch the airflow inside. I just can't praise these little temperature sensors enough. I used one of the sealed DS 18B20 sensors that have a stainless steel can over them:
These have a wire long enough to run where I needed it and are as easy to read as the regular 18B20. Nice solution with no calibration required.
When I got the Arduino part running, I went to my house controller and added code to catch the XBee message which now contained the temperature as well as the status of the defroster and started saving the data to my database. Then, I modified my status web page to display the freezer and set up some code to grab the reading out of the database and display it for a 24 hour period.
While I was doing that I realized that I was already grabbing the power usage of the freezer using an Iris SmartSwitch so I couldn't resist saving that data as well <link>. Now I could display both the power usage and temperature on the same graph. Heck, now I can see the health of the freezer at a glance and (maybe) catch a problem before it melted all my frozen food making a nasty mess that would take hours to clean up, and cost a bunch of money.
I was standing back, watching the blinking lights on the freezer and looked over at the fridge ... I really should do one of those for the fridge also, shouldn't I? I went back over to my box of parts and drug out enough pieces to build another device. This time I didn't need relays because I wouldn't actually be controlling anything, just monitoring stuff. I wound up with these pieces to build one of these:
The board in the upper left is an XBee shield that allows me to choose which port I hook the XBee serial lines to. I use the serial port for debugging and then use SoftwareSerial to enable a couple of digital pins to control the XBee. The XBee is lower left; the Arduino is center beside a 4.7K resistor. You HAVE to have the resistor for the sensor, far right, to work. Since I managed to grab a handfull of Arduinos for three bucks each some months ago, the whole collection, including the XBee cost less than $25. I powered the entire mess with a wall wart that I picked up for a buck or so and used one of my many USB cables for the power cord. Straight forward and simple project.
I also modified the code for the Arduino such that the name of the device is taken from the XBee and used in the message I send. That way, when I build one of these for the freezer I have out in the garage, there are no code changes needed at all, I just name the XBee to match the device I hook it to.
Then, I made the same kind of changes to my controller code and database as the freezer and I can monitor the fridge exactly the same way. I took the easy way out on the web display and just added a couple of tables to the html to display the current temp and a button so I could get to the graphs for each of them:
Since getting the highest and lowest values for a 24 hour period is a database query, I can display them. I added the status of the defroster to the freezer because it can get warm for a few minutes in there when it's running, and I didn't want to get excited when I saw a higher reading if that was what was causing it.
The indicator on the fridge is on because I haven't decided what to set the indicator to yet. I want a few days of data before I start setting up alarms to tell me something is wrong. I'll probably wind up setting it to 50F or so though.
When you click on the 'Chart' button for the freezer you get:
The wide jumps in power are the compressor turning on and off; the narrow spikes are the ice maker doing its thing; and the jumps that go off the chart are the defrost cycles running. I need to do a little tweaking on the chart to keep that from going off the top. Notice how the temperature rises slowly and then crashes down when the compressor turns on? There's a little interaction between the temperature changes and the frozen items in the freezer that causes some 'ballast' effects. It's all good and everything is fine.
Similarly, the fridge graph looks like this:
This looks cleaner because there's no ice maker or defrost cycle to clutter things up.
It's nice being able to actually see how the appliances are working and what level of power is actually being used. I still have to decide what values I'll set up for alarms for the devices and implement them in some fashion. I'll probably just send myself email telling me to take a look, because it takes a few hours for something bad to happen when the fridge or freezer acts up. The big thing is that now I can.
While I was doing this I noticed how easy it is to save my own data locally and then do something with it. For years now I've been using cloud providers like Xively, GroveStreams, etc. for this. I'm going to totally reverse that decision. As I've said a number of times, I hate depending on some provider out there somewhere to save my data for me. When the internet goes down, my data just drops on the floor and disappears; saving it locally for a year or so is not that bad and I have complete control over it. I won't have to rely on the provider not changing the interface, changing the storage price, changing the manner they deal with me, etc. Home automation and monitoring is a multi-year endeavor and internet companies work on a month by month basis. Not a good combination.
Don't get me wrong, I love the IOT (Internet Of Things) idea, but to me, it means being able to get to MY things over the internet without having to rely on someone else's company policy.
All the code for this is in github if you want to grab something.
Out of curiosity, why didn't you simply use the arduino that's already monitoring the freezer to catchthe temp in the fridge?
ReplyDeleteI have an all refrigerator (no freezer in it) and a separate all freezer (stand up kind). They match and are on each side of a doorway. So, I either had to set up two monitors or run a wire. You know how I feel about running a wire.
DeleteUnderstand completely. Didn't realize they were separate units....
DeleteI love your point about not using cloud services. Not only do companies go bust or change ownership or change policy, but most commercial IOT gear and services are very insecure. Also like when Nest bought Revolv, all those devices that relied on phoning home stopped working.
ReplyDeleteYours is a much better way forward.
Originally, I thought cloud services were awesome. But over time I've experienced the shortcomings of using them. Google's been good to me, but I can't say the same for many others.
Delete