Monday, March 19, 2012

The Arduino Thermostat

I've talked about this before, but since I just built another one last week, I thought I'd reshare this project, as it has a slight twist.

The idea is to select the temperature you want with a potentiometer, and display it on the screen. Then the Arduino reads a Dallas 18B20 digital temperature chip (or a thermocouple for higher temperature needs, like a temperature controlled soldering station) and controls a SSR (with a heater or A/C attached) to match the temperature requested. When the temperature chip reads the same as the requested temperature, then the power to the heating or cooling device is turned off.


This project has many applications, from room temperature control, to water heaters, or even environmental chambers. The concept is the same. With the addition of a RTC, you can easily program day night setbacks or even weekend setbacks. With a second temp sensor outdoors, you can add a offset based on outdoor temperature, i.e. increase indoor temperature by 5 F if outdoor is <30, and decrease indoor by 5 F if outdoor is >90.

I've covered some of these concepts before at Two DS18B20 Temp Sensors on LCD Display!

Most of the parts needed to make this unit are available at Hacktronics:
Arduino Uno
LCD Display
Dallas 18B20

10 amp 24-330vac load, 4-32vdc control (opto isolated) SSR

Download the two sketches, a low temp dallas chip version, and a high temp thermocouple version!




11 comments:

  1. hi,
    would love to make this project, i cant seem to get the sketch to work using the ds18b20.

    can you tell me how to set it up please

    thank you

    (id past the errors but cant copy and past them)

    ReplyDelete
  2. Did you get the OneWire.h and the DallasTemperature.h libraries? Are you using Arduino 1.0 or higher? There's a new version of the library. See http://arduinotronics.blogspot.com/2012/03/dallas-ds18b20-temperature-chip.html

    Did you run the discover ID sketch first to get the ID of your temp sensor? Without error codes, I can't tell what your problem is, but verify the above, and if it still does not work, post your errors, sketch and schematic at http://tech.groups.yahoo.com/group/arduinohome/

    ReplyDelete
  3. hi steve,
    im running 1.0.1, i havnt found the discovery id sketch yet. im not sure how to put everything together can you show me please?

    thank you


    these are the errors im getting

    sketch_jun10a:2: error: variable or field 'printTemperature' declared void
    sketch_jun10a:2: error: 'DeviceAddress' was not declared in this scope
    sketch_jun10a:27: error: 'OneWire' does not name a type
    sketch_jun10a:30: error: 'DallasTemperature' does not name a type
    sketch_jun10a:32: error: 'DeviceAddress' does not name a type
    sketch_jun10a.cpp: In function 'void setup()':
    sketch_jun10a:38: error: 'sensors' was not declared in this scope
    sketch_jun10a:40: error: 'insideThermometer' was not declared in this scope
    sketch_jun10a.cpp: At global scope:
    sketch_jun10a:52: error: variable or field 'printTemperature' declared void
    sketch_jun10a:52: error: 'DeviceAddress' was not declared in this scope

    ReplyDelete
  4. Make sure you downloaded the 1.0+ versions of the two libraries. You need to read http://arduinotronics.blogspot.com/2010/11/determining-your-dallas-1-wire-address.html on how to determine what address your DS18B20 is.

    ReplyDelete
  5. hi steve
    thanks i now have my address nearly there thank you

    ReplyDelete
  6. thanks got it going, now to change Fahrenheit to Celsius!

    ReplyDelete
  7. If you look at the Hacktronics tutorial, Celsius is what comes out, and we calculate Fahrenheit.

    http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html

    ReplyDelete
  8. When the set temp is displayed on the LCD it has a funny format. Ie...00ff, 20ff, 70n, 80n.... Can you tell me how to fix this to display tempuraturres?

    ReplyDelete
  9. did you use my code exactly? is it wired the same? post schematic, pics, code, etc. to the discussion group so we can see what you have done. http://tech.groups.yahoo.com/group/arduinohome/

    ReplyDelete
  10. Nice project well thought out.

    However why have this blog and then insist on using the yahoo crap to download your files. This is so counter intuitive; why not just have everything in one place. Please upload your code here. I personally can’t stand Yahoo and will refuse to use it. There are so many better places, for example your blog.

    ReplyDelete
  11. Blogspot has severe limits on file storage and uploads. Yahoo groups are an ideal place to discuss these projects. I do sometimes place the code here, but it's easier to find in the files section of the discussion group.

    ReplyDelete