Thermostat

This is a setup for a basic thermostat on an arduino

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: The Setup

List of Items Needed

  • Arduino Uno
  • Breadboard
  • Four Resistors - 220 Ohms
  • Potentiometer
  • LED
  • LCD Screen
  • Button
  • TMP 36 Sensor

Step 2: The Code

This is the basic setup for the code.

CODE:

#include

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

int sensorPin = 0;

int thermoPin = 1;

int Fan = 10;

int Button = 5;

void setup() {

lcd.begin(16, 2);

pinMode(sensorPin,INPUT);

pinMode(thermoPin,INPUT);

//pinMode(Button,INPUT); }

void loop() {

int reading = analogRead(sensorPin);

int thermo = analogRead(thermoPin);

float voltage = reading * 5.0;

voltage = voltage / 1024.0;

float C = (voltage - 0.5) * 100 ;

float F = (C * 9.0 / 5.0) + 32.0;

thermo = thermo * .10;

int Change = analogRead(Button);

lcd.setCursor(0,0);

lcd.println("D Temp -->");

lcd.println(thermo);

lcd.setCursor(0,1);

if(Change<1023)

{ lcd.println("Temp in F");

lcd.println(F);

} else

{ lcd.println("Temp in C");

lcd.println(C);

}

if(thermo<F)

{

digitalWrite(Fan,HIGH);

} else {

digitalWrite(Fan,LOW);

}

}

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions