Whiteboard: Fridge thermostat (possibly beer-centric)
Coincidentally to my recent discussion of thermostats, I got a request from a co-worker today. He asked for a refrigerator that doesn’t care about the temperature of anything in the fridge except the beer. I’m not really into beer, but I know where he’s coming from.
The loose concept in the schematic, loosely based on a write-up by aliask, is a replacement for an existing fridge thermostat, or, with a little planning, could be installed in parallel with one (possibly with a selector switch). Nominally the only improvement is that you can put the temperature sensor wherever in the fridge you might like—in this case, near the beer, perhaps even taped to one of the bottles.
However, if you have something in the fridge that’s running custom firmware that you wrote and can rewrite, there are some interesting possibilities.
- If you’re like me and prefer an ice-cold soft drink, you might like a device that can get it cold very quickly. Barring the invention of more expeditious devices, like a power drill attachment that spins your can around in a bed of ice, you might consider using the above circuit in a freezer. The relay will turn off the cold before your can explodes like a counterfeit capacitor. Meanwhile, don’t keep food that must stay frozen in the same freezer—the result would not be pretty.
- If again you’re like me and you’re a little squeamish about modifying large appliances, a similar but smaller circuit could be produced with a loud buzzer in place of the relay module to let you know when the drink you put in the fridge/freezer turns cold. The buzzer should be loud enough to be audible through the thick door of the fridge. Double-check the specs of all components to make sure they’re being operated within their limits. If you’re pushing it, the thermistor can be put on long leads and the rest of the circuit could be run outboard, maybe even stuck to the outside of fridge with a magnet.
- The same circuit can be used the make any number of existing devices temperature-operated, such as fans.
- One could replace the thermistor with a photocell (a light-dependent resistor) to make finely tunable light-operated devices, such as exterior lights. In practice, such a circuit probably doesn’t require a microcontroller.
Note that in the above I haven’t specified a particular microcontroller, nor have I given it any controls besides whatever is hardcoded in the firmware. This, of course, is an exercise for the reader, but virtually any micro with a digital output pin and an analog input pin is up to the task. This includes, among many others, that of the Arduino. I imagine that two buttons (one for up and one for down) and a 2-digit LED display would be an excellent start.
It can also be done with no microcontroller at all, and in fact it’s probably easier (but more difficult to add bells and whistles to). An analog version of this circuit would replace the microcontroller with a voltage comparator and a trimmer potentiometer laid out as a voltage divider. The temp module would be placed on the non-inverting input while the trimmer voltage divider would take the inverting input. The comparator tells whether the first input is higher or lower than the second. The output would be partially fed back to one of the inputs to implement hysteresis. The result would be more similar to a traditional thermostat, because instead of firmware there is now a tuning knob!
Speaking of tuning, the coding of the ADC conversion of volts to degrees (in the digital version) or where to mark which degree numbers on the potentiometer dial (in the analog version) is a process for which there are multiple approaches. One way would be to look up the data sheet for your thermistor to find out how its resistance varies with temperature.
- For the digital version, it’s a matter of plugging the number into the voltage divider expression, Vout/Vin = L/(H + L), where H and L are the high-side (thermistor) and low-side (fixed 10K) resistors. For example, say my data sheet says 5°C (40°F) means about 25KΩ. L/(H+L) = 10K/(25K+10K) = 10/35 (about 0.29). Note that that is just the ratio Vout/Vin, not Vout itself, but many ADCs give their readings relative to Vin, so this is likely what you need. (For the curious, the reading would be about 1.43V if read using a 5.00V supply.)
- For the analog version, instead of an ADC you have a second voltage divider, the potentiometer. The set point is where the ratio of the high-side to the low-side of each potentiometer is the same. For example, if, as before, the desired set point is where the thermistor reads 25KΩ, then the ratio of high-side to low-side is 25:10, or 2.5. Therefore, the potentiometer must be set so that the span above the wiper is 2.5 times the span below. (This applies regardless of the resistance of the potentiometer itself; 5K, 10K, or 100K, among others, would work similarly, though lower resistance uses more power while higher resistance can be more sensitive to electrical noise.)