diff --git a/ESP32/TempHumLoggerHomeKit/TempHumLogVizualization.xlsx b/ESP32/TempHumLoggerHomeKit/TempHumLogVizualization.xlsx index 449231a..12d1d55 100644 Binary files a/ESP32/TempHumLoggerHomeKit/TempHumLogVizualization.xlsx and b/ESP32/TempHumLoggerHomeKit/TempHumLogVizualization.xlsx differ diff --git a/ESP32/TempHumLoggerHomeKit/TempHumLoggerHomeKit.ino b/ESP32/TempHumLoggerHomeKit/TempHumLoggerHomeKit.ino index 91a8080..4cc03fe 100644 --- a/ESP32/TempHumLoggerHomeKit/TempHumLoggerHomeKit.ino +++ b/ESP32/TempHumLoggerHomeKit/TempHumLoggerHomeKit.ino @@ -9,7 +9,7 @@ #include "SD.h" #include "SPI.h" -#define Version "0.41" +#define Version "0.43" #define WIRE Wire #define DHTTYPE DHT22 #define DHTPIN 4 //GPIO04 D4 @@ -49,16 +49,29 @@ int menuL0 = 10; int menuL1 = 10; int menuL2 = 10; -float hum; -float humL; -float humM; -float humH; -float temp; -float tempL; -float tempM; -float tempH; -float heat_idx; +float temp = 0.0; +float tempH = 0.0; +float tempHCalc = 0.0; +float lastTempH = 0.0; +float tempM = 0.0; +float tempMCalc = 0.0; +float lastTempM = 0.0; +float tempL = 0.0; +float tempLCalc = 0.0; +float lastTempL = 0.0; +float hum = 0.0; +float humH = 0.0; +float humHCalc = 0.0; +float lastHumH = 0.0; +float humM = 0.0; +float humMCalc = 0.0; +float lastHumM = 0.0; +float humL = 0.0; +float humLCalc = 0.0; +float lastHumL = 0.0; + +float heat_idx; int secs; int mins; @@ -293,6 +306,19 @@ void setup() { quickBatteryVoltage2 = batteryVoltage; quickBatteryVoltage3 = batteryVoltage; quickBatteryVoltage4 = batteryVoltage; + + tempH = (dhtH.readTemperature()-0.16); + lastTempH = tempH; + tempM = (dhtM.readTemperature()+0.08); + lastTempM = tempM ; + tempL = (dhtL.readTemperature()+0.0); + lastTempL = tempL; + tempHCalc = ( tempH + lastTempH )/2; + tempMCalc = ( tempM + lastTempM )/2; + tempLCalc = ( tempL + lastTempL )/2; + humHCalc = ( humH + lastHumH )/2; + humMCalc = ( humM + lastHumM )/2; + humLCalc = ( humL + lastHumL )/2; //setup END //###################### } @@ -312,12 +338,12 @@ void loop() { tempH = (dhtH.readTemperature()-0.16); //kalibracja tempM = (dhtM.readTemperature()+0.08); //kalibracja tempL = (dhtL.readTemperature()+0.0); - hum = dht.readHumidity(); humH = (dhtH.readHumidity()+0.0); humM = (dhtM.readHumidity()-3.2); //kalibracja humL = (dhtL.readHumidity()+1.7); //kalibracja + // Compute heat index in Celsius (isFahreheit = false) heat_idx = dht.computeHeatIndex(temp, hum, false); @@ -680,6 +706,18 @@ void loop() { File file = SD.open("/TempHumLog.txt", FILE_APPEND); if (file) { display.fillRect(0, 0, 124, 64, SSD1306_WHITE); + tempHCalc = ( tempH + lastTempH )/2; + tempMCalc = ( tempM + lastTempM )/2; + tempLCalc = ( tempL + lastTempL )/2; + humHCalc = ( humH + lastHumH )/2; + humMCalc = ( humM + lastHumM )/2; + humLCalc = ( humL + lastHumL )/2; + lastTempH = tempH; + lastTempM = tempM; + lastTempL = tempL; + lastHumH = humH; + lastHumM = humM; + lastHumL = humL; file.print(leadZero(dayss)); file.print("/"); file.print(leadZero(months)); @@ -696,17 +734,17 @@ void loop() { file.print("; "); file.print(formatNumber(heat_idx)); file.print("; "); - file.print(formatNumber(tempH)); + file.print(formatNumber(tempHCalc)); file.print("; "); - file.print(formatNumber(humH)); + file.print(formatNumber(humHCalc)); file.print("; "); - file.print(formatNumber(tempM)); + file.print(formatNumber(tempMCalc)); file.print("; "); - file.print(formatNumber(humM)); + file.print(formatNumber(humMCalc)); file.print("; "); - file.print(formatNumber(tempL)); + file.print(formatNumber(tempLCalc)); file.print("; "); - file.println(formatNumber(humL)); + file.println(formatNumber(humLCalc)); file.close(); delay(1000); }