Anyone used a HIH6030 humidity sensor?
Posted: Wed Apr 06, 2016 8:57 am
I was wondering if anyone has used the HIH6030-021-001 humidity and temp sensor chip?
I have just added this part to an existing board and the temp readings don't seem to be real.
I get the following result most of the time. the humidity does seem to work if I breath on it.
any ideas as it seems odd that its half working?
PS
this is the first time that I've used I2C
I have just added this part to an existing board and the temp readings don't seem to be real.
Code: Select all
Sub SendBackHIH6030()
Dim RelativeHumidity As Word
Dim I2cTemparature As Word
Const StartW As Byte =$4e'(2*$27)
Const StartR As Byte =$4f'(2*$27)+1
SI2C.Start
SI2C.WriteByte(startw)
SI2C.Stop
DelayMS(100)
SI2C.Start
SI2C.WriteByte(startr)
RelativeHumidity.byte1=SI2C.ReadByte
SI2C.Acknowledge(I2C_ACKNOWLEDGE)
RelativeHumidity.byte0=SI2C.ReadByte
SI2C.Acknowledge(I2C_ACKNOWLEDGE)
I2cTemparature.byte1=SI2C.ReadByte
SI2C.Acknowledge(I2C_ACKNOWLEDGE)
I2cTemparature.byte0=SI2C.ReadByte
SI2C.Acknowledge(I2C_NOT_ACKNOWLEDGE)
SI2C.Stop
RelativeHumidity.14 = 0 'clear status bit
RelativeHumidity.15 = 0 'clear status bit
USART.Write(10,13,"RH=",FloatToStr(RelativeHumidity/163.8))
USART.Write(" Tempbin =",bintostr(I2cTemparature))
I2cTemparature = I2cTemparature>>2
USART.Write(" Tempraw2 =",dectostr(I2cTemparature))
USART.Write(" Temp=",FloatToStr(((I2cTemparature/16382.0)*165)-40))
End Sub
RH=27.344 Tempbin =111111101111111 Tempraw2 =8159 Temp=42.177
any ideas as it seems odd that its half working?
PS
this is the first time that I've used I2C