THERMOHYGROMETER BY WET AND DRY THERMOMETER

This is an alternative to measuring relative humidity using the principle of dry and wet thermometer. Usually the relative humidity is measured using a DHT22 or DHT11 sensor. DHT22 or DHT11 is reliable enough to be used in a room with a constant humidity, when DHT22 or DHT11 is used in a place with extreme humidity and fluctuating, over time the resulting relative humidity value is no longer true. Measurement of relative humidity using the principle of dry and wet thermometer using two temperature sensors DS18S20, one sensor is wrapped with a cotton cloth soaked, cloth dipped in a water container, in this water container installed a sensor to keep the water available, if water drops below the level, a peristaltic pump will fill from the water reservoir.
The generated data can be read on a serial monitor or transferred via Bluetooth. In this project we chose to transfer via Bluetooth because the sensor is outside the house while the receiver of the data is inside the house.

This project is the application or incorporation of other previous projects :

DS18S20 DOUBLE

SETUP BLUETOOTH MODULE AS MASTER OR SLAVE

SETUP BLUETOOTH WITH FTDI232

LCD I2C SETUP

for further optional development in transmitter you also can see https://arduinoproyek.wordpress.com/thermohygrometer-by-wet-and-dry-thermometer-with-led-matrix/

SENSOR/ DATA TRANSMITTER

DS18S20B Heat index

The code can be downloaded at:

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

#include <OneWire.h>
int DS18S20_Pin1 = 2; //DS18S20 Signal pin on digital 2
int DS18S20_Pin2 = 3;
//Temperature chip i/o
OneWire ds1(DS18S20_Pin1); // on digital pin 2
OneWire ds2(DS18S20_Pin2);
float a;
float b;
float c;
float d;
float e=2.71828182845904;
float f=0.6687451584;
float g;
float k1=-8.78469475556;
float k2=1.61139411;
float k3=2.33854883889;
float k4=-0.14611605;
float k5=-0.012308094;
float k6=-0.0164248277778;
float k7=0.002211732;
float k8=0.00072546;
float k9=-0.000003582;
#define motorpin 5
void setup(void) {
Serial.begin(9600);
pinMode(motorpin, OUTPUT);
}
void loop(void) {
int sensorValue0 = analogRead(A0);
if (sensorValue0 <= 100) {
getData1();
}
if (sensorValue0 > 100) {
getData2();
}
}
float getTemp1(){
//returns the temperature from one DS18S20 in DEG Celsius
byte data1[12];
byte addr1[8];
if ( !ds1.search(addr1)) {
//no more sensors on chain, reset search
ds1.reset_search();
return -1000;
}
if ( OneWire::crc8( addr1, 7) != addr1[7]) {
Serial.println(“CRC is not valid!”);
return -1000;
}
if ( addr1[0] != 0x10 && addr1[0] != 0x28) {
Serial.print(“Device is not recognized”);
return -1000;
}
ds1.reset();
ds1.select(addr1);
ds1.write(0x44,1); // start conversion, with parasite power on at the end
byte present = ds1.reset();
ds1.select(addr1);
ds1.write(0xBE); // Read Scratchpad

for (int i = 0; i < 9; i++) { // we need 9 bytes
data1[i] = ds1.read();
}

ds1.reset_search();

byte MSB = data1[1];
byte LSB = data1[0];
float tempRead = ((MSB << 8) | LSB); //using two’s compliment
float TemperatureSum = tempRead / 16;

return TemperatureSum;

}

float getTemp2(){
//returns the temperature from one DS18S20 in DEG Celsius
byte data2[12];
byte addr2[8];
if ( !ds2.search(addr2)) {
//no more sensors on chain, reset search
ds2.reset_search();
return -1000;
}
if ( OneWire::crc8( addr2, 7) != addr2[7]) {
Serial.println(“CRC is not valid!”);
return -1000;
}
if ( addr2[0] != 0x10 && addr2[0] != 0x28) {
Serial.print(“Device is not recognized”);
return -1000;
}
ds2.reset();
ds2.select(addr2);
ds2.write(0x44,1); // start conversion, with parasite power on at the end
byte present = ds2.reset();
ds2.select(addr2);
ds2.write(0xBE); // Read Scratchpad

for (int i = 0; i < 9; i++) { // we need 9 bytes
data2[i] = ds2.read();
}

ds2.reset_search();

byte MSB = data2[1];
byte LSB = data2[0];
float tempRead = ((MSB << 8) | LSB); //using two’s compliment
float TemperatureSum = tempRead / 16;

return TemperatureSum;

}

void getData1(){
digitalWrite(motorpin, HIGH);
float temperature1 = getTemp1()+1;
float temperature2 = getTemp2()+1;
float td=temperature1;

c=17.502*temperature1/(240.97+temperature1);
d=17.502*temperature2/(240.97+temperature2);
a=6.112*pow(e,c);
b=6.112*pow(e,d);
g=((b-f*(1+0.00115*temperature2)*(temperature1-temperature2))/a)*100;
float hi = k1+k2*td+k3*g+k4*td*g+k5*pow(td,2)+k6*pow(g,2)+k7*pow(td,2)*g+k8*td*pow(g,2)+k9*pow(td,2)*pow(g,2);
Serial.print(temperature1);
Serial.print(” “);
Serial.print(temperature2);
Serial.print(” “);
Serial.print(g);
Serial.print(” “);
Serial.println(hi);

delay(100); //just here to slow down the output so it is easier to read
}

void getData2(){
digitalWrite(motorpin, LOW);
float temperature1 = getTemp1()+1;
float temperature2 = getTemp2()+1;
float td=temperature1;

c=17.502*temperature1/(240.97+temperature1);
d=17.502*temperature2/(240.97+temperature2);
a=6.112*pow(e,c);
b=6.112*pow(e,d);
g=((b-f*(1+0.00115*temperature2)*(temperature1-temperature2))/a)*100;
float hi = k1+k2*td+k3*g+k4*td*g+k5*pow(td,2)+k6*pow(g,2)+k7*pow(td,2)*g+k8*td*pow(g,2)+k9*pow(td,2)*pow(g,2);
Serial.print(temperature1);
Serial.print(” “);
Serial.print(temperature2);
Serial.print(” “);
Serial.print(g);
Serial.print(” “);
Serial.println(hi);

delay(1000); //just here to slow down the output so it is easier to read
}

DATA RECEIVER

DS18S20B Heat index recv

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin,BACKLIGHT_PIN,POSITIVE);
LCD *myLCD = &lcd;
float state1;
float state2;
float state3;
float state4;
void setup() {
Serial.begin(9600); // Default communication rate of the Bluetooth module
lcd.begin(16,2); // initialize the lcd
lcd.home ();
}
void loop() {

if(Serial.available() > 4){ // Checks whether data is coming from the serial port
//lcd.clear();
float state1 = Serial.parseFloat(); // Reads the data from the serial port
Serial.print(state1);
Serial.print(” “);
lcd.setCursor(0, 0);
lcd.print(“TD=”);
lcd.setCursor(3, 0);
lcd.print(state1);
//delay(50);
float state2 = Serial.parseFloat();
Serial.print(state2);
Serial.print(” “);
lcd.setCursor(8, 0);
lcd.print(“TW=”);
lcd.setCursor(11, 0);
lcd.print(state2);
//delay(50);
float state3 = Serial.parseFloat();
Serial.print(state3);
Serial.print(” “);
lcd.setCursor(0, 1);
lcd.print(“RH=”);
lcd.setCursor(3, 1);
lcd.print(state3);
//delay(50);
float state4 = Serial.parseFloat();
Serial.println(state4);
lcd.setCursor(8, 1);
lcd.print(“HI=”);
lcd.setCursor(11, 1);
lcd.print(state4);
//delay(50);
}
//delay(100);
}

RH1

RH2

RH3