Introduction: Arduino Thermostat
The idea is simple, use an Arduino and a few simple components along with a small LCD screen to create a functioning thermostat.
But can it be done?
Read on and find out!
Step 1: Materials
Hardware
1 x breadboard. I ended up using 2 smaller ones, as you can see in the picture.
1 x Arduino Uno
1 x 16x2 LCD screen
1 x 300 ohm Potentiometer
3 x momentary switches
3 x 10k ohm resistors
1 x LED (color is your choice)
1 x temperature sensor. I used a TMP-36
Various jumper wires, around 30-40 is good.
Software
Arduino IDE
A computer
Step 2: The Code
The original code was written by Dylon Jamna and modified by me.
Modifications included customized functions and slight reworks.
The code can be found Here
Feel free to edit the program to your liking, just be sure to credit myself and Dylon for the original.
Step 3: Assemble the Board
Following the above image, the layout is relatively simple.
Remember a static free work station is highly recommended. If you're an avid electronics enthusiast and don't have an ESD wristband or work mat, get one. If this is your first, and maybe only project, a large piece of metal such as a power supply case can work fine.
Now, lets begin!
First off, attach your LCD screen to the bread board. Have the opening pins spaced from left to right as shown above. For simplicity, the left-most pin, based off the orientation above, we'll refer to as pin 1, moving right to pin 2, pin 3, and so on.
Provide power to the breadboard by running one wire from the 5V pin to the + rail on your breadboard and another wire from the GND pin on the Arduino to the other long rail on your breadboard.
Press the potentiometer into place. Run a wire from the power rail to the outermost pin, then another wire from the ground rail to the other outermost pin. Connect a wire running from the middle pin to pin 3 on your LCD screen.
Run a wire from the gnd rail to the left-most pin on your LCD, then run another wire from the power rail to pin.
Now for the rest of the LCD connections:
Connect pin 4 to pin 12 on your Arduino
Connect pin 5 to pin 11 on your Arduino
Connect pin 6 to the GND rail.
Connect pin 11 to pin 5 on the Arduino
Connect pin 12 to pin 4 on the Arduino
Connect pin 13 to pin 3 on the Arduino
Connect pin 14 to pin 2 on the Arduino
Connect pin 15 to the GND rail
and finally, Connect pin 16 to the power rail.
Now to the buttons. The process can be repeated 3 times, the only difference is where the data pin goes.
Connect the power rail to one leg of the button, then on the 2nd leg, run a data wire to pin 7 on the Arduino. On that same leg, run a 10k ohm resistor to the GND rail.
Repeat the process 2 more times, running the data wires to pins 8 and 9 on the Arduino, respectively
Press the temperature sensor into the breadboard.
With the flat side facing you, run a wire from the power rail to the left-most pin, run a wire to the GND rail on the right most pin, and run a final wire from the center pin to pin A0 on the Arduino.
Press a LED into place, with the long leg pressed into pin 13 on the Arduino.
Double check all of your connections, comparing it to either the text above, or the photo above.
Step 4: Time to Test!
Plug the Arduino into your computer via the USB cable and run the program to the Arduino.
If all was done correctly, you should now have working thermostat!
If not, refer to the next step for a short troubleshooting guide.
Step 5: Hmm... It Doesn't Seem to Work (Troubleshooting)
I myself ran into two crippling issues when creating this guide:
Q: Help! My LCD displays gibberish characters!
A: Double check all of your lead connections. Be sure that they're all going from the correct pins to the right pins on the Arduino. Also check and be sure that no bridges on the Arduino are being jumped accidentally. If that doesn't work, try replacing the wires.
Q: The buttons don't work!
A: If you have a multimeter, the simplest thing to do is turn it to continuity mode and test the button. If the button works correctly, try changing the wires. I myself spent almost 2 days running in circles trying to figure out what was wrong and it turned out to be a faulty ground wire.
If any other questions arise feel free to comment and we can try and resolve them.
Step 6: All Done!
Thanks for reading this instructable and trying out this project.
IT really means a lot.
If you made it and it was a success, click the "I Made It" button at the top of the page.
What would you change or add to this?
Was it a challenge? Maybe it was a bit too easy?
Feel free to let me know in the comments below!
Also, keep an eye out for the next instructable. It'll be a blast!
-Micah
21 Comments
Question 2 years ago
Has anyone modified this to use a K type thermocouple or the MAX6675?
7 years ago
Very nice, I took inspiration from this to build mine!
What program did you use to draw out the schematic of the breadboard?
Thanks!
Reply 2 years ago
Looks like Fritzing
5 years ago
Does this device change the temp of a room? This prodecure is very nice, and i think My grandson would love to build this.
Reply 2 years ago
The LED comes on to indicate the temperature needs to change. You can use a relay in place of the LED to activate a fan or space heater to change the temperature.
4 years ago
Would this work with an esp 32?
5 years ago on Step 2
not kod
:(
7 years ago
Do you think I would be able to use this for a digital smoker?
7 years ago
very nice.
consider using www.arduiot.com/u1
7 years ago
I have built a similar device, in my case since I'm using it in my office,
mine uses two different working temperatures, one during the day when the office is full of people and another at night when the office is empty. also stays on the colder setting during weekends when there isn't a need for the place to stay so warm.
I didn't added a know or any other way to move the temperatures. no need for that IMHO. at some point I'll upload the whole thing as an instructable or something.
Reply 7 years ago
Sounds cool. I look forward to seeing it sometime!
Reply 7 years ago
you can check the code and schematics here.
https://bitbucket.org/mcniac/dorregustato/overview
some of the comments are in spanish.
Reply 7 years ago
That's fine. I know a little bit of spanish. I'll be sure to check it out
7 years ago
This is a great start to a thermostat but when I read through the code I didn't see anything that would turn on a heater or airconditioning unit. Did I miss that part?
Reply 7 years ago
Sorry for the late reply.
In my testing, using a small DC motor caused the LCD to go berserk, so the LED on pin 13 simulates the air conditioner or heater turning on.
Reply 7 years ago
perhaps it went berserk because of flyback current from the dc motor! If you were to add a diode inline, between the DC motor and the MCU, it might fix the LCD problem.
Reply 7 years ago
Thanks for the suggestions. Only recently did I realize it might have been flyback. I have taken it apart already as I'm working on a new project but thank you none the less.
Reply 7 years ago
If you were trying to drive the motor directly off of the arduino I can understand how it might effect other components. A better option would be to have the arduino forward bias a transistor much like the circuit here. The Arduino provides the PWM signal that turns on the transistor. As the transistor forward biases current will flow from VCC through the motor and the transistor to ground causing the motor to turn. This will allow an Arduino, which cannot handle high currents, to control high current devices like motors and some relays.
7 years ago
I've been building industrial thermostats with an arduino for 5 years. Easily done. http://arduinotronics.blogspot.com/2011/05/dual-water-tank-heater-thermostat.html
Reply 7 years ago
That's amazing! It's a bit over the top for me but I love it.