Thermostat

This device takes the current room temperature, and displays the room temperature. The potentiometer on the bottom allows you to select a temperature, the LED shows if the temperature is over the desired, and the button allows you to switch between Celsius and Fahrenheit.
You will need

- two potentiometers
- an lcd screen
- a LED
- a button
- an arduino uno
- a breadboard
- a lot of wires

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Assembly

Use the attached image for assembly

Step 2: Program

int cel;
int far;
char let;
boolean cf;
int desC;
int desF;
int inputDes;
int temp;
int changeTime = 2;
float voltage;
#include

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
lcd.begin(16, 2);
pinMode(8, INPUT);
pinMode(9, OUTPUT);


}

void loop() {
voltage = getVoltage(0);
desC = (getVoltage(5) / 10) * 100;
desF = Far(desC) + 20;
inputDes = (analogRead(5) / 20.5);
cel = (voltage - 0.5) * 100;
far = Far(cel);


lcd.setCursor(0, 0); //LCD code
lcd.print("Temperature:");
lcd.setCursor(13, 0);
lcd.print(temp);
lcd.setCursor(15, 0);
lcd.print(let); //Display

lcd.setCursor(0, 1);
lcd.print("Desired:");
lcd.setCursor(9,1);
if (cf == true) {
lcd.print(desF);
lcd.setCursor(11,1);
} else {
lcd.print(desC);
lcd.setCursor(11,1);
if (desC < 10) {
lcd.print(" ");
lcd.setCursor(10,1);
}
}
lcd.print(let's);


if (cf == true) { //Temp Toggle
let = 'F';
temp = far;

} else if (cf == false) {
let = 'C';
temp = cel;
}
if (cel > desC) {
digitalWrite(8, HIGH);
} else {
digitalWrite(8, 0);
}

changeTime--;
if (analogRead(4) > 1000 && changeTime < 0) { //temp toggle input
cf = !cf;
changeTime = 2;
}
delay(150);
}

float Far (float a) { //farenheit conversion
float b = (a * (9 / 5)) + 32;
return b;
}

float getVoltage (float a) {
float b = (analogRead(a) * 0.004882814);
return b;
}

Step 3: Modification

Of course, as this is a very simple project, one could substitute some sort of motor to be controlled in place of the led. There are countless ways this could be altered for the better.

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    2 Discussions