Solar-Power IoT Device kit - temperature conversion from I2C to Beacon protocol

Announcements

From sunburn to sun earn – we’ve got the power! Watch our #poweringgreen videos now.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I want to import temperature values on Matlab, from the USB bridge.

   

To do so, I read the serial communication from the USB bridge to my computer:
0201041AFF310102150005000100001000800000805F9B013100013671CF
0201041AFF310102150005000100001000800000805F9B013100013571D4
0201041AFF310102150005000100001000800000805F9B013100013572D2

According to the Beacon protocol, the temperature is coded on a 8 bits-word, which is here 71, 71, then 72.

   

To understand how the temperature is coded, I looked into the Si7020_A10 datasheet (the humidity and temperature) sensor. This sensor uses a I2C protocol where the temperature is coded on a 16 bits-word, according to the following formula:
Temperature(°C) = 175.72*Temp_Code/65535 - 46.85.

   

Yet, I lack the temperature conversion from 16 bits-word to 8 bits word; and I couldn't find it in the I2C interface of the Motherboard.

   

Does anyone can help me please? 
 

0 Likes
1 Solution
Anonymous
Not applicable

Hello,

   

The sensor supports  16bit resolution, however we are utilizing only 8bit resolution.

   

PSOC4BLE device reads only the MSB of the temperature from Si7020, and the firmware associated with this is in line 366 of main.c and  in function Si7020_WriteRead. Hence for 8bit MSB temperature data the formula would be.

   

Temperature(°C) = 175.72*Temp_Code/256- 46.85.

   

This formula has been implemented in PMIC.exe and the mother board sends only the  8bit Temp_Code through USB.

   


Thanks

   

Sujay

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

Hello,

   

The sensor supports  16bit resolution, however we are utilizing only 8bit resolution.

   

PSOC4BLE device reads only the MSB of the temperature from Si7020, and the firmware associated with this is in line 366 of main.c and  in function Si7020_WriteRead. Hence for 8bit MSB temperature data the formula would be.

   

Temperature(°C) = 175.72*Temp_Code/256- 46.85.

   

This formula has been implemented in PMIC.exe and the mother board sends only the  8bit Temp_Code through USB.

   


Thanks

   

Sujay

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When there is an example for a sensor, why do you not address the sensor correctly? Transferring two bytes and receiving them instead of reducing the accuracy. Furthermore does the above formula not guarantee that under all circumstances (optimizations) the term

   

Temp_Code/256

   

is not calculated first and so leads to a false result because Temp_Code and 256 are both integers.

   

Hence

   

(double)Temp_Code / 256

   

would be safe.

   

 

   

Bob

0 Likes