sen0322 temperature calculations

userHead prbonin 2024-10-20 00:24:48 59 Views0 Replies

I'm working with a sen0322 and a Raspberry Pico W running micropython. I'm able to read data from sensor but so far I have found three different methods to get the O2 reading from the sensor and none of them gives a value that makes sense. I've been reading in 10 + 1 bits ( bit[0] is the device address) and my bytearray print out looks like this:

 

b's\xdf\x10j\x06\x02\x00\x00\x00\x00\xc4

 

I don't know why there's a j there and when I print out individual elements , 0 to 11, of the bytearray I get the following integers:

 

116, 223, 16, 106, 6 , 2, 0,0,0,0, 196 

 

converting back to hex gives me

 

x73, xdf, x10, x6a, x06, x02,x00,x00,x00,x00, xc4

 

I'm not sure what bytearray is doing here. 

 

Just clear  the bytearray buffer and tried the whole ordeal again. I ended up with the following inters and hex bits:

 

116, 223, 16, 106, 7, 8, 0,0,0,0, 196

x73, xdf, x10, x6a, x07, x08, x00,x00,x00,x00, xc4

 

So there is fluctuation in the data coming from the sensor which would be expected. So does anyone have a straight forward solution get the %vol from these integers and bits?