98% finished code , subject, of course, to revision, when arrays are mastered and EEPROM used from GUI.
[code]
// rev 1 - May 30, 2022 -- Boiler Hydronic Program -- by DDDD Co.
// Items that Owner can change ///////////////////////////////////////////////////////
// Decision for DAY/NIGHT or Automatic from Timeclock program, change as needed, then upload.
int decisionTimeClock = 2; // Insert 0 for NIGHT,
// Insert 1 for DAY,
// Insert 2 for Automatic by Python TimeClock program on Raspberry Pi
// Decision for Garage valve. change as needed, then upload.
int decisionGar_Valve = 0; // insert 1 for follow the action of BDRM2ndFL valve
// Insert 0 for Closed , remember the valve can be opened my manual lever
// Decision for Laundry valve. change as needed, then upload.
int decisionLaundry_Valve = 0; // insert 1 for follow the action of BDRM1stFL valve
// Insert 0 for Closed , remember the valve can be opened my manual lever
// DAY setpoints
float DAYSetBDRM1stFL = 50; // change this as needed then upload, and saving file is automatic.
float DAYSetLivingRoom = 99; // change this as needed
float DAYSetKitchen = 71.3; // change this as needed
float DAYSetBDRM2ndFL = 98; // change this as needed
float DAYSetSouthBDRM3FL = 71.5; // change this as needed
float DAYSetNorthBDRM3FL = 71.6; // change this as needed
// NIGHT setpoints
float NIGHTSetBDRM1stFL = 61.1; // change this as needed then upload, and saving file is automatic.
float NIGHTSetLivingRoom = 61.2; // change this as needed
float NIGHTSetKitchen = 61.3; // change this as needed
float NIGHTSetBDRM2ndFL = 61.4; // change this as needed
float NIGHTSetSouthBDRM3FL = 61.5; // change this as needed
float NIGHTSetNorthBDRM3FL = 61.6; // change this as needed
// DO NOT CHANGE ANYTHING BELOW THIS LINE //////////////////////////////////////////////////
//---Apartment (BDRM1stFL)
float read1 = 0; //read 20 times and then take average of all 20
float total1 = 0; // the running total
float average1 = 0; // the average
//---
//---Living Room (LivingRoom)
float read2 = 0;
float total2 = 0; // the running total
float average2 = 0; // the average
//---
//---Kitchen (Kitchen)
float read3 = 0;
float total3 = 0; // the running total
float average3 = 0; // the average
//---
//---BDRM2ndFL (BDRM2ndFL) 2nd level
float read4 = 0;
float total4 = 0; // the running total
float average4 = 0; // the average
//---
//---SouthBDRM3FL (SouthBDRM3FL) 3rd Level
float read5 = 0;
float total5 = 0; // the running total
float average5 = 0; // the average
//---
//---NorthBDRM3FL 3rd Level (NorthBDRM3FL)
float read6 = 0;
float total6 = 0; // the running total
float average6 = 0; // the average
//---
//---HotWaterSupply from Boiler (HWS)
float read7 = 0;
//---
//---HotWaterReturn from Boiler (HWR)
float read8 = 0;
//---
//---Outside Air Temperature (OAT)
float read9 = 0;
//---
// BDRM1stFL data
int BDRM1stFLThermistorPin = 0;
int Vo1;
float logR2z1, R2z1, BDRM1stFLT;
int BDRM1stFL_Valve = 2;
int BDRM1stFLHeatState = 0;
// LivingRoom data
int LivingRoomThermistorPin = 1;
int Vo2;
float logR2z2, R2z2, LivingRoomT;
int LivingRoom_Valve = 3;
int LivingRoomHeatState = 0;
// Kitchen data
int KitchenThermistorPin = 2;
int Vo3;
float logR2z3, R2z3, KitchenT;
int Kitchen_Valve = 4;
int KitchenHeatState = 0;
// BDRM2ndFL data
int BDRM2ndFLThermistorPin = 3;
int Vo4;
float logR2z4, R2z4, BDRM2ndFLT;
int BDRM2ndFL_Valve = 5;
int BDRM2ndFLHeatState = 0;
// SouthBDRM3FL data
int SouthBDRM3FLThermistorPin = 4;
int Vo5;
float logR2z5, R2z5, SouthBDRM3FLT;
int SouthBDRM3FL_Valve = 6;
int SouthBDRM3FLHeatState = 0;
// NorthBDRM3FL data
int NorthBDRM3FLThermistorPin = 5;
int Vo6;
float logR2z6, R2z6, NorthBDRM3FLT;
int NorthBDRM3FL_Valve = 7;
int NorthBDRM3FLHeatState = 0;
// Garage (Gar) Valve. Valve opens and closes with BDRM2ndFL valve "IF" Gar decision is "1" on line 10
int Gar_Valve = 8; // otherwise, valve stays closed
int GarHeatState = 0;
// Laundry Valve. Valve opens and closes with BDRM1stFL valve "IF" Laundry decision is "1" on line 15
int Laundry_Valve = 9; // otherwise, valve stays closed
int LaundryHeatState = 0;
// HWS data
int HWSThermistorPin = 6;
int Vo7;
float logR2z7, R2z7, HWS;
// HWR data
int HWRThermistorPin = 7;
int Vo8;
float logR2z8, R2z8, HWR;
//for all zones
float diff = 1; //Change this if needed. example: if setpoint 69 and diff is 1, it will
// go on at 68.0 and go off at 70.0, so +/- is the differential.
// If diff is set for 1.5, and setpoint is 69, it will go on at 67.5
// and go off at 70.5.
float R1s1 = 10040; // thermistor divider resistor actual measured ohms by meter
float R1s2 = 10000; // --- using these actual values rather than nominal 10k improves accuracy
float R1s3 = 9920;
float R1s4 = 10030;
float R1s5 = 10070;
float R1s6 = 10020;
float R1s7 = 10000;
float R1s8 = 9990;
// these are factors required for thermistor calculations since temp vs ohm curve is non-linear
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
int timeClock = 10; //pin 10 accepts 3.3v from GPIO 14 (pin 8) from RPi4 python program for NIGHT and DAY cycles
int timeRead = 0; // digital read of input from timeclock
int led_built_in = 13; // built in led on Nano board. When lit, it indicates time clock program is calling for DAY
// if setpoints do not follow clock output, then maybe user choice on line 5 is wrong
int interReadingDelay = 100; // delayDelay in microseconds between the 20 readings for each sensor for each loop
// required because Thermistors need calculations and that causes "noise".
// the following lines are for the ninth sensor, DS18B20. I needed 9 sensors and the Arduini Nano only had 8 AO inputs
#include <OneWire.h> // the DS18B20 uses a digital input pin instead of needing an analog pin
#include <DallasTemperature.h>
// Data wire is plugged into pin 11 on the Arduino
#define ONE_WIRE_BUS 11
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
float sensorread = 0;
//end DB18B20 program
void setup() {
Serial.begin(9600);
// Start up the DB18B20 sensor library
sensors.begin();
// declare the valves as an OUTPUT: valves are closed when not powered on
pinMode (BDRM1stFL_Valve, OUTPUT);
pinMode (LivingRoom_Valve, OUTPUT);
pinMode (Kitchen_Valve, OUTPUT);
pinMode (BDRM2ndFL_Valve, OUTPUT);
pinMode (SouthBDRM3FL_Valve, OUTPUT);
pinMode (NorthBDRM3FL_Valve, OUTPUT);
pinMode (Gar_Valve, OUTPUT);
pinMode (Laundry_Valve, OUTPUT);
pinMode (led_built_in, OUTPUT); // declare led 13 as an output
pinMode (timeClock, INPUT); // declare timeClock as INPUT
// normally, Arduino (Atmega) pins default to inputs, so they don't need to be explicitly
// declared as inputs with pinMode() when you're using them as inputs.
}
void loop() {
sensors.requestTemperatures(); // Send the command to get temperature from ds18b20
Serial.println (" Hydronic Computerized Control System, DDDD Company, (C) 2022");
Serial.print(" Outside Air Temperature: ");
sensorread = ((((sensors.getTempCByIndex(0))*1.8)+32));
Serial.println(sensorread); // Why "byIndex"?
// You can have more than one IC on the same bus.
// 0 refers to the first IC on the wire
// read timeclock to decide if house is NIGHT or DAY
if (decisionTimeClock == 1) { // if line 5 is 1, DAY
timeRead = HIGH;
Serial.println(" Boiler Heat Control : House is in DAY mode by line 5 command");
Serial.println(" Temp DAY Setpoints ");
}
if (decisionTimeClock == 0) { // if line 5 is 0, NIGHT.
timeRead = LOW;
Serial.println(" Boiler Heat Control : House is in NIGHT mode by line 5 command");
Serial.println(" Temp NIGHT Setpoints ");
}
if (decisionTimeClock == 2) { // if line 5 is 2, then physical time clock decides
timeRead = digitalRead(timeClock);
}
if ((timeRead == HIGH)&&(decisionTimeClock == 2)){
digitalWrite(led_built_in, HIGH); // led on board Nano ligts up if time clock is deciding
Serial.println(" Boiler Heat Control : House is in DAY mode by clock control");
Serial.println(" Temp DAY Setpoints ");
}
if ((timeRead == LOW)&&(decisionTimeClock == 2)) {
digitalWrite(led_built_in, LOW);
Serial.println(" Boiler Heat Control : House is in NIGHT mode by clock control");
Serial.println(" Temp NIGHT Setpoints ");
}
// program for BDRM1stFL, ground level apartment
float total1 = 0;
for (int i = 0; i < 20; i++) { // take 20 readings and average them to smooth readings, typical.
Vo1 = analogRead(BDRM1stFLThermistorPin);
R2z1 = R1s1 * (1023.0 / (float)Vo1 - 1.0);
logR2z1 = log(R2z1);
read1 = (1.0 / (c1 + c2*logR2z1 + c3*logR2z1*logR2z1*logR2z1));
delay (interReadingDelay);
total1 = total1 + read1;
}
average1 = total1/20;
BDRM1stFLT = average1 - 273.15; // Kelvin temperature converted to Celsius
BDRM1stFLT = ((BDRM1stFLT * 9.0)/ 5.0) + 32.0; // Celsius converted to Farhenheit
// DAY, as determined by external timeClock or command in program
// open the valve if below the DAY setpoint less the differential
if ((BDRM1stFLT < (DAYSetBDRM1stFL-1))&&(timeRead==HIGH)) { // "HIGH" means DAY and "LOW" means NIGHT.
digitalWrite(BDRM1stFL_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the DAY setpoint plus the differential
if ((BDRM1stFLT > (DAYSetBDRM1stFL+1))&&(timeRead==HIGH)) {
digitalWrite(BDRM1stFL_Valve, LOW); // closes valve to stop hot water to zone
}
// NIGHT, as determined by external timeClock
// open the valve if below the NIGHT setpoint less the differential
if ((BDRM1stFLT < (NIGHTSetBDRM1stFL-1))&&(timeRead==LOW)) {
digitalWrite(BDRM1stFL_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the NIGHT setpoint plus the differential
if ((BDRM1stFLT > (NIGHTSetBDRM1stFL+1))&&(timeRead==LOW)) {
digitalWrite(BDRM1stFL_Valve, LOW); // closes valve to stop hot water to zone
}
BDRM1stFLHeatState = digitalRead (BDRM1stFL_Valve);
Serial.print (" BDRM1stFL: ");
Serial.print (BDRM1stFLT);
Serial.print (" SetP= ");
if (timeRead == HIGH){
Serial.print(DAYSetBDRM1stFL);
}
else{
Serial.print(NIGHTSetBDRM1stFL);
}
if (BDRM1stFLHeatState == LOW ){
Serial.println (" Valve is Closed ");
}
else{
Serial.println (" Valve is Open ");
}
// program for LivingRoom, LivingRooming room
float total2 = 0;
for (int i = 0; i < 20; i++) {
Vo2 = analogRead(LivingRoomThermistorPin);
R2z2 = R1s2 * (1023.0 / (float)Vo2 - 1.0);
logR2z2 = log(R2z2);
read2 = (1.0 / (c1 + c2*logR2z2 + c3*logR2z2*logR2z2*logR2z2));
delay (interReadingDelay);
total2 = total2 + read2;
}
average2 = total2/20;
LivingRoomT = average2 - 273.15; // Kelvin temperature converted to Celsius
LivingRoomT = ((LivingRoomT * 9.0)/ 5.0) + 32.0; // Celsius converted to Farhenheit
// DAY, as determined by external timeClock
// open the valve if below the DAY setpoint less the differential
if ((LivingRoomT < (DAYSetLivingRoom-1))&&(timeRead==HIGH)) {
digitalWrite(LivingRoom_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the DAY setpoint plus the differential
if ((LivingRoomT > (DAYSetLivingRoom+1))&&(timeRead==HIGH)) {
digitalWrite(LivingRoom_Valve, LOW); // closes valve to stop hot water to zone
}
// NIGHT, as determined by external timeClock
// open the valve if below the NIGHT setpoint less the differential
if ((LivingRoomT < (NIGHTSetLivingRoom-1))&&(timeRead==LOW)) {
digitalWrite(LivingRoom_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the NIGHT setpoint plus the differential
if ((LivingRoomT > (NIGHTSetLivingRoom+1))&&(timeRead==LOW)) {
digitalWrite(LivingRoom_Valve, LOW); // closes valve to stop hot water to zone
}
LivingRoomHeatState = digitalRead (LivingRoom_Valve);
Serial.print (" LivingRoom: ");
Serial.print (LivingRoomT);
Serial.print (" SetP= ");
if (timeRead == HIGH){
Serial.print(DAYSetLivingRoom);
}
else{
Serial.print(NIGHTSetLivingRoom);
}
if (LivingRoomHeatState == LOW ){
Serial.println (" Valve is Closed ");
}
else{
Serial.println (" Valve is Open ");
}
// program for Kitchen, Kitchenchen
float total3 = 0;
for (int i = 0; i < 20; i++) {
Vo3 = analogRead(KitchenThermistorPin);
R2z3 = R1s3 * (1023.0 / (float)Vo3 - 1.0);
logR2z3 = log(R2z3);
read3 = (1.0 / (c1 + c2*logR2z3 + c3*logR2z3*logR2z3*logR2z3));
delay (interReadingDelay);
total3 = total3 + read3;
}
average3 = total3/20;
KitchenT = average3 - 273.15; // Kelvin temperature converted to Celsius
KitchenT = ((KitchenT * 9.0)/ 5.0) + 32.0; // Celsius converted to Farhenheit
// DAY, as determined by external timeClock
// open the valve if below the DAY setpoint less the differential
if ((KitchenT < (DAYSetKitchen-1))&&(timeRead==HIGH)) {
digitalWrite(Kitchen_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the DAY setpoint plus the differential
if ((KitchenT > (DAYSetKitchen+1))&&(timeRead==HIGH)) {
digitalWrite(Kitchen_Valve, LOW); // closes valve to stop hot water to zone
}
// NIGHT, as determined by external timeClock
// open the valve if below the NIGHT setpoint less the differential
if ((KitchenT < (NIGHTSetKitchen-1))&&(timeRead==LOW)) {
digitalWrite(Kitchen_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the NIGHT setpoint plus the differential
if ((KitchenT > (NIGHTSetKitchen+1))&&(timeRead==LOW)) {
digitalWrite(Kitchen_Valve, LOW); // closes valve to stop hot water to zone
}
KitchenHeatState = digitalRead (Kitchen_Valve);
Serial.print (" Kitchen: ");
Serial.print (KitchenT);
Serial.print (" SetP= ");
if (timeRead == HIGH){
Serial.print(DAYSetKitchen);
}
else{
Serial.print(NIGHTSetKitchen);
}
if (KitchenHeatState == LOW ){
Serial.println (" Valve is Closed ");
}
else{
Serial.println (" Valve is Open ");
}
// program for BDRM2ndFL, on middle level of house
float total4 = 0;
for (int i = 0; i < 20; i++) {
Vo4 = analogRead(BDRM2ndFLThermistorPin);
R2z4 = R1s4 * (1023.0 / (float)Vo4 - 1.0);
logR2z4 = log(R2z4);
read4 = (1.0 / (c1 + c2*logR2z4 + c3*logR2z4*logR2z4*logR2z4));
delay (interReadingDelay);
total4 = total4 + read4;
}
average4 = total4/20;
BDRM2ndFLT = average4 - 273.15; // Kelvin temperature converted to Celsius
BDRM2ndFLT = ((BDRM2ndFLT * 9.0)/ 5.0) + 32.0; // Celsius converted to Farhenheit
// DAY, as determined by external timeClock
// open the valve if below the DAY setpoint less the differential
if ((BDRM2ndFLT < (DAYSetBDRM2ndFL-1))&&(timeRead==HIGH)) {
digitalWrite(BDRM2ndFL_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the DAY setpoint plus the differential
if ((BDRM2ndFLT > (DAYSetBDRM2ndFL+1))&&(timeRead==HIGH)) {
digitalWrite(BDRM2ndFL_Valve, LOW); // closes valve to stop hot water to zone
}
// NIGHT, as determined by external timeClock
// open the valve if below the NIGHT setpoint less the differential
if ((BDRM2ndFLT < (NIGHTSetBDRM2ndFL-1))&&(timeRead==LOW)) {
digitalWrite(BDRM2ndFL_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the NIGHT setpoint plus the differential
if ((BDRM2ndFLT > (NIGHTSetBDRM2ndFL+1))&&(timeRead==LOW)) {
digitalWrite(BDRM2ndFL_Valve, LOW); // closes valve to stop hot water to zone
}
BDRM2ndFLHeatState = digitalRead (BDRM2ndFL_Valve);
Serial.print (" BDRM2ndFL: ");
Serial.print (BDRM2ndFLT);
Serial.print (" SetP= ");
if (timeRead == HIGH){
Serial.print(DAYSetBDRM2ndFL);
}
else {
Serial.print(NIGHTSetBDRM2ndFL);
}
if (BDRM2ndFLHeatState == LOW ){
Serial.println (" Valve is Closed ");
}
else {
Serial.println (" Valve is Open ");
}
// program for SouthBDRM3FL room, on top level, south side
float total5 = 0;
for (int i = 0; i < 20; i++) {
Vo5 = analogRead(SouthBDRM3FLThermistorPin);
R2z5 = R1s5 * (1023.0 / (float)Vo5 - 1.0);
logR2z5 = log(R2z5);
read5 = (1.0 / (c1 + c2*logR2z5 + c3*logR2z5*logR2z2*logR2z5));
delay (interReadingDelay);
total5 = total5 + read5;
}
average5 = total5/20;
SouthBDRM3FLT = average5 - 273.15; // Kelvin temperature converted to Celsius
SouthBDRM3FLT = ((SouthBDRM3FLT * 9.0)/ 5.0) + 32.0; // Celsius converted to Farhenheit
// DAY, as determined by external timeClock
// open the valve if below the DAY setpoint less the differential
if ((SouthBDRM3FLT < (DAYSetSouthBDRM3FL-1))&&(timeRead==HIGH)) {
digitalWrite(SouthBDRM3FL_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the DAY setpoint plus the differential
if ((SouthBDRM3FLT > (DAYSetSouthBDRM3FL+1))&&(timeRead==HIGH)) {
digitalWrite(SouthBDRM3FL_Valve, LOW); // closes valve to stop hot water to zone
}
// NIGHT, as determined by external timeClock
// open the valve if below the NIGHT setpoint less the differential
if ((SouthBDRM3FLT < (NIGHTSetSouthBDRM3FL-1))&&(timeRead==LOW)) {
digitalWrite(SouthBDRM3FL_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the NIGHT setpoint plus the differential
if ((SouthBDRM3FLT > (NIGHTSetSouthBDRM3FL+1))&&(timeRead==LOW)) {
digitalWrite(SouthBDRM3FL_Valve, LOW); // closes valve to stop hot water to zone
}
SouthBDRM3FLHeatState = digitalRead (SouthBDRM3FL_Valve);
Serial.print (" SouthBDRM3FL: ");
Serial.print (SouthBDRM3FLT);
Serial.print (" SetP= ");
if (timeRead == HIGH){
Serial.print(DAYSetSouthBDRM3FL);
}
else {
Serial.print(NIGHTSetSouthBDRM3FL);
}
if (SouthBDRM3FLHeatState == LOW ){
Serial.println (" Valve is Closed ");
}
else {
Serial.println (" Valve is Open ");
}
// program for 3rd Fl NorthBDRM3FL, on top level, north side
float total6 = 0;
for (int i = 0; i < 20; i++) {
Vo6 = analogRead(NorthBDRM3FLThermistorPin);
R2z6 = R1s6 * (1023.0 / (float)Vo6 - 1.0);
logR2z6 = log(R2z6);
read6 = (1.0 / (c1 + c2*logR2z6 + c3*logR2z6*logR2z6*logR2z6));
delay (interReadingDelay);
total6 = total6 + read6;
}
average6 = total6/20;
NorthBDRM3FLT = average6 - 273.15; // Kelvin temperature converted to Celsius
NorthBDRM3FLT = ((NorthBDRM3FLT * 9.0)/ 5.0) + 32.0; // Celsius converted to Farhenheit
// DAY, as determined by external timeClock
// open the valve if below the DAY setpoint less the differential
if ((NorthBDRM3FLT < (DAYSetNorthBDRM3FL-1))&&(timeRead==HIGH)) {
digitalWrite(NorthBDRM3FL_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the DAY setpoint plus the differential
if ((NorthBDRM3FLT > (DAYSetNorthBDRM3FL+1))&&(timeRead==HIGH)) {
digitalWrite(NorthBDRM3FL_Valve, LOW); // closes valve to stop hot water to zone
}
// NIGHT, as determined by external timeClock
// open the valve if below the NIGHT setpoint less the differential
if ((NorthBDRM3FLT < (NIGHTSetNorthBDRM3FL-1))&&(timeRead==LOW)) {
digitalWrite(NorthBDRM3FL_Valve, HIGH); // opens valve to allow hot water to zone
}
// close the valve if above the NIGHT setpoint plus the differential
if ((NorthBDRM3FLT > (NIGHTSetNorthBDRM3FL+1))&&(timeRead==LOW)) {
digitalWrite(NorthBDRM3FL_Valve, LOW); // closes valve to stop hot water to zone
}
NorthBDRM3FLHeatState = digitalRead (NorthBDRM3FL_Valve);
Serial.print (" NorthBDRM3FL: ");
Serial.print (NorthBDRM3FLT);
Serial.print (" SetP= ");
if (timeRead == HIGH){
Serial.print(DAYSetNorthBDRM3FL);
}
else {
Serial.print(NIGHTSetNorthBDRM3FL);
}
if (NorthBDRM3FLHeatState == LOW ){
Serial.println (" Valve is Closed ");
}
else {
Serial.println (" Valve is Open ");
}
// Program for Garage Valve
delay (1000);
if ((BDRM2ndFLHeatState == HIGH) && (decisionGar_Valve == 1)) {
digitalWrite(Gar_Valve, HIGH); // opens valve if BDRM2ndFL valve is open and
// if Owner chooses Garage to follow BDRM2ndFL valve
}
else {
digitalWrite(Gar_Valve, LOW); //close the valve
}
GarHeatState = digitalRead (Gar_Valve);
if (GarHeatState == LOW ){
Serial.println (" Garage (can follow Bed2ndFloor) Valve is Closed ");
}
else {
Serial.println (" Garage (can follow Bed2ndFloor) Valve is Open ");
}
// Program for Laundry Valve
delay (1000);
if ((BDRM1stFLHeatState == HIGH) && (decisionLaundry_Valve == 1)) {
digitalWrite(Laundry_Valve, HIGH); // opens valve if BDRM1stFL valve is open and
// if Owner chooses Garage to follow BDRM1stFL valve
}
else {
digitalWrite(Laundry_Valve, LOW); //close the valve
}
LaundryHeatState = digitalRead (Laundry_Valve);
if (LaundryHeatState == LOW ){
Serial.println (" Laundry (can follow Bed1stFloor) Valve is Closed ");
}
else {
Serial.println (" Laundry (can follow Bed1stFloor) Valve is Open ");
}
Serial.println(" ");
// program for HWR. No need to average these water sensor readings since they are just for info.
Vo7 = analogRead(HWSThermistorPin);
R2z7 = R1s7 * (1023.0 / (float)Vo7 - 1.0);
logR2z7 = log(R2z7);
read7 = (1.0 / (c1 + c2*logR2z7 + c3*logR2z7*logR2z7*logR2z7));
HWS = read7 - 273.15; // Kelvin temperature converted to Celsius
HWS = ((HWS * 9.0)/ 5.0) + 32.0; // Celsius converted to Farhenheit
// program for HWR
Vo8 = analogRead(HWRThermistorPin);
R2z8 = R1s8 * (1023.0 / (float)Vo8 - 1.0);
logR2z8 = log(R2z8);
read8 = (1.0 / (c1 + c2*logR2z8 + c3*logR2z8*logR2z8*logR2z8));
HWR = read8 - 273.15; // Kelvin temperature converted to Celsius
HWR = ((HWR * 9.0)/ 5.0) + 32.0; // Celsius converted to Farhenheit
Serial.print (" Hot Water Supply Temp ");
Serial.println (HWS);
Serial.print (" Hot Water Return Temp ");
Serial.println (HWR);
Serial.println(" ");
Serial.println("------------------------------------------------------------------ ");
Serial.println(" ");
delay(15000); // delay 15 seconds
}
[/code]