Not so long ago Hemi345 introduced to the forum a Honeywell humidity sensor with good accuracy.
This looked good eventually got one to try its an smd package , I cheated and mounted it on a SOIC8 adapter board.
the sensor is sensitive to light so i'll mount this upsidedown on the mainboard.
The calculated ADC range is from 155 to 806 ( 0 to 100% RH)
the first few days the readings seem a couple of % lower probaly needed a burn in period lol!
the readings do fluctuate a little but I say this is probaly normal for this type of sensor.
To reduce noise and level out the reading we will average out ten readings we can also cheat and use this to good effect
to increase the resolution.For temperature correction we will use our ds18b20 temperature sensor all values we will
send to the serial terminal to be viewed.
This looked good eventually got one to try its an smd package , I cheated and mounted it on a SOIC8 adapter board.
the sensor is sensitive to light so i'll mount this upsidedown on the mainboard.
The calculated ADC range is from 155 to 806 ( 0 to 100% RH)
the first few days the readings seem a couple of % lower probaly needed a burn in period lol!
the readings do fluctuate a little but I say this is probaly normal for this type of sensor.
Code:
; Honeywell HIH-5030 / HIH-5031 analog humidity sensor
; VOUT = (VSUPPLY)(0.00636(SensorRH)+0.1515), typical at 25 °C
; SensorRH = ADCvalueRH -(zero offset) /(slope)
#picaxe 18m2 'version 2.D AXE132 marks
#terminal 4800
SYMBOL HIH5030 = C.1
SYMBOL ADCvalueRH = W0 SYMBOL SensorRH = W0
SYMBOL D0 = b2
SYMBOL D1 = b3
SYMBOL D2 = b4
SYMBOL D3 = b5
SYMBOL D4 = b6
Main:
ConvertSensorRH:
ReadADC10 HIH5030,ADCvalueRH
pause 4000
sertxd (CR, LF," ADCvalueRH = ",#ADCvalueRH)
SensorRH = ADCvalueRH -155 *2**50366
; SensorRH = ADCvalueRH -(0.1515*1023) /(0.00636*1023), typical at 25 °C
BinTOASCII ADCvalueRH,D4,D4,D3,D2,D1
IF D4 = "0" THEN : D4 = " " ' leading zero blanking
IF D3 = "0" THEN : D3 = " " : ENDIF ' leading zero blanking
ENDIF
sertxd (CR, " SensorRH = ",D4,D3,D2,".",D1,"%")
GOTO Main
to increase the resolution.For temperature correction we will use our ds18b20 temperature sensor all values we will
send to the serial terminal to be viewed.
Code:
; Honeywell HIH-5030 / HIH-5031 analog humidity sensor
; ADCvalueRH = RH% * 0.00636 + 0.1515 * 1023
; RH% = ADCvalueRH / 1023 - 0.1515 / 0.00636
#picaxe 18m2 'version 2.D AXE132 marks
#terminal 4800
SYMBOL DS18B20 = C.0
SYMBOL HIH5030 = C.1
SYMBOL ADCvalueRH = W0 SYMBOL SensorRH = W0 SYMBOL TrueRH = W0
SYMBOL Temperature = W0 SYMBOL TempMsb = b1 SYMBOL TempLsb = b0
SYMBOL T = W1
SYMBOL Average = W2
SYMBOL avr = b6
SYMBOL Sign = b7
SYMBOL D0 = b8
SYMBOL D1 = b9
SYMBOL D2 = b10
SYMBOL D3 = b11
SYMBOL D4 = b12
Main:
ConvertTemperature:
ReadTEMP12 DS18B20,T
Temperature = T
Sign = " " ' Display +
IF TempMsb > 127 THEN
Sign = "-" ' Display -
Temperature = - Temperature
ENDIF
Temperature = Temperature *8**51200 : GOSUB Blanking' Celsius(-55.00°C to 125.00°C)
sertxd (CR, LF, " Temperature ",Sign,D4,D3,D2,".",D1,D0,"°C")
Temperature = T
Sign = " " ' Display +
Temperature = Temperature +880 *16**46080 -6700
IF TempMsb > 127 THEN
Sign = "-" ' Display -
Temperature = - Temperature
ENDIF : GOSUB Blanking' Fahrenheit(-67.00°F to 257.00°F)
sertxd (CR, LF, " Temperature ",Sign,D4,D3,D2,".",D1,D0,"°F")
ConvertSensorRH:
Average = 0
FOR avr = 1 TO 10
ReadADC10 HIH5030,ADCvalueRH
Average = Average+ADCvalueRH
PAUSE 400
NEXT avr
sertxd (CR, LF," ADCvalueRH = ",#ADCvalueRH)
SensorRH = Average -1550 *2**50366 : GOSUB Blanking
; SensorRH = ADCvalueRH -(0.1515*1023) /(0.00636*1023), typical at 25 °C
sertxd (CR, LF, " SensorRH = ",D4,D3,D2,".",D1,D0,"%")
ConvertTrueRH:
T = T +880 *8**46208 +25526 : TrueRH = SensorRH *2**T : GOSUB Blanking
; TrueRH = (SensorRH)/(1.0546 - 0.00216T), T in °C
sertxd (CR, LF, " TrueRH = ",D4,D3,D2,".",D1,D0,"%", CR,LF, "------------------------")
GOTO main
Blanking: BinTOASCII TrueRH,D4,D3,D2,D1,D0
IF D4 = "0" THEN : D4 = " " ' leading zero blanking
IF D3 = "0" THEN : D3 = " " : ENDIF ' leading zero blanking
ENDIF : RETURN
Attachments
-
241.1 KB Views: 106
-
170.4 KB Views: 40
Last edited: