Skip to content

Instantly share code, notes, and snippets.

@seansplayin
Last active April 10, 2023 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seansplayin/c69dd90b684621f293c9644ba16340d6 to your computer and use it in GitHub Desktop.
Save seansplayin/c69dd90b684621f293c9644ba16340d6 to your computer and use it in GitHub Desktop.
//Objectives:
/* Modify this code to be compatible with the ESP32-WROOM-32 Microcontoller usiing it's Integrated WIFI
* control and report to a webpage all aspects of my Hydronic evacuated tube Solar Hot Water collector System.
* Use a PT1000 RTD sensor to monitor the evacuated tube manifold.
* Utilize eleven DS18B20 digital temperature sensors to read temperatures from various system components.
* Control 5 circulation pumps according to what mode has been selected for each pump (On, Off, Auto).
* Specify perameters for circulation pump cycling when the pump is in the "Auto" mode.
* provide radio buttons on the webpage to select what mode each pump is in "On, Off, Auto".
usable pins: 34-39 are inputs only. VP=36, VN=39.
external flash uses 6-11 - unusable
strapping pins are 0,2,5,15. function durring boot up.
0,2 sould not be used.
5 has some function but still able to boot at high/low
If you pull 15 low at boot there will not be a boot log shown.
1,3 are for flashing - do not use
SDA = 21, scl = 22 and can be changed with Wire.begin(SDA, SCL)
fast SPI Bus VSPI uses 23,19,18,5 or VSPI uses 13,12,14,15.
if using inline debugging through platformIO pins 12,13,14,15 cannot be used.
safe pins 5,16,17,18,19,23,32,33
if using wifi ADC2 pins cannot be used. 0,2,4,12,13,14,15,25,26,27
ADC1 pins are 32,33,34,35,VP/36,VN/39
interrupts can be on any pin
This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
Designed specifically to work with the Adafruit RTD Sensor
----> https://www.adafruit.com/products/3328
This sensor uses SPI to communicate, 4 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
*/
#include <Adafruit_MAX31865.h>
#include <WiFi.h>
#include <WiFiServer.h>
#include <Arduino.h>
#include <Wire.h>
//#include <Adafruit_MAX31865.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <ESPAsyncWebSrv.h>
#include "uptime_formatter.h"
// WiFi credentials
const char *ssid = " :)";
const char *password = "";
WiFiServer wifiserver(8080);
//void WebReporting();
float DTemp1, DTemp2, DTemp3, DTemp4, DTemp5, DTemp6, DTemp7, DTemp8, DTemp9, DTemp10, DTemp11;
float DTemp1Average, DTemp2Average, DTemp3Average, DTemp4Average, DTemp5Average, DTemp6Average, DTemp7Average, DTemp8Average, DTemp9Average, DTemp10Average, DTemp11Average;
// Time and I2C bus libs for Real Time Clock
#include <Wire.h>
#include <Time.h>
// Flowmeter
#include <FlowMeter.h> // https://github.com/sekdiy/FlowMeter
FlowSensorProperties MySensor1 = {45.0f, 19.48f, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
FlowSensorProperties MySensor2 = {45.0f, 22.50f, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
FlowSensorProperties MySensor3 = {45.0f, 22.50f, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
FlowSensorProperties MySensor4 = {45.0f, 19.50f, {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}};
// connect a flow meter to an interrupt pin (see notes on your Arduino model for pin numbers)
FlowMeter *Meter1;
FlowMeter *Meter2;
FlowMeter *Meter3;
FlowMeter *Meter4;
// set the measurement update period to 1s (1000 ms)
const unsigned long period = 1000;
// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void Meter1ISR() {
// let our flow meter count the pulses
Meter1->count();
}
// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void Meter2ISR() {
// let our flow meter count the pulses
Meter2->count();
}
// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void Meter3ISR() {
// let our flow meter count the pulses
Meter3->count();
}
// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void Meter4ISR() {
// let our flow meter count the pulses
Meter4->count();
}
//Solar functions and WebReport include
// #include "ESP32solarControllerFunctions.h"
//
// Solar Controller Function Calls -
//
float outsideT;
float storageT;
float dhwT;
float CircReturnT; //water returing from the circulating pump
float supplyT; //water going to the collectors
float CreturnT; //water returing from the collectors
float DhwSupplyT; //water going to the DHW
float DhwReturnT; //water returning from the DHW
float HeatingSupplyT; //water going to the heating loop
float HeatingReturnT; //water returing from the heating loop
float CSupplyT; //water going to collectors read from after the pumps
float panelT;
float panelTminimum; //minimum temperature manifold must achieve to turn on lead pump
float CollectorTemperatureRise;
float DhwTemperatureDrop;
float HeatingTemperatureDrop;
float CirculationTemperatureDrop;
//float pt1000Value();
//float pt1000Average;
//float pt1000 = pt1000Value();
//float ReadPT1000Temperature(); // Convert PT1000 resistance value to Fahrenheit temperature
// Variables used for logic
int ii = 0;
int iii = 1;
// Define pins
//const int PT1000_PIN = 32; // PT1000 RTD connected to port number 32
const int ONE_WIRE_BUS = 33; // One Wire Bus for DS18B20 Temperature Sensors
// pump relay control pins
//#define Circ_Pump_Relay 16
//#define PANEL_LEAD_PUMP_RELAY 17
//#define PANEL_LAG_PUMP_RELAY 18
//#define DHW_PUMP_RELAY 19
//#define STORAGE_HEAT_RELAY 21
#define Circ_Pump_Relay 16
#define PANEL_LEAD_PUMP_RELAY 26
#define PANEL_LAG_PUMP_RELAY 27
#define DHW_PUMP_RELAY 17
#define STORAGE_HEAT_RELAY 21
// Operating Parameters for circulation pumps
#define PanelOnDifferential 30 // Panels must be this much warmer than sUpply to turn on pumps
#define PanelLowDifferential 15 // If Panels are only this much warmer, run slower
#define PanelOffDifferential 1 // If Panels are only this much warmer, turn off
#define HotWaterOnDifferential 12 // Storage must be this much warmer than dhw to turn on pump
#define HotWaterOffDifferential 8 // If Storage is only this much warmer than dhw, turn off pump
#define StorageTooCold 125 // If Storage isn't hot enough, don't let heat exch pump run
#define DHW_HIGHTEMP_LIMIT 150 // shut off DHW Pump when this temperature is reached in DHW storage tank
#define HIGHTEMP_LIMIT 176 // shut off when this temperature is reached in storage tank
#define FREEZE_LIMIT 50 // don't operate if Collector Average temp is below this temperature
#define Circ_Pump_On 4 // temperature difference when circulation pump comes on
#define Circ_Pump_Off 2 // temperature difference when circulation pump turns off
#define panelTminimum 125 // lead pump on criteria, minimum manifold temp in addition to collector vs supply requirement
//Temp Delta calculations for flow meters
#define Circ_Loop_Differential ((supplyT) - (CircReturnT))
#define Collector_Temperature_Rise ((CreturnT) - (supplyT))
/*
#define outsideT= DTemp3
#define storageT= DTemp2
#define dhwT = DTemp1
#define CircReturnT = DTemp6
#define supplyT = DTemp5
#define CreturnT = DTemp4
#define DhwSupplyT = DTemp7
#define DhwReturnT = DTemp8
#define HeatingSupplyT = DTemp9
#define HeatingReturnT = DTemp10
#define CSupplyT = DTemp11
#define panelT = pt1000
*/
// Flowmeter declarations
#define meter1volume (Meter1->getCurrentFlowrate())
#define meter2volume (Meter2->getCurrentFlowrate())
#define meter3volume (Meter3->getCurrentFlowrate())
#define meter4volume (Meter4->getCurrentFlowrate())
// Alarm state values
#define ALARM_OFF 0
#define ALARM_FREEZE 1
#define ALARM_HOT 2
int ALARM = ALARM_OFF; // Alarm value, set to off initially
String alarmMessage1; // Alarm message in 2 lines to fit LCD
String alarmMessage2;
// pump state values
#define PUMP_OFF 0
#define PUMP_ON 1
#define PUMP_AUTO 2
// pump state - 0 off, 1 on, 2 auto as controlled by ButtonControl or web page function
int state_panel_lead = PUMP_AUTO; // default to auto allows temperature logic to control pumps
int state_panel_lag = PUMP_AUTO;
int state_dhw = PUMP_AUTO;
int state_heat = PUMP_AUTO;
int state_circ = PUMP_AUTO;
// One Wire Bus Settings -
// setup digital oneWire sensor addresses
//DeviceAddress DSensor1 = {0x28, 0xF1, 0x15, 0x48, 0xF6, 0xCD, 0x3C, 0x75};
//DeviceAddress DSensor2 = {0x28, 0x69, 0x9A, 0x48, 0xF6, 0x7A, 0x3C, 0xAD};
//DeviceAddress DSensor3 = {0x28, 0x52, 0x16, 0x96, 0xF0, 0x01, 0x3C, 0x02};
//DeviceAddress DSensor4 = {0x28, 0xDD, 0x9B, 0x96, 0xF0, 0x01, 0x3C, 0xEB};
//DeviceAddress DSensor5 = {0x28, 0xE5, 0x91, 0x96, 0xF0, 0x01, 0x3C, 0x1A};
//DeviceAddress DSensor6 = {0x28, 0x85, 0xEA, 0x81, 0xE3, 0x2B, 0x3C, 0xF2};
//DeviceAddress DSensor7 = {0x28, 0x29, 0x1A, 0x81, 0xE3, 0x53, 0x3C, 0xB5};
//DeviceAddress DSensor8 = {0x28, 0x22, 0xC6, 0x81, 0xE3, 0x17, 0x3C, 0x92};
//DeviceAddress DSensor9 = {0x28, 0x66, 0xF1, 0x81, 0xE3, 0xD2, 0x3C, 0xA5};
//DeviceAddress DSensor10 = {0x28, 0x22, 0x14, 0x81, 0xE3, 0xDC, 0x3C, 0xD8};
//DeviceAddress DSensor11 = {0x28, 0x37, 0x16, 0x49, 0xF6, 0x0D, 0x3C, 0x2D};
DeviceAddress DSensor1 = {0x28, 0x5D, 0x4F, 0x57, 0x04, 0xA7, 0x3C, 0xA1};
DeviceAddress DSensor2 = {0x28, 0xFC, 0xD3, 0x57, 0x04, 0x1D, 0x3C, 0xB9};
DeviceAddress DSensor3 = {0x28, 0x04, 0x35, 0x57, 0x04, 0x69, 0x3C, 0xA1};
DeviceAddress DSensor4 = {0x28, 0xDC, 0xFD, 0x57, 0x04, 0x35, 0x3C, 0xE2};
DeviceAddress DSensor5 = {0x28, 0xE4, 0xFE, 0x57, 0x04, 0xF6, 0x3C, 0x01};
DeviceAddress DSensor6 = {0x28, 0xD0, 0xBB, 0x57, 0x04, 0x91, 0x3C, 0x3F};
DeviceAddress DSensor7 = {0x28, 0xE7, 0x76, 0x57, 0x04, 0xF2, 0x3C, 0x96};
DeviceAddress DSensor8 = {0x28, 0xFB, 0xD1, 0x57, 0x04, 0x33, 0x3C, 0xA2};
DeviceAddress DSensor9 = {0x28, 0x9E, 0xE2, 0x57, 0x04, 0xC8, 0x3C, 0xFA};
DeviceAddress DSensor10 = {0x28, 0xC0, 0x45, 0x57, 0x04, 0x54, 0x3C, 0x2B};
DeviceAddress DSensor11 = {0x28, 0x7C, 0xC9, 0x81, 0xE3, 0x6F, 0x3C, 0x00};
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/// Create an instance of the Adafruit_MAX31865 class
Adafruit_MAX31865 thermo = Adafruit_MAX31865(5);
// Define the reference resistance and nominal resistance of the PT1000 sensor
#define RREF 4300.0
#define RNOMINAL 1000.0
// Declare a global array to store the temperature readings
float pt1000Values[40]; // array to store pt1000 readings
int pt1000Index = 0; // index to keep track of current position in the array
const int pt1000NumReadings = 40; // number of readings to store in the array
// Function to read the PT1000 sensor and return the temperature in Fahrenheit
float pt1000() {
uint16_t rtd = thermo.readRTD();
float ratio = rtd;
ratio /= 32768;
float resistance = RREF*ratio;
float pt1000 = thermo.temperature(RNOMINAL, RREF);
return (pt1000 * 1.8) + 32; // Convert Celsius to Fahrenheit
}
// Function to report the last temperature reading in Fahrenheit
float pt1000LastValue() {
return pt1000Values[(pt1000Index + pt1000NumReadings - 1) % pt1000NumReadings];
}
// Function to calculate the average temperature in Fahrenheit
float pt1000AverageValue() {
float sum = 0;
for (int i = 0; i < pt1000NumReadings; i++) {
sum += pt1000Values[i];
}
return sum / pt1000NumReadings;
}
// Define the number of readings to average for DTemp1
#define DTemp1NumReadings 10
// Define an array to store the readings
float DTemp1Values[DTemp1NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp1Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp1AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp1NumReadings; i++) {
sum += DTemp1Values[i];
}
return sum / DTemp1NumReadings;
}
// Define the number of readings to average for DTemp2
#define DTemp2NumReadings 10
// Define an array to store the readings
float DTemp2Values[DTemp2NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp2Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp2AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp2NumReadings; i++) {
sum += DTemp2Values[i];
}
return sum / DTemp2NumReadings;
}
// Define the number of readings to average for DTemp3
#define DTemp3NumReadings 10
// Define an array to store the readings
float DTemp3Values[DTemp3NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp3Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp3AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp3NumReadings; i++) {
sum += DTemp3Values[i];
}
return sum / DTemp3NumReadings;
}
// Define the number of readings to average for DTemp4
#define DTemp4NumReadings 10
// Define an array to store the readings
float DTemp4Values[DTemp4NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp4Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp4AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp4NumReadings; i++) {
sum += DTemp4Values[i];
}
return sum / DTemp4NumReadings;
}
// Define the number of readings to average for DTemp5
#define DTemp5NumReadings 10
// Define an array to store the readings
float DTemp5Values[DTemp5NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp5Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp5AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp5NumReadings; i++) {
sum += DTemp5Values[i];
}
return sum / DTemp5NumReadings;
}
// Define the number of readings to average for DTemp6
#define DTemp6NumReadings 10
// Define an array to store the readings
float DTemp6Values[DTemp6NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp6Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp6AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp6NumReadings; i++) {
sum += DTemp6Values[i];
}
return sum / DTemp6NumReadings;
}
// Define the number of readings to average for DTemp7
#define DTemp7NumReadings 10
// Define an array to store the readings
float DTemp7Values[DTemp7NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp7Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp7AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp7NumReadings; i++) {
sum += DTemp7Values[i];
}
return sum / DTemp7NumReadings;
}
// Define the number of readings to average for DTemp8
#define DTemp8NumReadings 10
// Define an array to store the readings
float DTemp8Values[DTemp8NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp8Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp8AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp8NumReadings; i++) {
sum += DTemp8Values[i];
}
return sum / DTemp8NumReadings;
}
// Define the number of readings to average for DTemp9
#define DTemp9NumReadings 10
// Define an array to store the readings
float DTemp9Values[DTemp9NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp9Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp9AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp9NumReadings; i++) {
sum += DTemp9Values[i];
}
return sum / DTemp9NumReadings;
}
// Define the number of readings to average for DTemp10
#define DTemp10NumReadings 10
// Define an array to store the readings
float DTemp10Values[DTemp10NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp10Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp10AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp10NumReadings; i++) {
sum += DTemp10Values[i];
}
return sum / DTemp10NumReadings;
}
// Define the number of readings to average for DTemp11
#define DTemp11NumReadings 10
// Define an array to store the readings
float DTemp11Values[DTemp11NumReadings];
// Define a variable to keep track of the index of the current reading
int DTemp11Index = 0;
// Function to calculate and return the rolling average of the last 10 readings
float DTemp11AverageValue() {
float sum = 0;
for (int i = 0; i < DTemp11NumReadings; i++) {
sum += DTemp11Values[i];
}
return sum / DTemp11NumReadings;
}
// Digital read of DS18B20 one-wire bus sensors
void ReadDigitalTemperatures()
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
sensors.requestTemperatures();
// get temperatures from devices
DTemp1 = sensors.getTempF(DSensor1);
DTemp2 = sensors.getTempF(DSensor2);
DTemp3 = sensors.getTempF(DSensor3);
DTemp4 = sensors.getTempF(DSensor4);
DTemp5 = sensors.getTempF(DSensor5);
DTemp6 = sensors.getTempF(DSensor6);
DTemp7 = sensors.getTempF(DSensor7);
DTemp8 = sensors.getTempF(DSensor8);
DTemp9 = sensors.getTempF(DSensor9);
DTemp10 = sensors.getTempF(DSensor10);
DTemp11 = sensors.getTempF(DSensor11);
}
void UpdateSerialMonitor(){
//show temps
// get temperatures from devices
DTemp1 = sensors.getTempF(DSensor1);
DTemp2 = sensors.getTempF(DSensor2);
DTemp3 = sensors.getTempF(DSensor3);
DTemp4 = sensors.getTempF(DSensor4);
DTemp5 = sensors.getTempF(DSensor5);
DTemp6 = sensors.getTempF(DSensor6);
DTemp7 = sensors.getTempF(DSensor7);
DTemp8 = sensors.getTempF(DSensor8);
DTemp9 = sensors.getTempF(DSensor9);
DTemp10 = sensors.getTempF(DSensor10);
DTemp11 = sensors.getTempF(DSensor11);
Serial.println();
// report the last temperature reading
Serial.print("PT1000 Last Temperature Reading: ");
Serial.print(pt1000LastValue());
Serial.println(" F");
// report the average temperature
Serial.print("PT1000 Average Temperature: ");
Serial.print(pt1000AverageValue());
Serial.println(" F");
Serial.println();
Serial.print("D 1 Temp = ");
Serial.println(DTemp1);
Serial.print("D 2 Temp = ");
Serial.println(DTemp2);
Serial.print("D 3 Temp = ");
Serial.println(DTemp3);
Serial.print("D 4 Temp = ");
Serial.println(DTemp4);
Serial.print("D 5 Temp = ");
Serial.println(DTemp5);
Serial.print("D 6 Temp = ");
Serial.println(DTemp6);
Serial.print("D 7 Temp = ");
Serial.println(DTemp7);
Serial.print("D 8 Temp = ");
Serial.println(DTemp8);
Serial.print("D 9 Temp = ");
Serial.println(DTemp9);
Serial.print("D 10 Temp = ");
Serial.println(DTemp10);
Serial.print("D 11 Temp = ");
Serial.println(DTemp11);
Serial.println();
Serial.print("Panel Temperature = ");
Serial.println(panelT);
Serial.print("sUpply Temperature = ");
Serial.println(supplyT);
Serial.print("Creturn Temperature = ");
Serial.println(CreturnT);
Serial.print("Outside Temperature = ");
Serial.println(outsideT);
Serial.print("Storage Temperature = ");
Serial.println(storageT);
Serial.print("DHW Tank Temperature = ");
Serial.println(dhwT);
Serial.print("DHW Supply Temperature = ");
Serial.println(DhwSupplyT);
Serial.print("DHW Return Temperature = ");
Serial.println(DhwReturnT);
Serial.print("Heating Supply Temperature = ");
Serial.println(HeatingSupplyT);
Serial.print("Heating Return Temperature = ");
Serial.println(HeatingReturnT);
Serial.print("Circulation Supply = ");
Serial.println(supplyT);
Serial.print("Circulation Return = ");
Serial.println(CircReturnT);
Serial.println();
Serial.print("Panel Pump Status Lag/Lead = ");
if (digitalRead(PANEL_LAG_PUMP_RELAY))
Serial.print( "OFF"); else Serial.print("ON");
Serial.print(" , ");
if (digitalRead(PANEL_LEAD_PUMP_RELAY))
Serial.println( "OFF"); else Serial.println("ON");
Serial.print("DHW Pump Status = ");
if (digitalRead(DHW_PUMP_RELAY))
Serial.println( "OFF"); else Serial.println("ON");
Serial.print("Heat Exch Pump Status = ");
if (digitalRead(STORAGE_HEAT_RELAY))
Serial.println( "OFF"); else Serial.println("ON");
Serial.print("Circ Loop Pump Status = ");
if (digitalRead(Circ_Pump_Relay))
Serial.println( "OFF"); else Serial.println("ON");
Serial.print("Alarm state = ");
if (ALARM != ALARM_OFF)
{
Serial.print(alarmMessage1);
Serial.print(" ");
Serial.println(alarmMessage2);
}
else Serial.println ("no Alarms");
Serial.println();
Serial.println();
}
// Check for any Alarm conditions and if found, turn off panel pumps and set Alarm and Message
void Alarm()
{
//float pt1000Average = (pt1000AverageValue());
if (storageT >= HIGHTEMP_LIMIT)
{
ALARM = ALARM_HOT;
alarmMessage1 = "Storage at";
alarmMessage2 = "High Limit";
// ensure panel pumps are off (they should be anyway)
if (state_panel_lead == PUMP_AUTO) digitalWrite (PANEL_LEAD_PUMP_RELAY, HIGH);
if (state_panel_lag == PUMP_AUTO) digitalWrite (PANEL_LAG_PUMP_RELAY, HIGH);
}
else if (panelT <= FREEZE_LIMIT)
{
ALARM = ALARM_FREEZE;
alarmMessage1 = "Collector Manifold";
alarmMessage2 = "Too Cold";
// ensure panel pumps are off
if (state_panel_lead == PUMP_AUTO) digitalWrite (PANEL_LEAD_PUMP_RELAY, HIGH);
if (state_panel_lag == PUMP_AUTO) digitalWrite (PANEL_LAG_PUMP_RELAY, HIGH);
}
else if (dhwT >= DHW_HIGHTEMP_LIMIT)
{
ALARM = ALARM_HOT;
alarmMessage1 = "DHW at";
alarmMessage2 = "High Limit";
// ensure panel pumps are off
if (state_dhw == PUMP_AUTO) digitalWrite (DHW_PUMP_RELAY, HIGH);
}
}
// Differential Temperature Pump Control
void PumpControl()
{
//float pt1000Average = (pt1000AverageValue());
if (state_panel_lead == PUMP_ON) digitalWrite (PANEL_LEAD_PUMP_RELAY, LOW);
else {
if (state_panel_lead == PUMP_OFF) digitalWrite (PANEL_LEAD_PUMP_RELAY, HIGH);
else {
// auto panel lead pump control:
// if no alarms
// set control pin to LOW to turn relay on, HIGH to turn relay off
// turn on if panel vs supply differential is greater than turnOnDifferential, checking for button override
if (ALARM == ALARM_OFF)
{
if (panelT >= panelTminimum && (panelT > (supplyT + PanelOnDifferential)))
{
digitalWrite (PANEL_LEAD_PUMP_RELAY, LOW);
digitalWrite (PANEL_LAG_PUMP_RELAY, LOW);
}
}
}}
// manual panel lag pump control:
if (state_panel_lag == PUMP_ON) digitalWrite (PANEL_LAG_PUMP_RELAY, LOW);
else {
if (state_panel_lag == PUMP_OFF) digitalWrite (PANEL_LAG_PUMP_RELAY, HIGH);
else {
// auto panel lead pump control:
//turn off lag pump if differential is down far enough or back on if risen enough
if (!digitalRead(PANEL_LEAD_PUMP_RELAY)) //if the lead pump is running
{
//if (panelT < (supplyT + PanelLowDifferential) ){
if (Collector_Temperature_Rise < (PanelLowDifferential) ){
digitalWrite (PANEL_LAG_PUMP_RELAY, HIGH);
} else {
digitalWrite (PANEL_LAG_PUMP_RELAY, LOW);
}
}
}}
//turn off both pumps if differential is less than turnOffDifferential
if (panelT < (supplyT + PanelOffDifferential) ){
if (state_panel_lead == PUMP_AUTO) digitalWrite (PANEL_LEAD_PUMP_RELAY, HIGH);
if (state_panel_lag == PUMP_AUTO) digitalWrite (PANEL_LAG_PUMP_RELAY, HIGH);
}
// manual dhw pump control
if (state_dhw == PUMP_ON)
{
digitalWrite (DHW_PUMP_RELAY, LOW);
} else {
if (state_dhw == PUMP_OFF)
{
digitalWrite (DHW_PUMP_RELAY, HIGH);
} else {
// auto control: turn on DHW Pump when storage enough warmer
if (storageT > (dhwT + HotWaterOnDifferential)) {
digitalWrite (DHW_PUMP_RELAY, LOW);
}
if (storageT < (dhwT + HotWaterOffDifferential)) {
digitalWrite (DHW_PUMP_RELAY, HIGH);
}}}
// manual heat exchanger pump control
if (state_heat == PUMP_ON)
{
digitalWrite (STORAGE_HEAT_RELAY, LOW);
} else {
if (state_heat == PUMP_OFF)
{
digitalWrite (STORAGE_HEAT_RELAY, HIGH);
} else {
// auto control: prevent forced air heat exchanger pump from coming on if storage is too low
if (storageT > (StorageTooCold)) {
digitalWrite (STORAGE_HEAT_RELAY, LOW);
}
if (storageT < (StorageTooCold)) {
digitalWrite (STORAGE_HEAT_RELAY, HIGH);
}}
}
// manual Circ pump control
if (state_circ == PUMP_ON)
{
digitalWrite (Circ_Pump_Relay, LOW);
} else {
if (state_circ == PUMP_OFF)
{
digitalWrite (Circ_Pump_Relay, HIGH);
} else {
if (!digitalRead(DHW_PUMP_RELAY))
{
digitalWrite (Circ_Pump_Relay, HIGH);
} else {
if (!digitalRead(STORAGE_HEAT_RELAY))
{
digitalWrite (Circ_Pump_Relay, HIGH);
} else {
// auto control: turn on Circ Pump when CircReturnT =< supplyT + 15
if (Circ_Pump_On <= (Circ_Loop_Differential)) {
digitalWrite (Circ_Pump_Relay, LOW);
}
if (Circ_Pump_Off >= (Circ_Loop_Differential)) {
digitalWrite (Circ_Pump_Relay, HIGH);
}}
}
}
}
}
//
//
//
//
//#include "ESP32wifiWebReport.h"
// client.print("&nbsp"); client.print("&ensp;"); client.print("&emsp;"); client.print("&nbsp;"); line 527 for the first half.
// Solar Controller Web Reporting Function
//
String readString = ""; // Used to store Form value
/*
Read web command strings
This function checks if any of the web buttons have been selected and sets the
Pump state variables appropriately (PumpControl function uses these states to actually control the pumps)
*/
void doreadStringAction()
{
if (readString.indexOf("?panelleadon") >0)
{
state_panel_lead = PUMP_ON;
}
else
{
if (readString.indexOf("?panelleadoff") >0)
{
state_panel_lead = PUMP_OFF;
}
else
{
if (readString.indexOf("?panelleadauto") >0)
{
state_panel_lead = PUMP_AUTO;
}
else
{
if (readString.indexOf("?panellagon") >0)
{
state_panel_lag = PUMP_ON;
}
else
{
if (readString.indexOf("?panellagoff") >0)
{
state_panel_lag = PUMP_OFF;
}
else
{
if (readString.indexOf("?panellagauto") >0)
{
state_panel_lag = PUMP_AUTO;
}
else
{
if (readString.indexOf("?dhwon") >0)
{
state_dhw = PUMP_ON;
}
else
{
if (readString.indexOf("?dhwoff") >0)
{
state_dhw = PUMP_OFF;
}
else
{
if (readString.indexOf("?dhwauto") >0)
{
state_dhw = PUMP_AUTO;
}
else
{
if (readString.indexOf("?heaton") >0)
{
state_heat = PUMP_ON;
}
else
{
if (readString.indexOf("?heatoff") >0)
{
state_heat = PUMP_OFF;
}
else
{
if (readString.indexOf("?heatauto") >0)
{
state_heat = PUMP_AUTO;
}
else
{
if (readString.indexOf("?circon") >0)
{
state_circ = PUMP_ON;
}
else
{
if (readString.indexOf("?circoff") >0)
{
state_circ = PUMP_OFF;
}
else
{
if (readString.indexOf("?circauto") >0)
{
state_circ = PUMP_AUTO;
}
else
{
if (readString.indexOf("?auto") >0)
{
state_panel_lead = PUMP_AUTO;
state_panel_lag = PUMP_AUTO;
state_dhw = PUMP_AUTO;
state_heat = PUMP_AUTO;
state_circ = PUMP_AUTO;
}
else
{
if (readString.indexOf("?alloff") >0)
{
state_panel_lead = PUMP_OFF;
state_panel_lag = PUMP_OFF;
state_dhw = PUMP_OFF;
state_heat = PUMP_OFF;
state_circ = PUMP_OFF;
}
}
}
}}}}}}}}}}}
}
}}
}
/*
Web reporting
Provides html to draw the web page and buttons and reports the temps and pump states
Updates form values when buttons are pressed to be acted on by doreadStringAction above
*/
void WebReporting() {
// listen for incoming clients
WiFiClient client = wifiserver.available();
if ( client ) // then send html to web page
{
while (client.connected())
{
if (client.available())
{ // start up the server and get string
char c = client.read();
if (readString.length() < 100)
{
readString += c;
}
if (c == '\n')
{
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("<html>");
client.println();
// send head
client.print("<head>");
client.print("<style type=\"text/css\">");
client.print("body{");
client.print("background-color:#CAD4E0;");
client.print("font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif, Helvetica;");
client.print("font-size:12px;");
client.print("line-height:120%;");
client.print("text-align:left;");
client.print("}");
client.print("h1 {");
client.print("color:#459;");
//client.print("font-family:15px;");
client.print("font-size:30px;");
client.print("line-height:100%;");
client.print("font-weight:bold;");
client.print("}");
client.print("h3 {");
client.print("color:#459;");
client.print("font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif, Helvetica;");
client.print("font-size:14px;");
client.print("line-height:100%;");
client.print("font-weight:bold;");
client.print("}");
client.print("h4 {");
client.print("color:purple;");
client.print("font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif, Helvetica;");
client.print("font-size:11px;");
client.print("line-height:100%;");
client.print("font-weight:bold;");
client.print("text-align:right;");
client.print("}");
client.print("h5 {");
client.print("color:purple;");
client.print("font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif, Helvetica;");
client.print("font-size:11px;");
client.print("line-height:100%;");
client.print("font-weight:bold;");
client.print("text-align:left;");
client.print("}");
client.print("</style>");
client.print("<title>Solar Control System</title>");
client.println("<meta http-equiv=\"refresh\" content=\"1\">"); // This is used to refresh the page
client.print("</head>");
// send body
client.print("<body>");
client.println();
client.print("<table border=\"10\" cellpadding=\"4\" cellspacing=\"5\">");
client.print("<tr>");
client.print("<td valign=\"Bottom\" bgcolor=\"#0e1117\"><h5> ");
client.print("Uptime :");
client.println(uptime_formatter::getUptime());
client.print("</h5></td>");
client.print("<td align=\"center\" bgcolor=\"#0e1117\"><h1 align=\"center\">Solar Thermal System</h1></td>");
client.print("<td valign=\"Bottom\" font-size=\"11px\" align=\"right\" bgcolor=\"#0e1117\"><h4>");
client.print("Alarm state = ");
if (ALARM != ALARM_OFF)
{
client.print("<span valign=\"Bottom\"align=\"right\"style=\"color:red\">");
client.print(alarmMessage1);
client.print(" ");
client.println(alarmMessage2);
}
else
{
client.print("<span style=\"color:blue\">");
client.println ("no Alarms");
}
client.print("</span></h4>");
client.print("</td>");
client.print("</tr>");
client.print("<tr><td valign=\"top\" width=\"33%\" valign=\"top\" bgcolor=\"#419527\">");
client.print("<h3 align=\"center\">System Temperatures</h3><div style=\"font-size:14px\">");
client.print("Outside Ambient (DTemp3):");
client.print("&ensp;");
client.println(outsideT);
client.print("&#176;");
client.print("<br>");
client.print("600 Gal Storage (DTemp2):");
client.print("&ensp;");
client.println(storageT);
client.print("&#176;");
client.print("<br>");
client.print("Collector Manifold (PT1000):");
client.print("&ensp;");
client.println(panelT);
client.print("&#176;");
client.print("<br>");
client.print("Collector Supply (DTemp11):");
client.print("&ensp;");
client.println(CSupplyT);
client.print("&#176;");
client.print("<br>");
client.print("Collector Return (DTemp4):");
client.print("&ensp;");
client.println(CreturnT);
client.print("&#176;");
client.print("<br>");
client.print("Domestic HW Tank (DTemp1):");
client.print("&ensp;");
client.println(dhwT);
client.print("&#176;");
client.print("<br>");
client.print("Domestic HW Supply (DTemp7):");
client.print("&ensp;");
client.println(DhwSupplyT);
client.print("&#176;");
client.print("<br>");
client.print("Domestic HW Return (DTemp8):");
client.print("&ensp;");
client.print(DhwReturnT);
client.print("&#176;");
client.print("<br>");
client.print("Circ Loop Supply (DTemp5):");
client.print("&ensp;");
client.println(supplyT);
client.print("&#176;");
client.print("<br>");
client.print("Circ Loop Return (DTemp6):");
client.print("&ensp;");
client.println(CircReturnT);
client.print("&#176;");
client.print("<br>");
client.print("Heat Loop Supply (DTemp9):");
client.print("&ensp;");
client.println(HeatingSupplyT);
client.print("&#176;");
client.print("<br>");
client.print("Heat Loop Return (DTemp10):");
client.print("&ensp;");
client.println(HeatingReturnT);
client.print("&#176;");
client.print("<br>");
client.print("<br></div>");
client.print("</td><td width=\"34%\" valign=\"top\" bgcolor=\"#419527\">");
client.print("<h3 align=\"center\">Pump Control & Status</h3><div style=\"font-size:14px\">");
client.print("<form>");
client.print("Lead");
client.print("&ensp;");
client.print("<INPUT type=button value=ON onClick=window.location='/?panelleadon\'>");
client.print("<INPUT type=button value=OFF onClick=window.location='/?panelleadoff\'>");
client.print("<INPUT type=button value=AUTO onClick=window.location='/?panelleadauto\'>");
client.print("&ensp;");
if (state_panel_lead == PUMP_AUTO)
{
client.print("AUTO :");
}
else
{
if (state_panel_lead == PUMP_OFF)
{
client.print("OFF :");
}
else
{
if (state_panel_lead == PUMP_ON)
{
client.print("ON :");
}
else
{
client.print("????");
}
}
}
if (digitalRead(PANEL_LEAD_PUMP_RELAY))
client.print("<span style=\"color:black\"> STOPPED</span>"); else client.print("<span style=\"color:blue; font-weight:bold;\"> POWERED</span>");
client.print("<br>");
client.print("<br>");
client.print("Lag");
client.print("&emsp;");
client.print("<INPUT type=button value=ON onClick=window.location='/?panellagon\'>");
client.print("<INPUT type=button value=OFF onClick=window.location='/?panellagoff\'>");
client.print("<INPUT type=button value=AUTO onClick=window.location='/?panellagauto\'>");
client.print("&ensp;");
if (state_panel_lag == PUMP_AUTO)
{
client.print("AUTO :");
}
else
{
if (state_panel_lag == PUMP_OFF)
{
client.print("OFF :");
}
else
{
if (state_panel_lag == PUMP_ON)
{
client.print("ON :");
}
else
{
client.print("????");
}
}
}
if (digitalRead(PANEL_LAG_PUMP_RELAY))
client.print("<span style=\"color:black\"> STOPPED</span>"); else client.print("<span style=\"color:blue; font-weight:bold;\"> POWERED</span>");
client.print("<br>");
client.print("<br>");
client.print("DHW");
client.print("&ensp;");
client.print("<INPUT type=button value=ON onClick=window.location='/?dhwon\'>");
client.print("<INPUT type=button value=OFF onClick=window.location='/?dhwoff\'>");
client.print("<INPUT type=button value=AUTO onClick=window.location='/?dhwauto\'>");
client.print("&ensp;");
if (state_dhw == PUMP_AUTO)
{
client.print("AUTO :");
}
else
{
if (state_dhw == PUMP_OFF)
{
client.print("OFF :");
}
else
{
if (state_dhw == PUMP_ON)
{
client.print("ON :");
}
else
{
client.print("????");
}
}
}
if (digitalRead(DHW_PUMP_RELAY))
client.print("<span style=\"color:black\"> STOPPED</span>"); else client.print("<span style=\"color:blue; font-weight:bold;\"> POWERED</span>");
client.print("<br>");
client.print("<br>");
client.print("Heat");
client.print("&ensp;");
client.print("<INPUT type=button value=ON onClick=window.location='/?heaton\'>");
client.print("<INPUT type=button value=OFF onClick=window.location='/?heatoff\'>");
client.print("<INPUT type=button value=AUTO onClick=window.location='/?heatauto\'>");
client.print("&ensp;");
if (state_heat == PUMP_AUTO)
{
client.print("AUTO :");
}
else
{
if (state_heat == PUMP_OFF)
{
client.print("OFF :");
}
else
{
if (state_heat == PUMP_ON)
{
client.print("ON :");
}
else
{
client.print("????");
}
}
}
if (digitalRead(STORAGE_HEAT_RELAY))
client.print("<span style=\"color:black\"> STOPPED</span>"); else client.print("<span style=\"color:blue; font-weight:bold;\"> POWERED</span>");
client.print("<br>");
client.print("<br>");
client.print("Circ");
client.print("&ensp;");
client.print("<INPUT type=button value=ON onClick=window.location='/?circon\'>");
client.print("<INPUT type=button value=OFF onClick=window.location='/?circoff\'>");
client.print("<INPUT type=button value=AUTO onClick=window.location='/?circauto\'>");
client.print("&ensp;");
if (state_circ == PUMP_AUTO)
{
client.print("AUTO :");
}
else
{
if (state_circ == PUMP_OFF)
{
client.print("OFF :");
}
else
{
if (state_circ == PUMP_ON)
{
client.print("ON :");
}
else
{
client.print("????");
}
}
}
if (digitalRead(Circ_Pump_Relay))
client.print("<span style=\"color:black\"> STOPPED</span>"); else client.print("<span style=\"color:blue; font-weight:bold;\"> POWERED</span>");
client.print("<br>");
client.print("<br>");
//client.print("&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;<input type=button value=\"CLEAR\" onClick=window.location=\'/\'>");
client.print("Circulators <input type=button value=\"CLEAR\" onClick=window.location=\'/\'>");
client.print("&emsp;<input type=button value=\"ALL OFF\" onClick=window.location=\'/?alloff\'>");
client.print("&emsp;<input type=button value=\"ALL AUTO\" onClick=window.location=\'/?auto\'>");
client.print("</form></div>");
client.print("</td><td valign=\"top\" width=\"33%\" valign=\"top\" bgcolor=\"#419527\">");
client.print("<h3 align=\"center\">not used</h3><div style=\"font-size:14px\">");
client.print("<br></div>");
client.print("</td>");
client.print("<tr><td valign=\"top\" bgcolor=\"#419527\">");
client.print("<h3 align=\"center\">Temp Sensors</h3><div style=\"font-size:14px\">");
client.print("pt1000: ");
client.print("&emsp;");
client.println(pt1000LastValue());
client.print("&#176;");
client.print("&emsp;");
client.print("pt1000 Average: ");
client.println(pt1000AverageValue());
client.print("&#176;");
client.print("<br>");
client.print("DTemp1:");
client.print("&emsp;");
client.println(DTemp1);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp1Average:");
client.print("&emsp;");
client.println(DTemp1Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp2:");
client.print("&emsp;");
client.println(DTemp2);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp2Average:");
client.print("&emsp;");
client.println(DTemp2Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp3:");
client.print("&emsp;");
client.println(DTemp3);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp3Average:");
client.print("&emsp;");
client.println(DTemp3Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp4:");
client.print("&emsp;");
client.println(DTemp4);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp4Average:");
client.print("&emsp;");
client.println(DTemp4Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp5:");
client.print("&emsp;");
client.println(DTemp5);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp5Average:");
client.print("&emsp;");
client.println(DTemp5Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp6:");
client.print("&emsp;");
client.println(DTemp6);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp6Average:");
client.print("&emsp;");
client.println(DTemp6Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp7:");
client.print("&emsp;");
client.println(DTemp7);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp7Average:");
client.print("&emsp;");
client.println(DTemp7Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp8:");
client.print("&emsp;");
client.println(DTemp8);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp8Average:");
client.print("&emsp;");
client.println(DTemp8Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp9:");
client.print("&emsp;");
client.println(DTemp9);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp9Average:");
client.print("&emsp;");
client.println(DTemp9Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp10:");
client.print("&ensp;");
client.println(DTemp10);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp10Average:");
client.print("&ensp;");
client.println(DTemp10Average);
client.print("&#176;");
client.print("<br>");
client.print("DTemp11:");
client.print("&ensp;");
client.println(DTemp11);
client.print("&#176;");
client.print("&emsp;");
client.print("DTemp11Average:");
client.print("&ensp;");
client.println(DTemp11Average);
client.print("&#176;");
client.print("<br>");
client.print("<br></div>");
client.print("</td><td valign=\"top\" bgcolor=\"#419527\">");
client.print("<h3 align=\"center\">Information</h3><div style=\"font-size:14px\">");
//client.print("<span style=\"color:purple; font-weight:bold;\">");
//client.print(timeDate);
//client.print("</span><br>");
client.print("<br>");
//client.print("<span style=\"color:black; font-weight:;\">");
//client.print("Uptime ");
//client.print("</span>");
//client.print("<span style=\"color:purple; font-weight:;\">");
//client.println(uptime_formatter::getUptime());
//client.print("</span><br>");
//client.print("Alarm state = ");
//if (ALARM != ALARM_OFF)
// {
//client.print("<span style=\"color:red\">");
//client.print(alarmMessage1);
//client.print(" ");
//client.println(alarmMessage2);
//}
//else
//{
//client.print("<span style=\"color:blue\">");
//client.println ("no Alarms");
//}
// client.print("</span>");
//client.print("<br>");
client.print("Min Lead Start Temp(PT1000):");
client.print("&ensp;");
client.print(panelTminimum); // Manifold must achieve this temperature in addition to the supply vs panelT setting
client.print("&#176;");
client.print("<br>");
client.print("Lead On Diff.(PT1000 vs DTemp5):");
client.print("&ensp;");
client.print(PanelOnDifferential); // Panels must be this much warmer than sUpply to turn on pumps
client.print("&#176;");
client.print("<br>");
client.print("Lag On Diff.(Dtemp6 vs DTemp11):");
client.print("&ensp;");
client.print(PanelLowDifferential); // If Panels are only this much warmer, run slower
client.print("&#176;");
client.print("<br>");
client.print("Lead Off Diff.(PT1000 vs DTemp5):");
client.print("&ensp;");
client.print(PanelOffDifferential); // If Panels are only this much warmer, turn off
client.print("&#176;");
client.print("<br>");
client.print("Lead Min Temp Enable(PT1000):");
client.print("&ensp;");
client.print(FREEZE_LIMIT); // don't operate if outside temp is below this temperature
client.print("&#176;");
client.print("<br>");
client.print("<br>");
client.print("DHW On Diff. (DTemp2 vs DTemp1):");
client.print("&ensp;");
client.print(HotWaterOnDifferential); // Storage must be this much warmer than dhw to turn on pump
client.print("&#176;");
client.print("<br>");
client.print("DHW Off Diff. (DTemp2 vs DTemp1):");
client.print("&ensp;");
client.print(HotWaterOffDifferential); // If Storage is only this much warmer than dhw, turn off pump
client.print("&#176;");
client.print("<br>");
client.print("DHW Tank High Temp Limit:");
client.print("&ensp;");
client.print(DHW_HIGHTEMP_LIMIT ); // shut off when this temperature is reached
client.print("&#176;");
client.print("<br>");
client.print("<br>");
client.print("Heating Min Temp (DTemp2):");
client.print("&ensp;");
client.print(StorageTooCold ); // If Storage isn't hot enough, don't run heat exch pump
client.print("&#176;");
client.print("<br>");
client.print("Storage Tank High Limit:");
client.print("&ensp;");
client.print(HIGHTEMP_LIMIT ); // shut off when this temperature is reached
client.print("&#176;");
client.print("<br>");
client.print("<br>");
client.print("Circ Loop On Diff.(DTemp5 vs DTemp6):");
client.print("&ensp;");
client.print(Circ_Pump_On); //turn on circulation pump when deltaT hits this temperature
client.print("&#176;");
client.print("<br>");
client.print("Circ Loop Off Diff.(DTemp5 vs DTemp6):");
client.print("&ensp;");
client.print(Circ_Pump_Off); //turn off circualtion pump when deltaT hits this temperature
client.print("&#176;");
client.print("<br>");
client.print("<br></div>");
client.print("</td><td valign=\"top\" width=\"33%\" valign=\"top\" bgcolor=\"#419527\">");
client.print("<h3 align=\"center\">Energy</h3><div style=\"font-size:14px\">");
client.print("<br>");
client.print ("<div>");
client.print("Collectors Heat Gain:");
client.print("&ensp;");
if ((iii) <= (500*((meter1volume) /3.785411784)*(CreturnT-CSupplyT)))
{
client.print ("<span style=\"color:blue\"</span>");
client.println ((500*((meter1volume) /3.785411784)*(CreturnT-CSupplyT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter1volume) /3.785411784)*(CreturnT-CSupplyT)) / (3412.141633));
client.print ("KW");
}
else if ((ii) > (500*((meter1volume) /3.785411784)*(CreturnT-CSupplyT)))
{
client.print ("<span style=\"color:red\"</span>");
client.println ((500*((meter1volume) /3.785411784)*(CreturnT-CSupplyT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter1volume) /3.785411784)*(CreturnT-CSupplyT)) / (3412.141633));
client.print ("KW");
}
else
{
client.println ((500*((meter1volume) /3.785411784)*(CreturnT-CSupplyT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter1volume) /3.785411784)*(CreturnT-CSupplyT)) / (3412.141633));
client.print ("KW");
}
client.print("<br>");
client.print ("</div>");
client.print ("<div>");
client.print("Collectors Temp Rise:");
client.print("&ensp;");
if (digitalRead(PANEL_LEAD_PUMP_RELAY) == 0)
{
client.print ("<span style=\"color:blue\"</span>");
client.println(CreturnT-CSupplyT);
} else {
client.print("0");
}
client.print("&#176;");
client.print("<br>");
client.print ("</div>");
client.print ("<div>");
client.print("Collectors Flow Rate:");
client.print("&ensp;");
//client.println(Meter1->getCurrentFlowrate());
// client.println(meter1volume);
if ((iii) <= (meter1volume))
{
client.print ("<span style=\"color:blue\"</span>");
client.println (meter1volume);
}
else
{
client.println (meter1volume);
}
client.print("L/m");
client.print("&ensp;");
if ((iii) <= (meter1volume))
{
client.println ((meter1volume) /3.785411784);
}
else
{
client.println ((meter1volume) /3.785411784);
}
client.print("G/m");
client.print ("</div>");
client.print("<br>");
client.print ("<div>");
client.print("DHW Heat Loss:");
client.print("&ensp;");
if ((iii) <= (500*((meter2volume) /3.785411784)*(DhwSupplyT-DhwReturnT)))
{
client.print ("<span style=\"color:blue\"</span>");
client.println ((500*((meter2volume) /3.785411784)*(DhwSupplyT-DhwReturnT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter2volume) /3.785411784)*(DhwSupplyT-DhwReturnT)) / (3412.141633));
client.print ("KW");
}
else
{
client.println ((500*((meter2volume) /3.785411784)*(DhwSupplyT-DhwReturnT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter2volume) /3.785411784)*(DhwSupplyT-DhwReturnT)) / (3412.141633));
client.print ("KW");
}
client.print("<br>");
client.print ("</div>");
client.print ("<div>");
client.print("DHW Temp Drop:");
client.print("&ensp;");
if (digitalRead(DHW_PUMP_RELAY) == 0)
{
client.print ("<span style=\"color:blue\"</span>");
client.println(DhwSupplyT-DhwReturnT);
} else {
client.print("0");
}
client.print("&#176;");
client.print("<br>");
client.print ("</div>");
client.print ("<div>");
client.print("DHW Loop Flow Rate: ");
if ((iii) <= (meter2volume))
{
client.print ("<span style=\"color:blue\"</span>");
client.println (meter2volume);
}
else
{
client.println (meter2volume);
}
client.print("L/m");
client.print("&ensp;");
if ((iii) <= (meter2volume))
{
client.println ((meter2volume) /3.785411784);
}
else
{
client.println ((meter2volume) /3.785411784);
}
client.print("G/m");
client.print ("</div>");
client.print("<br>");
client.print ("<div>");
client.print("Heating Heat Loss:");
client.print("&ensp;");
if ((iii) <= (500*((meter3volume) /3.785411784)*(HeatingSupplyT-HeatingReturnT)))
{
client.print ("<span style=\"color:blue\"</span>");
client.println ((500*((meter3volume) /3.785411784)*(HeatingSupplyT-HeatingReturnT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter3volume) /3.785411784)*(HeatingSupplyT-HeatingReturnT)) / (3412.141633));
client.print ("KW");
}
else
{
client.println ((500*((meter3volume) /3.785411784)*(HeatingSupplyT-HeatingReturnT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter3volume) /3.785411784)*(HeatingSupplyT-HeatingReturnT)) / (3412.141633));
client.print ("KW");
}
client.print("<br>");
client.print ("</div>");
client.print ("<div>");
client.print("Heating Temp Drop:");
client.print("&ensp;");
if (digitalRead(STORAGE_HEAT_RELAY) == 0)
{
client.print ("<span style=\"color:blue\"</span>");
client.println(HeatingSupplyT-HeatingReturnT);
} else {
client.print("0");
}
client.print("&#176;");
client.print("<br>");
client.print ("</div>");
client.print ("<div>");
client.print("Heating Loop Flow Rate: ");
//client.println(Meter3->getCurrentFlowrate());
//client.println(meter3volume);
if ((iii) <= (meter3volume))
{
client.print ("<span style=\"color:blue\"</span>");
client.println (meter3volume);
}
else
{
client.println (meter3volume);
}
client.print("L/m");
client.print("&ensp;");
if ((iii) <= (meter3volume))
{
client.println ((meter3volume) /3.785411784);
}
else
{
client.println ((meter3volume) /3.785411784);
}
client.print("G/m");
client.print ("</div>");
client.print("<br>");
client.print ("<div>");
client.print("Circ Loop Heat Loss:");
client.print("&ensp;");
if ((iii) <= (500*((meter4volume) /3.785411784)*(supplyT-CircReturnT)))
{
client.print ("<span style=\"color:blue\"</span>");
client.println ((500*((meter4volume) /3.785411784)*(supplyT-CircReturnT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter4volume) /3.785411784)*(supplyT-CircReturnT)) / (3412.141633));
client.print ("KW");
}
else
{
client.println ((500*((meter4volume) /3.785411784)*(supplyT-CircReturnT)) /1000);
client.print ("Kbtu ");
client.println ((500*((meter4volume) /3.785411784)*(supplyT-CircReturnT)) / (3412.141633));
client.print ("KW");
}
client.print("<br>");
client.print ("</div>");
client.print ("<div>");
client.print("Circ Loop Temp Drop:");
client.print("&ensp;");
if (digitalRead(Circ_Pump_Relay) == 0)
{
client.print ("<span style=\"color:blue\"</span>");
client.println(supplyT-CircReturnT);
} else {
client.print("0");
}
client.print("&#176;");
client.print("<br>");
client.print("</div>");
client.print ("<div>");
client.print("Circ Loop Flow Rate: ");
//client.println(Meter4->getCurrentFlowrate());
//client.println(meter4volume);
if ((iii) <= (meter4volume))
{
client.print ("<span style=\"color:blue\"</span>");
client.println (meter4volume);
}
else
{
client.println (meter4volume);
}
client.print("L/m");
client.print("&ensp;");
if ((iii) <= (meter4volume))
{
client.println ((meter4volume) /3.785411784);
}
else
{
client.println ((meter4volume) /3.785411784);
}
client.print("G/m");
client.print ("</div>");
client.print("<br>");
client.print("</td>");
client.print("</tr>");
client.print("</table>");
client.println("</body></html>");
Serial.println(readString);
doreadStringAction();
readString = "";
client.stop();
}
}
}
}
}
//
//
//
void ReadDigitalTemperatures();
void setup() {
Serial.begin(115200);
// Initialize the PT1000 sensor
thermo.begin(MAX31865_4WIRE);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
// Print the IP address
Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
wifiserver.begin(); // start the server on port 8080
// prep the relay control pins
// setup pins as outputs
pinMode (PANEL_LEAD_PUMP_RELAY, OUTPUT);
pinMode (PANEL_LAG_PUMP_RELAY, OUTPUT);
pinMode (DHW_PUMP_RELAY, OUTPUT);
pinMode (STORAGE_HEAT_RELAY, OUTPUT);
pinMode (Circ_Pump_Relay, OUTPUT);
// set all pumps to off to begin -
digitalWrite (PANEL_LEAD_PUMP_RELAY, HIGH);
digitalWrite (PANEL_LAG_PUMP_RELAY, HIGH);
digitalWrite (DHW_PUMP_RELAY, HIGH);
digitalWrite (STORAGE_HEAT_RELAY, HIGH);
digitalWrite (Circ_Pump_Relay, HIGH);
// get a new FlowMeter instance for an uncalibrated flow sensor and let them attach their 'interrupt service handler' (ISR) on every rising edge
Meter1 = new FlowMeter(digitalPinToInterrupt(36), MySensor1, Meter1ISR, RISING);
#define meter1volume (Meter1->getCurrentFlowrate())
// do this setup step for every FlowMeter and ISR you have defined, depending on how many you need
Meter2 = new FlowMeter(digitalPinToInterrupt(39), MySensor2, Meter2ISR, RISING);
#define meter2volume (Meter2->getCurrentFlowrate())
// do this setup step for every FlowMeter and ISR you have defined, depending on how many you need
Meter3 = new FlowMeter(digitalPinToInterrupt(34), MySensor3, Meter3ISR, RISING);
#define meter3volume (Meter3->getCurrentFlowrate())
// do this setup step for every FlowMeter and ISR you have defined, depending on how many you need
Meter4 = new FlowMeter(digitalPinToInterrupt(35), MySensor4, Meter4ISR, RISING);
#define meter4volume (Meter4->getCurrentFlowrate())
#define CollectorTemperatureRise ((CreturnT) - (supplyT))
#define DhwTemperatureDrop ((DhwSupplyT) - (DhwReturnT))
#define HeatingTemperatureDrop ((HeatingSupplyT) - (HeatingReturnT))
#define CirculationTemperatureDrop ((supplyT) - (CircReturnT))
}
void loop() {
// read pt1000 value
float pt1000Val = pt1000();
// store pt1000 value in array
pt1000Values[pt1000Index] = pt1000Val;
// increment index and wrap around if necessary
pt1000Index = (pt1000Index + 1) % pt1000NumReadings;
// wait for a short time to allow other tasks to run
delay(10);
// report the last temperature reading
Serial.print("PT1000 Last Temperature Reading: ");
Serial.print(pt1000LastValue());
Serial.println(" F");
// report the average temperature
Serial.print("PT1000 Average Temperature: ");
Serial.print(pt1000AverageValue());
Serial.println(" F");
// float pt1000 = (thermo.temperature(RNOMINAL, RREF));
float pt1000Average = (pt1000AverageValue());
// Read the temperature from DTemp1
float DTemp1Val = DTemp1;
// Check if the temperature reading is valid
if (DTemp1Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp1NumReadings - 1; i >= 0; i--) {
if (DTemp1Values[i] != -196.60) {
DTemp1Val = DTemp1Values[i];
break;
}
}
}
// Store the reading in the array
DTemp1Values[DTemp1Index] = DTemp1Val;
// Increment the index and wrap around if necessary
DTemp1Index = (DTemp1Index + 1) % DTemp1NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp1 Last Temperature Reading: ");
Serial.print(DTemp1Val);
Serial.println(" F");
// Report the average temperature for DTemp1
DTemp1Average = DTemp1AverageValue();
Serial.print("DTemp1 Average Temperature: ");
Serial.print(DTemp1Average);
Serial.println(" F");
// Read the temperature from DTemp2
float DTemp2Val = DTemp2;
// Check if the temperature reading is valid
if (DTemp2Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp2NumReadings - 1; i >= 0; i--) {
if (DTemp2Values[i] != -196.60) {
DTemp2Val = DTemp2Values[i];
break;
}
}
}
// Store the reading in the array
DTemp2Values[DTemp2Index] = DTemp2Val;
// Increment the index and wrap around if necessary
DTemp2Index = (DTemp2Index + 1) % DTemp2NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp2 Last Temperature Reading: ");
Serial.print(DTemp2Val);
Serial.println(" F");
// Report the average temperature
DTemp2Average = DTemp2AverageValue();
Serial.print("DTemp2 Average Temperature: ");
Serial.print(DTemp2Average);
Serial.println(" F");
// Read the temperature from DTemp3
float DTemp3Val = DTemp3;
// Check if the temperature reading is valid
if (DTemp3Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp3NumReadings - 1; i >= 0; i--) {
if (DTemp3Values[i] != -196.60) {
DTemp3Val = DTemp3Values[i];
break;
}
}
}
// Store the reading in the array
DTemp3Values[DTemp3Index] = DTemp3Val;
// Increment the index and wrap around if necessary
DTemp3Index = (DTemp3Index + 1) % DTemp3NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp3 Last Temperature Reading: ");
Serial.print(DTemp3Val);
Serial.println(" F");
// Report the average temperature for DTemp3
DTemp3Average = DTemp3AverageValue();
Serial.print("DTemp3 Average Temperature: ");
Serial.print(DTemp3Average);
Serial.println(" F");
// Read the temperature from DTemp4
float DTemp4Val = DTemp4;
// Check if the temperature reading is valid
if (DTemp4Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp4NumReadings - 1; i >= 0; i--) {
if (DTemp4Values[i] != -196.60) {
DTemp4Val = DTemp4Values[i];
break;
}
}
}
// Store the reading in the array
DTemp4Values[DTemp4Index] = DTemp4Val;
// Increment the index and wrap around if necessary
DTemp4Index = (DTemp4Index + 1) % DTemp4NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp4 Last Temperature Reading: ");
Serial.print(DTemp4Val);
Serial.println(" F");
// Report the average temperature for DTemp4
DTemp4Average = DTemp4AverageValue();
Serial.print("DTemp4 Average Temperature: ");
Serial.print(DTemp4Average);
Serial.println(" F");
// Read the temperature from DTemp5
float DTemp5Val = DTemp5;
// Check if the temperature reading is valid
if (DTemp5Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp5NumReadings - 1; i >= 0; i--) {
if (DTemp5Values[i] != -196.60) {
DTemp5Val = DTemp5Values[i];
break;
}
}
}
// Store the reading in the array
DTemp5Values[DTemp5Index] = DTemp5Val;
// Increment the index and wrap around if necessary
DTemp5Index = (DTemp5Index + 1) % DTemp5NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp5 Last Temperature Reading: ");
Serial.print(DTemp5Val);
Serial.println(" F");
// Report the average temperature for DTemp5
DTemp5Average = DTemp5AverageValue();
Serial.print("DTemp5 Average Temperature: ");
Serial.print(DTemp5Average);
Serial.println(" F");
// Read the temperature from DTemp6
float DTemp6Val = DTemp6;
// Check if the temperature reading is valid
if (DTemp6Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp6NumReadings - 1; i >= 0; i--) {
if (DTemp6Values[i] != -196.60) {
DTemp6Val = DTemp6Values[i];
break;
}
}
}
// Store the reading in the array
DTemp6Values[DTemp6Index] = DTemp6Val;
// Increment the index and wrap around if necessary
DTemp6Index = (DTemp6Index + 1) % DTemp6NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp6 Last Temperature Reading: ");
Serial.print(DTemp6Val);
Serial.println(" F");
// Report the average temperature for DTemp6
DTemp6Average = DTemp6AverageValue();
Serial.print("DTemp6 Average Temperature: ");
Serial.print(DTemp6Average);
Serial.println(" F");
// Read the temperature from DTemp7
float DTemp7Val = DTemp7;
// Check if the temperature reading is valid
if (DTemp7Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp7NumReadings - 1; i >= 0; i--) {
if (DTemp7Values[i] != -196.60) {
DTemp7Val = DTemp7Values[i];
break;
}
}
}
// Store the reading in the array
DTemp7Values[DTemp7Index] = DTemp7Val;
// Increment the index and wrap around if necessary
DTemp7Index = (DTemp7Index + 7) % DTemp7NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp7 Last Temperature Reading: ");
Serial.print(DTemp7Val);
Serial.println(" F");
// Report the average temperature for DTemp7
DTemp7Average = DTemp7AverageValue();
Serial.print("DTemp7 Average Temperature: ");
Serial.print(DTemp7Average);
Serial.println(" F");
// Read the temperature from DTemp8
float DTemp8Val = DTemp8;
// Check if the temperature reading is valid
if (DTemp8Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp8NumReadings - 1; i >= 0; i--) {
if (DTemp8Values[i] != -196.60) {
DTemp8Val = DTemp8Values[i];
break;
}
}
}
// Store the reading in the array
DTemp8Values[DTemp8Index] = DTemp8Val;
// Increment the index and wrap around if necessary
DTemp8Index = (DTemp8Index + 1) % DTemp8NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp8 Last Temperature Reading: ");
Serial.print(DTemp8Val);
Serial.println(" F");
// Report the average temperature for DTemp8
DTemp8Average = DTemp8AverageValue();
Serial.print("DTemp8 Average Temperature: ");
Serial.print(DTemp8Average);
Serial.println(" F");
// Read the temperature from DTemp9
float DTemp9Val = DTemp9;
// Check if the temperature reading is valid
if (DTemp9Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp9NumReadings - 1; i >= 0; i--) {
if (DTemp9Values[i] != -196.60) {
DTemp9Val = DTemp9Values[i];
break;
}
}
}
// Store the reading in the array
DTemp9Values[DTemp9Index] = DTemp9Val;
// Increment the index and wrap around if necessary
DTemp9Index = (DTemp9Index + 1) % DTemp9NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp9 Last Temperature Reading: ");
Serial.print(DTemp9Val);
Serial.println(" F");
// Report the average temperature for DTemp9
DTemp9Average = DTemp9AverageValue();
Serial.print("DTemp9 Average Temperature: ");
Serial.print(DTemp9Average);
Serial.println(" F");
// Read the temperature from DTemp10
float DTemp10Val = DTemp10;
// Check if the temperature reading is valid
if (DTemp10Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp10NumReadings - 1; i >= 0; i--) {
if (DTemp10Values[i] != -196.60) {
DTemp10Val = DTemp10Values[i];
break;
}
}
}
// Store the reading in the array
DTemp10Values[DTemp10Index] = DTemp10Val;
// Increment the index and wrap around if necessary
DTemp10Index = (DTemp10Index + 1) % DTemp10NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp10 Last Temperature Reading: ");
Serial.print(DTemp10Val);
Serial.println(" F");
// Report the average temperature for DTemp10
DTemp10Average = DTemp10AverageValue();
Serial.print("DTemp10 Average Temperature: ");
Serial.print(DTemp10Average);
Serial.println(" F");
// Read the temperature from DTemp11
float DTemp11Val = DTemp11;
// Check if the temperature reading is valid
if (DTemp11Val == -196.60) {
// Replace with the previous valid temperature value in the array
for (int i = DTemp11NumReadings - 1; i >= 0; i--) {
if (DTemp11Values[i] != -196.60) {
DTemp11Val = DTemp11Values[i];
break;
}
}
}
// Store the reading in the array
DTemp11Values[DTemp11Index] = DTemp11Val;
// Increment the index and wrap around if necessary
DTemp11Index = (DTemp11Index + 1) % DTemp11NumReadings;
// Wait for a short time to allow other tasks to run
delay(10);
// Report the last temperature reading
Serial.print("DTemp11 Last Temperature Reading: ");
Serial.print(DTemp11Val);
Serial.println(" F");
// Report the average temperature for DTemp11
DTemp11Average = DTemp11AverageValue();
Serial.print("DTemp11 Average Temperature: ");
Serial.print(DTemp11Average);
Serial.println(" F");
// process the (possibly) counted ticks
Meter1->tick(period);
Meter2->tick(period);
Meter3->tick(period);
Meter4->tick(period);
// Read PT1000 from MAX31865
// Readpt1000Temperature();
// Read Digital Temps
ReadDigitalTemperatures();
//Temperature Probe Assignments
outsideT= DTemp3;
storageT= DTemp2;
dhwT = DTemp1;
CircReturnT = DTemp6;
supplyT = DTemp5;
CreturnT = DTemp4;
DhwSupplyT = DTemp7;
DhwReturnT = DTemp8;
HeatingSupplyT = DTemp9;
HeatingReturnT = DTemp10;
CSupplyT = DTemp11;
//panelT = pt1000();
panelT = pt1000LastValue();
/*
// get temperatures from devices
DTemp1 = sensors.getTempF(DSensor1);
DTemp2 = sensors.getTempF(DSensor2);
DTemp3 = sensors.getTempF(DSensor3);
DTemp4 = sensors.getTempF(DSensor4);
DTemp5 = sensors.getTempF(DSensor5);
DTemp6 = sensors.getTempF(DSensor6);
DTemp7 = sensors.getTempF(DSensor7);
DTemp8 = sensors.getTempF(DSensor8);
DTemp9 = sensors.getTempF(DSensor9);
DTemp10 = sensors.getTempF(DSensor10);
DTemp11 = sensors.getTempF(DSensor11);
*/
// Alarm if needed
Alarm();
// PUMP CONTROL: Control Panel Circ, Heat Exchanger Circ and DHW Circ Pumps
PumpControl();
// Update Serial Monitor
UpdateSerialMonitor();
// Print Wi-Fi signal strength to Serial Monitor
int32_t rssi = WiFi.RSSI();
Serial.print("Wi-Fi signal strength (RSSI): ");
Serial.println(rssi);
// Update webpage
WebReporting();
// delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment