Probably one of the most popular Arduino projects :). I just needed a thermostat controlled infrared (heat) lamp to keep the water installation free from frost.
The basic idea was to have an Arduino checking temperature with a thermistor. Based on some MIN and MAX temperature setting a relay (with an infrared light bulb) would be activated. With 3 leds I can indicate the state of the Arduino (LOW, MID and HIGH temp).
It took me some time to get a reasonable reading out of the thermistor. A thermistor is basically a resistor that reacts on temperature changes. That way we can read the resistance with our arduin (use AREF) and calculate a temperature. The first results were way too low, around -21 C. After some debugging I discovered I picked the wrong resistor for reference. Replaced that one and got an acceptable reading.
By far the best tutorial I found on using a thermistor with Arduino. It promotes a specific thermistor wrapped in some black plastic protection. Don’t mind that, just make sure you get the right Beta value (datasheet) and measure your resistor to double check the value. Update these in the code (take last code snippet form tutorial for best measurement) and you’re ready to go.
You can find my source code for this project here.
The thermistor isn’t perfect. Even with the smoothing (using average of multiple readings) I still get 1 C difference between successive reads. Also it seems to be a bit positive starting from around 10 C. In a later version I replaced the thermistor with a DS18B20 chip and finally got consistent read outs.
A tutorial on using the DS18B20 chip I liked. And another DS18B20 tutorial using the updated library. Note that the link metioned in that second tutorial doesn’t point to the correct updated library. I just installed one of the 2 libraries and used one of the included examples to get everything working.
And that resulted in an updated Arduino script file.
So far for input. Output is limited to 3 status leds. Check the standard Arduino samples if you don’t know how to use leds.
And a relay. The relay interrupts the 230V wire. Using a 5V power input and a signal wire to activate (high) or deactivate (low) the relay. All the information you ever wanted to know on using relays with Arduino is here. Make sure the relay can handle the power you’re going to put through it. BE CAREFUL SINCE THIS IS HIGH VOLTAGE!!
So far for what you really need. You’ll notice that my prototype board also has a bluetooth adapter. That one is used to communicate with an Android app for monitoring, logging and (some time) internet access. If you don’t need the Android connection but want to have some internet connection you can get the ethernet shield instead.