12-21-2018 07:52 AM
Hi guys.
I collecting data from hih-6130-i2c and when i wanna convert incomings bits to number my temperature sits but humidity never. I think its problem in first byte.
S0 is status bit so it does not affect the resulting value but when i read firts byte i get wrong number.
127 is wrong right ? I need cut first bit ?
My other question is on the getting right forms 14 bits data.
Can I do that like this ?
Equation.
Solved! Go to Solution.
12-28-2018 05:00 AM - edited 12-28-2018 05:02 AM
Hi Yaamamoto,
Did you find out the solution to read correct values for the humidity on your sensor?
As datasheet of 6130 is showing as you mentioned - S1 and SO are only for status. But they are still bits, so they will be either 0 or 1, and when you don't cut them out, you would have 16 bits of data, not 14 (which is a resolution for both humidity and temperature measurement).
So cut out the first two bits for the humidity data.
See the snippet. You may come with better solution, but here we have two 8bits unsigned integers as a simulation of your Humidity Data Bytes. First, we set the first two bits for logical zero (therefore our DATA will not be affected by status bits). After this we use join numbers to create relevant data. Our S1, S0 were already "forced to false" in the for loop. Therefore I know, my number is actualy 14 bit only now and I can freely convert data type to fixed point (set for 14 bits with 14 bit word).
Note: Don't forget to cut out last two bits of the temperature data (in datasheet marked with grey X fields) - 14 bit resolution!
Hope this helps.
Regards,