/******************************************************************************* * * Projeto 88 - Calculando o ponto de orvalho com um sensor DHT22 (3 métodos) * Adaptado por: Angelo Luis Ferreira * Referência: https://playground.arduino.cc/Main/DHT11Lib/ * Data: 19/08/2020 * http://squids.com.br/arduino * *******************************************************************************/ #include // Inclui a biblioteca no seu código dht DHT; // Cria um objeto da classe dht uint32_t timer = 0; void setup() { Serial.begin(9600); // Inicializa serial com taxa de transmissão de 9600 bauds (vezes por segundo) Serial.println("CÁLCULO DO PONTO DE ORVALHO"); Serial.println("SQUIDS ARDUINO"); Serial.println("\n"); } void loop() { // Executa 1 vez a cada 2 segundos if(millis() - timer>= 2000) { DHT.read22(A1); // uso do sensor DHT22 //DHT.read11(A1); // uso do sensor DHT11 // exibe temperatura, umidade e ponto de orvalho Serial.print("Temperatura = "); Serial.print(DHT.temperature,1); Serial.println(" ºC"); Serial.print("Umidade = "); Serial.print(DHT.humidity,1); Serial.println("%"); Serial.print("Ponto de Orvalho (método 1) = "); Serial.print(dewPoint(DHT.temperature, DHT.humidity),1); Serial.println(" ºC"); Serial.print("Ponto de Orvalho (método 2) = "); Serial.print(dewPointFast(DHT.temperature, DHT.humidity),1); Serial.println(" ºC"); Serial.print("Ponto de Orvalho (método 3) = "); Serial.print(dewPointSimple(DHT.temperature, DHT.humidity),1); Serial.print(" ºC"); Serial.println("\n"); timer = millis(); // Atualiza a referência } } // CALCULO DO PONTO DE ORVALHO (DEW POINT) =========================================================== //MÉTODO (1) - Referência: https://playground.arduino.cc/Main/DHT11Lib/ ============================= // dewPoint function NOAA // reference (1) : https://wahiduddin.net/calc/density_algorithms.htm // reference (2) : https://www.colorado.edu/geography/weather_station/Geog_site/about.htm // double dewPoint(double celsius, double humidity) { // (1) Saturation Vapor Pressure = ESGG(T) double RATIO = 373.15 / (273.15 + celsius); double RHS = -7.90298 * (RATIO - 1); RHS += 5.02808 * log10(RATIO); RHS += -1.3816e-7 * (pow(10, (11.344 * (1 - 1/RATIO ))) - 1) ; RHS += 8.1328e-3 * (pow(10, (-3.49149 * (RATIO - 1))) - 1) ; RHS += log10(1013.246); // factor -3 is to adjust units - Vapor Pressure SVP * humidity double VP = pow(10, RHS - 3) * humidity; // (2) DEWPOINT = F(Vapor Pressure) double T = log(VP/0.61078); // temp var return (241.88 * T) / (17.558 - T); } //MÉTODO (2) - Referência: https://playground.arduino.cc/Main/DHT11Lib/ ================================ // CÁLCULO PONTO DE ORVALHO RÁPIDO (DEW POINT FAST) // delta max = 0.6544 wrt dewPoint() // 6.9 x faster than dewPoint() // reference: https://en.wikipedia.org/wiki/Dew_point double dewPointFast(double celsius, double humidity) { double a = 17.271; double b = 237.7; double temp = (a * celsius) / (b + celsius) + log(humidity*0.01); double Td = (b * temp) / (a - temp); return Td; } //MÉTODO (3) =========================================================================================== // CÁLCULO PONTO DE ORVALHO APROXIMADAÇÃO SIMPLES // Referência: https://pt.wikipedia.org/wiki/Ponto_de_orvalho // Atenção: umidade acima de 50% a precisão é de +- 1ºC float dewPointSimple(float celsius, float humidity) { return (celsius - (100 - humidity)/5) - 0.5; }