Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Humidity and Temperature Data Fetch

Solved!
Go to solution

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.

image.png

 

S0 is status bit so it does not affect the resulting value but when i read firts byte i get wrong number.

image.png

127 is wrong right ? I need cut first bit ?

 

My other question is on the getting right forms 14 bits data.

image.png

 

Can I do that like this ?  

 

Equation.

image.png

0 Kudos
Message 1 of 2
(2,562 Views)
Solution
Accepted by topic author Yaamamoto

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).

 

NumConversion.png 

 

 

 

 

 

 

 

 

 

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,

Patrik
CTA, CLA
Helping (sharing) is caring!

If the post was helpful - Kudo it.
If the post answered your question - Mark it as Solution.
Message 2 of 2
(2,514 Views)