Arduino LCD Thermostat!

Picture of Arduino LCD Thermostat!
In this project we'll use an arduino uno, an LCD and a temperature sensor to control your air conditioning.! Also You can modify the code for a heater. The code is well explained! I show even how I made mine permanent!  
Great your beginners to learn arduino and for hot room that have an old manual a/c. This is a project to try!
Remove these adsRemove these ads by Signing Up

Step 1: Prototyping the Test Circuit

Picture of Prototyping the Test Circuit

This circuit is to test if the thermostat is working or not. The lcd should display a hello,world! sketch, the the current temperature of the room, and below is the ideal temperature or settemp. If the current temperature is off by a little you may need to adjust the code which calculates the 10 bit number read from A0 into a temperature reading in degrees Fahrenheit. If you need Celsius will will also need to change the line of code the calculates the temperature. If you wan to control an a/c,  you can remove the led and replace it with an N-Channel MOSFET ( Metal Oxide Semi-conductor Field Effect Transistor). Then TO USE A PROTECTION DIODE!  I will go over this as well. In the next step. 

Parts list:
12 volt power supply 
7805 5 volt voltage regulator
arduino uno or other arduino dev board
3x 10k ohm resistors
jumper wire
solderless breadboard 
arduino ide
10k potentiometer ( or a 1k ohm and a 220 ohm resistor) (or the 3rd pin can go to ground) 
16x2 Hitachi driven hdd44780 LCD
10k thermistor a.k.a. (10k ohm NTC, (Negative Thermal Coefficient)
2x tactile button switches ( or any other button switch)
usb b type connector to program arduino

For use with an a/c:
N-channel MOSFET 
120VAC 20-40A relay
1N4007 - 1N4004 rectifier diode

To finalize:
perfboard / PCB
Project enclosure
And tool that everyone should have 

Let's get started!

In the code, you have

if (temp > settemp) // if the temperature exceeds your chosen settemp
digitalWrite (led, 1); // turn on the led
else // if that doesn't happen, then turn the led off
digitalWrite (led,0);

I'm guessing that turning on the LED also activates the MOSFET and turns on the A/C, correct?

My main question is this: For someone who has both a heater and an A/C, could you have it do something like this:

if (temp > settemp + 2) // if the temperature exceeds your chosen settemp
digitalWrite (led, 1); // turn on the led for the A/C circuit

elseif (temp < settemp - 2) //If the temperature exceeds your settemp


digitalWrite (led, 1); // turn on the LED for the heater circuit

else // if that doesn't happen, then turn the led off
digitalWrite (led,0);

// digitalWrite (ledX,0); //ledX would be the second led for the heater circuit

My goal with this is to replace the "heat/cool" switch on a regular thermostat, and have it be a pure climate control system (where it either turns the heat or A/C on to keep the temp at what you want). Also, I added the + 2 and - 2, because most furnaces and A/C's won't start until the temp is 2 degrees above/below your set temp. It might have to be tweaked out to 3 or 4, depending on whether your furnace and/or A/C stops before the actual temp gets more than 2 degrees from your set temp. Otherwise, your heater and a/c will constantly be turning off and on to keep your temp set.

Have a great day.:)

whiteneon8 months ago
The code is a good beginning but needs revision on the EEPROM.write command being used through every loop. EEPROM has a limited number of write cycles before it wears out. A better idea would be to only write to it periodically or only when the value to be written changes.
Dylon124 (author)  whiteneon8 months ago
I know what you mean. But I used a cheap atmega8 that can be rewriten about 10,000 times before having errors. Plus, I really new to coding up the arduino.
The easiest way to reduce the number of write cycles would be to move the 'EEPROM.write' command to a new line just below each of the
'(settemp ++);' and '(settemp --);' lines. This way the EEPROM is only being written to each time a button is being pressed.
Dylon124 (author)  gadgetiom5 months ago
thx I'll try and change my code
Dylon124 (author) 8 months ago
Add your relay pin control to pin 10-8 or else you will flick to relay on and of rapidly it the start of the code.

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!