This is my work in building an Arduino based digital thermostat for controlling my DIY kegerator.

The project is based around the Arduino and uses a LM35 sensor for temperature measurement, a solid state relay for turning on/off the refrigerator, and a serial LCD panel for displaying the temperature inside the fridge and a handy-dandy button to turn the back-light on for reading beer temperature in the dark! WoW!! .

I consider this v1.0 and plan to update this instructable as I add new and fun things that make beer drinking more pleasurable... as if that can really happen!

Special thanks to Brutus @ brutusweb.com from his proof of concept work, Sean Coates for his advanced work with beer brewing and Arduinos, and an Extra Special thanks to Mikal Hart @ the Arduino Forums who helped me through my coding nightmares!...( I owe him a few beers).

Step 1: Getting the Goods.....

Things we will need to get this project off the ground:

-An Arduino or a variant of ...
I used a spare Freeduino SB that I had, I like the miniUSB port.
-A serial LCD panel.
I used a SLCD162 MeLabs
Serial LCD is important since it uses only 1 pin on the Arduino!!
-A Solid State Relay:
I used a NTE RS1-1D4-21,( 15 bucks a piece..) it is circuit board mounted type and I designed my own circuit board to support it.
You can use any similar relay but it must have a trigger voltage of at least 5 volts on the DC side, and can handle around 3 amps or what ever amperage your refrigerator or freeze draws plus extra for head room. You will have to use a bread board or design your own circuit board if you use any other type.
-A LM35DZ temperature sensor.
I bought a few off of Ebay from Thailand for super super cheap, like 5 bucks including shipping... did I mention they were from Thailand? crazy! www.thaishopetc.com
-A couple of resistors:
10k and 100k, 1/4 or 1/2 watt will work fine.
-Project Box:
if you want to protect your circuits from the elements (or drunks) Mine is a standard Radio Shack box, but you can be more creative.
-22 Gauge stranded wire:
The more colors the better. Makes it easy to know what goes where.
if you want to make a cool LCD stand like me
for the cool LCD stand and project box
-Header Pins and Connectors:
for easily connecting the wires to the Arduino, not necessary but makes things look nice.
-Momentary Push Button:
for the LCD backlight function. This is a "normally off" button and is only "ON" when it is held down
-Terminal blocks , 2 position type, PCB mounting
-Heavy gauge extension cord (14 gauge or so)
-Cat5 cable for LCD connection + Cat5 jack

Soldering iron
Heat gun
PCB board and etchant
Gerber Multi-tool
....more Beer

Awesome job. Bonus points for etching your own board too! Glad to see it's in a nice display case.<br><br>A word of warning to anyone who tries to replicate the push button portion based on the picture. Is that a mistake with the pull resistor for the push button? This looks like pushing the button would short '5v' to 'gnd', which wouldn't be great. Instead of the the switch connecting to the 5V side of the resistor, instead connect it to the digital_pin3 side of the resistor. That way, it will pull the digital pin3 to gnd when pushed, and the resistor will pull D3 up to 5V when button is released.<br><br>I'm sure the real design is correct, and the focus of the attention isn't on the pushbutton, but hope no one shorts out their arduino's 5V to gnd with this. :)
Greetings,<br>I'll investigate your observations more closely,as it was a few years ago I made this project and haven't had any issues during this time. Pulling a pin high or low can be done on either leg of the switch.. the current flowing to Dig_pin3 is 5volts which is not a problem for the pin to handle... the amperage is only .0005 through the 10k resistor. If the resistor was on the Grd side of the switch and the button was pushed, then the same amount of current (5v) will still flow to the pin 3. The Arduino chip is designed to read data in the form of 0v -5v on the digital and analog pins... so I'm not sure what your concern is?<br>Thanks for the comment, I love feedback as it helps me to continue to learn and grow!
Hi. I hope I'm not looking at the pic wrong.<br>I'm talking about the pic in Step 1.<br>It looks like the backlight button is connected to 5V and Gnd.<br>That doesn't threaten Dig_pin3, but if it shorts 5V and Gnd together when pushed, that sounds bad for the 5V power. A short-circuit to gnd will pull as much current from 5V as the possible (assuming the wires &amp; pushed-switch are all quite low resistance).<br>Well, I'm also assuming this switch works like mine... open circuit normally, and short circuit when pushed.<br>So, no concern about arduino data pins. Concern is that pushing switch will connect the red &amp; green wires (5v &amp; gnd) together.<br>
Just remember that we are talking about DC power here, electrons flowing from positive to neg. Let me explain that part of the circuit a little clearer... the 5v current is flowing to the switch and to digpin3 through the 10k resistor. Because the switch is normally closed the current just flows to the arduino pin3 and it is read by the software a HIGH (5V's), but when the button is pressed, the current flows the path of least resistance and flows straight to ground, causing the digpin3 to have 0 V's which the arduino reads as LOW (which signals an event to turn the backlight on in the code). <br> DC current flows from + to - ... what you would refer to as &quot;shorting out&quot;.... (that is more of an AC term). Think of this... as a kid I would wrap a big nail in a length of wire and then attach one end of the wire to each side of a battery (+ &amp; -), thus creating a homemade electromagnet. The wire connects the + and - sides together, straight through... and because Electrons flow from high concentrations to low concentrations we have current! <br> If you cross AC wires then you can get a big mess! (15A's of power compared to 50Ma's with DC) ... DC only works when you cross the wires because current has to flow to be useful!! <br> But back to the Aurduino... if I had the same circuit with 12V's instead of 5V then I would blow out the pins of the aurduino and short the board out... other than that its okay! I hope this helps...<br>Cheers!
Thanks for taking the time to explain, it's very cool &amp; generous of you.<br> But, this stuff is actually my profession, so I'm just trying to help since you took the time to make a good instructable, and so I want to pay back since I've been too lazy to make instructables myself (yet). Plus, I'm a fellow new homebrewer! :)<br> <br> First, don't take my word for it.<br> Ask a friend you trust, or check out the web, like:<br> http://en.wikipedia.org/wiki/Pull-up_resistor<br> <br> Thanks again for the good instructable &amp; cool responses. &nbsp;-Brian<br> <br> PS: BTW, if you are planning to revisit, I'd recommend referring to Figures 3 &amp; 7 in the LM35.pdf spec.<br> Figure 7 shows how to get accurate measurements under 2 deg C without a V- (negative voltage) available, and<br> Figure 3 is good insurance since you're putting the LM35 at the end of a longish wire or cable.<br> <br> PPS: if you want to know more about what is probably happening in your ckt, or the magnet you describe, or other circuit equations, I can explain more. But perhaps you'd like to see for yourself first.<br> &nbsp; &nbsp;If so, start by using a volt meter and measuring the voltage of your 5V while pushing the switch. Arduino would like it's 5V to stay 5V, but I'd bet the voltage drops, a lot, but it depends on how much current/power your 5V supply can produce, and how much resistance your particular switch has when pushed.<br> &nbsp; &nbsp;(I wondered if maybe you have a switch with a relatively large resistance when pushed, but as you describe, in order for the dig_pin3 to see a 'low' voltage, the 5V attached to it's resistor must go 'low'. So that 5V supply wants to take the easy route, thru your switch, instead of going thru the arduino &amp; other ckts. The switch draws SO much current from the source that your source can't keep up the 5V, and droops to a lower voltage.<br> &nbsp; &nbsp;If it didn't, then something is probably getting hot (the switch?) and providing enough resistance to keep things from actually going worse.) Another way to describe that you don't have a (normal &amp; safe) pullup ckt... the dig_pin3 never has current going thru it, so current never goes thru the R attached in your ckt, so the R has no effect (ignoring transient effects). i.e. it's not acting as a pullup resistor.<br> <br> PPPS: Check out&nbsp;http://www.dorkbotpdx.org/wiki/pcb_order . &nbsp;It's a sweet (&amp; cheap!) way to make real boards with finer geometries, vias, etc, without having to etch blanks yourself.<br> You can use eagle design software (free) for smallish 2-layer boards. &nbsp;There's a lot of tutorials &amp; etc for the Eagle (like on sparkfun.com), but the dorkbotpdx dude running the board program is doing something awesome. &nbsp;I've got a lot of 50 5V relays (10A at 125V) that I'm planning to make a simple board for. &nbsp;Just enough for screw-connections (for the AC), the switch, and a transistor so that the arduino digital out isn't trying to drive the relay by itself (the relay coil needs a lot of current to switch on). &nbsp;If I find a cheap optocoupler, might use that too, for extra safety. &nbsp;Hope to use these like you did, but use 2: 1 for heating pad (now that winter's coming) and 1 for the freezer I found that I can fit my fermenter in.<br> <br> Happy brewing! &nbsp;Cheers!
Thanks for all the links, seems I have a bit of reading to catch up on. I found this tutorial about implementing a proper pull-up resistor in my circuit.. <a href="http://www.ladyada.net/learn/arduino/lesson5.html" rel="nofollow">PULL-UP</a> (see figure 5.6), seems as though I should have a 100 ohm in place of the 10K and move the 10k in between the 5v and 100ohm resistor going to the digpin. Makes more sense to me seeing the schematic now.. what I currently have works but isn't as accurate and reliable as how it's explained in the tutorial.&nbsp;<br> <br> I've been considering ditching the LM35 in favor of either the LM36(TMP36) because of its -50 to 125 C range or maybe even the Dallas DS18B20 1 wire version. Adafruit.com has both, but has a waterproof version of the DS18B20 that might hold up better in an environment that has condensation and possible beer spills.<br> <br> Thanks again for all the comments... this isn't my profession, just a long time hobby built out of love for electricity.<br> <br> One of my friends designs and builds temp controllers which he sells as kits. I've thought about scraping my project and picking up one of his kits since they are so simple to program and use.... and best of all.. they just work!<br> <a href="http://screwdecaf.cx/yatc.html" rel="nofollow">http://screwdecaf.cx/yatc.html</a><br>
For Fahrenheit, try changing:<br> temp = lm35_val;<br>to:<br> temp = (lm35_val*1.8)+32;<br>
Thanks for the tip!<br>I recently pulled out this project and started rewriting the code for better temp sampling and stability. I started home brewing recently and have need to have my beer fermenting at precise temperatures....I hope to have the updated code posted soon.
Only slightly off topic; how exactly did you bend down the cooler? Is the tube metal or some type plastic? I have a very similar fridge that I use for a home-brew kegerator but have to use 3 gal cornys because of the restricted height. Thanks
do you have any photos on how you attached the LM35 to the beer line?
I didn't attach the LM35 to the beer line. I just experimented with different placements in the fridge to find the best equilibrium for the internal temperature. Too close to the coil would give a colder reading, so I opted for nearer towards the front by the door... it's kind of trial and error I think....<br />
ah.&nbsp; cool.&nbsp; I was thinking about adding a T-connector to my beer line and dangle out a bit of tubing that I could then have the LM35 sitting in.&nbsp; that way, as the beer flowed out, it would hit the LM35 on the way by the t-connector.&nbsp; I would have it secured in the tubbing (dongle) with some food safe silicon.<br /> <br /> that would give me the actual temp of the beer.
Looks good! Glad to be of help to somebody out there. Now If I can just get someone to send me a free mini-fridge I can pull that project out again ;-)
Cruise by your local college near the end of the semester. You should be able to pick up a mini-fridge for $10!
Hi, Great circuit. I will definalty build one for my kegalator. What I am also looking for is a similar controller for my fridge that I ferment my home brew beer in. I require temperatures ranging from 0 C to 30 C. This means I need to controll a heater mat in the fridge as well. Any Ideas on this?
Repeat the code with and output for an SSR connected to the heater mat. Just make sure that you build in a few degrees of deadband so the two aren't fighting each other. You may also want to add a couple of additional buttons to increase and decrease the temperature setpoint so you don't have to recode every time that you want a new temp set. Another way to do it would be to pick up a digital thermostat and wire it into an SSR or control relay. But, it might be tough to find one with the range that you need.
Awesome. This is exactly what I need as I'm adapting a deep freeze as a 3 corney kegorator as well as a fermenting fridge that will also need better a better thermostat. My question is, do you feel you need the LCD readout once everything is tested and running properly? For aethstetic and simplicity's sake, I'd prefer to not have a temp readout, unless I'm connected to a computer. Does your system work consistently, once set up?
In reading through your code, I'm not sure if there's a "time delay" feature for the compressor or if you're simply bypassing the thermostat contacts (which should cover it...maybe). Refrigerator compressors typically shouldn't be restarted immediately after they've shut down (too much current draw) and there is a built -in delay of a minute or two in case the unit is unplugged/power outage etc. An internal "wait" plus an initial "wait" loop would cover it if you think it's necessary.
This is good you mentioned this up front here!<br/><br/>I built a functionally near-identical (but messier) fridge unit using a chest freezer, PIC, SSR and an I2C thermometer chip.<br/><br/>I tried to figure out for ages why the compressor would periodically lock up and fail to start. I thought the $0 freezer was just a piece of junk. <br/>One day I had a chat with a fridge guy and he said I needed a time delay for the pressure to dissipate in the compressor.<br/><br/>He said it needs a wait of at least 15 minutes to be safe. Unfortunately, I lazily didn't socket the PIC, and can't update the code, so what I do is slowly ramp the temperature down by hand after adding a new keg.<br/><br/>However I'm going to build a new setup soon using some one-wire sensors to track the temperature of the fridge as well as both kegs of beer. I had a few issues with beer freezing on the bottoms of the kegs, so I'm going to add a &quot;beer about to freeze override&quot; system, as well as a compressor start delay.<br/><br/>Also maybe some strain gauges from a dead scale to measure the weight of the remaining beer? 1L beer = ~1kg...<br/><br/>I got 2 5-gallon kegs of local stout in there right now, yum! Enjoy your fridge, silverhalo!<br/>
This is good information to know. I'll definitely take a look into this and see what I can come up with to fix this. Thanks!
Hmm, just an idea, but if you wanted, you could put a solenoid valve in the pipeline going to the tap and have a second "press to drink" button under the LCD.

About This Instructable


55 favorites


Bio: Jack of all trades, master of none, Sigh...... how does one get good at something when there are so many things in this world to ... More »
More by silverHalo: Retro Atari 7800 Mod: Sega Master System controller to Atari 2600/7800 hack Digital Thermostatic Beer Refreshment Regulator DIY Rat Clone Distortion Guitar Effect Pedal - The Dead RAT
Add instructable to: