jamesdanielv / thermal_cam_mlx90640

same as thermal cam project but with mlx90640 sensor
16 stars 4 forks source link

fullsensorreadToterminal.zip works, but 32x24calibratedsensorRead.zip has wierd temperatures #2

Closed pjayathissa closed 5 years ago

pjayathissa commented 5 years ago

Hi James

Firstly, thanks for addressing my previous issue. I had another attempt, and fullsensorreadToterminal file works well. However I was having difficulty translating those values to temperature. Do you know what the formula is to convert the data provided by MLX90640_I2CRead(MLX90640_address, 0x0400+32*i, 32, mydata) into temperature?

The file 32x24calibratedsensorRead.zip still gives nans and a relatively constant temperature of around 28C even when I move hot surfaces over it.

jamesdanielv commented 5 years ago

MLX90640_I2CRead(MLX90640_address, 0x0400+32i, 32, mydata) reads data from sensor on serial wire bus (i2c) (https://i2c.info/). all this line does is read an address, and look for 32 words of data at a time. it reads multiple data at once to save on initialization time from i2c protocol. this line just grabs data it needs. it is done for various purposes thru code. start at address 400h+32i address, read 32 words, store mydata array.

to calculate temp look at CalculateTo function in MLX90640_SimpleDriver.h

it looks funky and complicated but it is just applying offsets from testing at factory, and then end of it is adjusting values to reduce noise.

i have rebuilt the sensor at home for troubleshooting, and i have run the code for 'fullsensorreadToterminal.zip' , and i see low amounts of change when i bring a lighter to within a foot of the sensor. temps do rise but only by a few degrees, so i see the same effect as you do.

let me look into the code tonight, and see where the bug is. thanks for bringing this to my attention. i will leave this issue open until i feel that a fix is updated. this code is still in development, but you can read on how the sensor temp is calculated below

here: https://github.com/jamesdanielv/thermal_cam_mlx90640/blob/master/MLX90640-Datasheet-Melexis.pdf

and here https://github.com/jamesdanielv/thermal_cam_mlx90640/blob/master/MLX90640%20driver.pdf

search for 'To'

all of this of course, and my thinking on it is documented here on hackaday https://hackaday.io/project/161499-mlx90640-sensor-works-w-800-bytes

jamesdanielv commented 5 years ago

this issue is being addressed in the /thermal_cam_mlx90640/update folder. another thing is that even with using normal functions the heat from the end of the lighter does not change temp that much. a better test would be from a solder iron. the reason is the flame is heat in the visible spectrum, and the sensor only sees heat from emitted light from objects. so only if the tip of the lighter heated up enough to be seem would it show. this is why a solder iron would work much better to check for temp variances. however just compiling code from the updates folder you can see output by waving your hand in front of it slowly. (terminal takes time to update) code will shrink back down to work on arduino as i verify side and compare each function i have converted

here is a video of how to check when code loaded https://github.com/jamesdanielv/thermal_cam_mlx90640/blob/master/Updates/terminal64x48.mov

it again only works for devices with 32k or more of ram, however it will shrink back down to work on arduino again.