Introduction: How to Make Arduino Thermostat
The following Arduino design functions as a 'thermostat'. You will be able to set a desired temperature and the design, in turn, will turn on a fan (LED) if the actual temperature exceeds the desired temperature. The following is a list of materials needed to make your own Arduino Thermostat.
Supplies
1. Arduino with Breadboard
2. 1 extra breadboard 3. 1 LCD Screen 4. 2 Color Resistors 5. 1 LED light 6. 1 Temperature Sensor 7. 2 Potentiometers 8. 24 Wire connectors
Step 1: Step 2: Coding
Once you have finished your build setup, you can begin your coding setup. The following is an example of the code that allows the arduino to function:
// include the library code:
#include
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("It's HOT!");
//set up the LED and temperature sensor
pinMode(10, OUTPUT);
pinMode(A0, OUTPUT);
Serial.begin(9600); }
void loop() {
float desired = (analogRead(A1)/10);
float read = analogRead(A0);
float voltage = (read*5000);
voltage /= 1024;
float degreesC = (voltage - 0.05) * 100;
float degreesF = (degreesC * (9/5)) + 32;
// set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1);
//prints desired temperature
lcd.print(desired);
lcd.setCursor(9, 1);
//prints temperature
lcd.print(degreesF);
if(degreesF > desired) {
digitalWrite(10, HIGH); //turns LED on
}else{
digitalWrite(10, LOW); //turns LED off
}
}
Attached to this instructable is a working download of this project.
Comments