# Detecting when the thermostat turns on the refrigerator

I'm wanting to monitor the power consumption of my Fridge (and Freezer) on a boat where the voltage runs from 12-15.6vDC

The Thermostat is an Inkbird(from Amazon) that closes a relay when the compressor needs to come on. This alerts the Compressor controller to turn on the compressor. This controller also activates a small computer type fan to blow air over the coils. I'm wanting to capture the time period the unit is running so I can track the power consumption. There are several factors that can cause the consumption to go up.

• Door gets left slightly ajar
• Frost builds up over time
• Compressor leaks Freon
• Exterior Temperature changes.

Rather than rely on a meat computer (me) to track these things I want to post them to a raspberry pi which will track them over time and alert me when things go off the rails. To do that I need to know when the unit is running and I need to do it with very low power consumption (because I'm living on batteries and sunlight).

There is a single Voltage ADC on the Arduino that will measure the voltage between 0 and the supply voltage. I could do some type of voltage divider and look for something there using the fan connections which are only powered when the compressor is on, but that means I need 2 Arduinos. Is there some simpler mechanism for detecting the thermostat has closed the relay? Maybe something that does i2c so I can deal with everything in a single unit. Would be even better if I could feed that back directly to the raspberry pi, relying on the fan voltage to activate the device so it is only consuming power while the compressor is running.

The things I want to do is have the rPI watch the runtimes and alert me if the consumption rises over several days, or if the unit is on continuously for longer than expected; I also want to be able to send alarms onto the navigation bus, and an audible alarm when there is something I need to look at. But that is just software. I need the sensing to drive that. What is a super simple, low power way to deal with that?

The rPi is already being used for other things (navigation, wifi, media player, etc....)

• This is a bit broad and short on key details, but you shouldn't need to use the ADC (or even really, the Arduino). If it's the positive lead being switched, you can indeed use a voltage divider. If it's the negative, things get a bit more complex, but you could use an optoisolator or another relay. You could also use something like a hall effect current sensor, or possible with care even a direct DC shunt one. Keep in mind your pi is going to be power hungry and so is not really the best choice, though apparently you are already settled on that for other reasons. Aug 8 '20 at 19:53
• You appear to prefer things to be complex, I'd make things much more simple. Use an optocoupler to detect what the fridge is doing, the LED in the opto + series resistor in parallel with compressor. Then I'd use an Arduino to monitor on/off time ratio and when that gets out of hand: sound an alarm (beep or LED). An Arduino can run for more than 1 year from 2 AA cells if you use it properly. Aug 8 '20 at 20:29
• You can do this with simple hardware only to choose the alert number of Power-On minutes (POM) per hour or any other period or consecutive POM threshold. Or you can track each minute of activity to track the history if you want more details. Tilting the unit can make the door more gravity fed closure. But interference of goods might block that. Define your preference of input POM /h or consecutive POM for alarm threshold. H/W only or S/W computed? Aug 8 '20 at 21:19

Since you're monitoring a DC powered system the solution should be quite simple. Monitor the voltage to the fridge and the current consumed by it. Take a reading periodically (1s, 10s, 60s, or whatever you like) and calculate the instantaneous power (*P = V × I) and total it. If you monitor every 10 s, for example, then you can assume constant power for that interval and the energy used can be calculated by $$\ E = \frac 1 {10} VI \ \text {Ws}\$$. (That's watt-seconds.) To convert to watt-hours divide by 3600 (60 × 60).