Temperature compensated hygrometer

Temp and hygrometer

Temp and hygrometer

Temperature and relative humidity are important factors when you are working with Vrefs. DMM’s  but also the voltage reference (like in multimeters or calibration standards) Even a LM399 that has it’s own heater, shows the effects of these parameters. The resistors, pcb, connectors etc are responsible.

My lab has no  climate control so the second best thing is to measure temp and relative humidity.

The hardware is not very interesting. I use a Honeywell HIH-5031 humidity sensor. In the datasheet are the formulas to calculate the temperature effect. I measure the temperature and that value is used by the software. The temp sensor is a LM335. Both are connected to the ADC of a Atmel328. I wrote the program on a Arduino and used only the Atmel in the pcb for this meter. It is build on veroboard, nothing special.

 

 

 

#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

int RH_pin = A0;       // reading  HIH5031
int Temp_pin = A1;  // reading LM35
float RH;                     // RH%
float RH_V;
float RH_D;
float Temp;                // LM 35
float TempC;
char st1[20];            // float text

void setup()
{
lcd.begin(16, 2);
pinMode(RH_pin, INPUT);            // humidity sensor ADC
pinMode(Temp_pin, INPUT);       // LM35 ADC
}

void loop()
{
RH = analogRead(RH_pin);
delay(200);
Temp = analogRead(Temp_pin);
delay(200);
TempC = 0.038223939382* Temp;          // at 19.8C = 518 = 2,5291V
RH_D = ((0.0004 * TempC + 0.149) * RH)-(0.0617 * TempC + 24.436);

// 164 = 0,8V = 0%. 3,9=798 = 100%

lcd.setCursor(0,0);
lcd.print(“Temp = “);
printFloat(TempC,2,0,7);
lcd.setCursor(15,0);
lcd.print(“C “);

lcd.setCursor(0,1);
lcd.print(“RH% = “);
printFloat(RH_D, 2, 1, 7);
lcd.setCursor(15,1);
lcd.print(“%”);
}

void printFloat(float value, int places, int line, int positie)

{
int digit;
float tens = 0.1;
int tenscount = 0;
int i;
float tempfloat = value;
float d = 0.5;
if (value < 0)
d *= -1.0;
for (i = 0; i < places; i++)
d/= 10.0;

tempfloat += d;

if (value < 0)
{
tempfloat *= -1.0;
}
while ((tens * 10.0) <= tempfloat)
{
tens *= 10.0;
tenscount += 1;
}

lcd.setCursor(positie,line);

if (value < 0)
{
lcd.print(‘-‘);
}
if (tenscount == 0)
{
lcd.print(0, DEC);
}

for (i=0; i< tenscount; i++)
{
digit = (int) (tempfloat/tens);
lcd.print(digit, DEC);
tempfloat = tempfloat – ((float)digit * tens);
tens /= 10.0;
}
if (places <= 0)
{
return;
}

lcd.print(‘,’);

for (i = 0; i < places; i++)
{
tempfloat *= 10.0;
digit = (int) tempfloat;
lcd.print(digit,DEC);
tempfloat = tempfloat – (float) digit;
}
}

 

 

This entry was posted in Homebrew Projects, measurement projects. Bookmark the permalink.

Comments are closed.