WATER HEATER (WATERBATH)

This is an example of applying a temperature sensor PT100 to control a water heater.
For a simpler sensor you can use waterproof DS18S20, see on https://arduinoproyek.wordpress.com/water-heater-ds18s20/

waterbath

The code can be downloaded at:

https://github.com/triantara/ARDUINO-TRIANTARA/blob/main/WaterHeaterPT100.zip

//we use infrared remote control for temperature setting

#include <EEPROM.h>

#include <LiquidCrystal.h>

int pinIncrease = 2; //pin increase button

int pinDecrease = 3; //pin decrease button

int pinHeater = 11; // go to relay input

int pinIND = 13; // LED heating indicator

int pinSetting = 10; // setting temperature button key

int SettingSuhu = 0;

byte BatasSuhu;

//—————————temp section

#include <Wire.h>

#include <Adafruit_ADS1015.h>

Adafruit_ADS1115 ads(0x48);

int temp0;

//—————————temp section

LiquidCrystal lcd(4, 5, 6, 7, 8, 9);//order number : RS,EN,D4,D5,D6,D7

#include <IRremote.h>

int RECV_PIN = 12;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {

Serial.begin(9600);

irrecv.enableIRIn(); // Start the receiver

lcd.begin(16, 4);

//—————————temp section

ads.begin();

//—————————temp section

pinMode(pinIncrease, INPUT);

pinMode(pinDecrease, INPUT);

pinMode(pinSetting, INPUT);

pinMode(pinHeater, OUTPUT);

pinMode(pinIND, OUTPUT);

digitalWrite(pinIncrease, HIGH);

digitalWrite(pinDecrease, HIGH);

}

unsigned long last = millis();

void loop() {

SettingSuhu = constrain(SettingSuhu, 0, 255);

if (irrecv.decode(&results)) {

if (results.value == 0xEF1020DF) {

SettingSuhu++;

EEPROM.write(1, SettingSuhu);

}

else if (results.value == 0xEF10A05F) {

SettingSuhu–;

EEPROM.write(1, SettingSuhu);

}

irrecv.resume(); // Receive the next value

}

int16_t adc0; // we read from the ADC, we have a sixteen bit integer as a result

adc0 = ads.readADC_SingleEnded(0);

temp0 = adc0;

float suhu = (temp0*0.030705394)-364.87967;//from calabration plot

BatasSuhu = EEPROM.read(1);

heater();

Serial.print(BatasSuhu);

Serial.print(” “);

Serial.print(suhu);

Serial.print(” “);

Serial.println(temp0);

lcd.clear();

lcd.setCursor(0, 0);

lcd.print(“SETT :”);

lcd.setCursor(7, 0);

lcd.print(BatasSuhu);

lcd.setCursor(0, 1);

lcd.print(“TEMP :”);

lcd.setCursor(7, 1);

lcd.print(suhu);

lcd.setCursor(0, 2);

lcd.print(“READ :”);

lcd.setCursor(7, 2);

lcd.print(temp0);

delay(100);

}

void heater(){

float suhu = (temp0*0.030705394)-364.87967;//from calabration plot

if(suhu < BatasSuhu){

digitalWrite(pinHeater, HIGH);

digitalWrite(pinIND, HIGH);

}else{

digitalWrite(pinHeater, LOW);

digitalWrite(pinIND, LOW);

}

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s