Thursday, August 17, 2017

Project III - 10. Thermostat over 100 degree with 3 Additional Button based on Arduino

Thermostat over 100 degree with 3 Additional Button


Thermostat is a tool used to maintain the temperature of an object or room in accordance with the set point that has been determined. The temperature will be read by a thermocouple sensor that can read temperatures over 100 ° C and the results are displayed on the LCD. While set point can be set by using 3 button. The heater / controller in its ON / OFF control uses a relay connected to the Arduino output pin.

Hardware Requirement
  • Arduino Uno Board
  • Thermocouple Sensor include with MAX6675 Driver
  • Relay 1 Channel
  • Element Heater
  • Push Button 3
  • LCD 16*2
  • Power supply +5 Volt
  • Jumper
Thermocouple Tipe K and Driver MAX6675 | Source



 Element Heater | Source                     Relay 1 Channel | Source


Block Diagram



Schematic




Arduino - LCD Wiring


Arduino - Driver MAX6675 Wiring


Arduino - Push Button Wiring


Arduino - Relay Wiring

Source Code/Sketch


#include <max6675.h>
#include <Wire.h>
#include <LiquidCrystal.h>
int DO = 8;
int CS = 9;
int CLK = 10;
MAX6675 themp(CLK, CS, DO);
int SET = 11;
int UP = 12;
int DOWN = 13;
int HEATER = A0;
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
byte derajat[8] = {140,146,146,140,128,128,128,128};
int adc,T,setPoint;
byte setSP, f_awal;
long lastButton = 0;
long delayAntiBouncing = 50;
void setup(){
pinMode(HEATER,OUTPUT);
pinMode(SET,INPUT);
pinMode(UP,INPUT);
pinMode(DOWN,INPUT);
digitalWrite(SET,HIGH);
digitalWrite(UP,HIGH);
digitalWrite(DOWN,HIGH);
lcd.createChar(0, derajat);
lcd.begin(16, 2);
lcd.print(" Thermostat ");
lcd.setCursor(0, 1);
lcd.print(" 0 C s/d 200 C");
lcd.setCursor(2,1);
lcd.write((byte)0);
lcd.setCursor(12,1);
lcd.write((byte)0);
delay(2000);
lcd.clear();
setPoint=100;
}
void loop(){
lcd.setCursor(0,0);
lcd.print("SP=");
lcd.print(setPoint);
lcd.write((byte)0);
lcd.print("C ");
T=themp.readCelsius();
lcd.setCursor(9, 0);
lcd.print("T=");
lcd.print(T);
lcd.write((byte)0);
lcd.print("C ");
if(T<(setPoint-1) || f_awal==0){
lcd.setCursor(0,1);
lcd.print("Heater ON ");
digitalWrite(HEATER,HIGH);
f_awal=1;
}
else if(T>=setPoint){
lcd.setCursor(0,1);
lcd.print("Heater OFF");
digitalWrite(HEATER,LOW);
}
tombol();
delay(1000);
}
void tombol(){
digitalWrite(SET,HIGH);
digitalWrite(UP,HIGH);
digitalWrite(DOWN,HIGH);
if(digitalRead(SET)==0){
lcd.clear();
lcd.print("Seting Set Point");
lcd.setCursor(9,0);
delay(1000);
lcd.clear();
setSP++;
//-----------------program looping seting set point
do{
if(digitalRead(SET)==0){
if ((millis() - lastButton) > delayAntiBouncing){
setSP++;
}
lastButton = millis();
}
else if(digitalRead(UP)==0){
if ((millis() - lastButton) > delayAntiBouncing){
setPoint++;
}
lastButton = millis();
}
else if(digitalRead(DOWN)==0){
if ((millis() - lastButton) > delayAntiBouncing){
if (setPoint>0){
setPoint--;
}
}
lastButton = millis();
}
lcd.setCursor(0,0);
lcd.print("SP=");
lcd.print(setPoint);
lcd.write((byte)0);
lcd.print("C ");
}
while (setSP<2);
setSP=0;
f_awal=0;
lcd.clear();
lcd.print("Set point OK!");
delay(1000);
lcd.clear();
}
}


How it Works

1. Connect the Arduino with Peripherals needed.
2. Plug in the Power Source on the device.

3. Add some library if needed
4. Compile and upload the script program above to your arduino.
5. First initial LCD display



6. Normal view



7. Heater will be on / off when the temperature is less then set point.
8.  Heater OFF when the temperature is equal to the set point.


9. Heater will light up again after the temperature decreases 20 C below the set point.

10. Change the setpoint by pressing the Set button



11. Press Up button to increase set point temperature or press Down button to decrease it.
12. Press Set button when the settings are done.




Video for Project III - 10. Thermostat over 100 degree with 3 Additional Button based on Arduino





Required file

No comments:

Post a Comment