Close

sensor works in image mode calibrated on atmega 1280 and on teensy LC

A project log for mlx90640 sensor works w 800 bytes

Everywhere i read people are excited to get mlx90640 working. here are examples using arduino w 800bytes ram, and 1k with calibrated DEG C

jamesdanielvjamesdanielv 09/02/2019 at 00:180 Comments

until now i have been working on getting accurate temp verified. this currently requires more math than the uno can handle without a 64bit library. short term i will include a 64 bit library, but the idea is to not need it. for example i modified the image function to work with less memory as well.

the teensy works in this mode as well, without need for the 64bit library as it internally is 32bit, and its number accuracy is 64bits for floats. (double precision). like i have stated earlier by using only sqrt, or only pow, the numbers will be in resolution with enough detail to work on uno. for now i will use the 64 bit math library if it works as a short term solution. If anyone wants to know the library's i'm testing for double precision float use they are here: 

https://github.com/mmoller2k/Math64

https://github.com/mmoller2k/Float64

the image function does not require this level of resolution detail of both large numbers and small numbers. and by default it works ok on Arduino mega as long as new method of mem managment is in use. (uno most likely works as well but not tested with this function remake yet)

i just rewrote (but have not uploaded the code yet) the image capture function to work with the new mem management; this is all part of me trying to verify old way and new way for similar operation. it uses 758 bytes at compile there are no large pointer calls that load onto stack either. max usage should be under 1k as far as i can tell (will prob never know for sure, but it will be close enough). 

here is the output of what mem usage is 

the image function does not require extreme range of math operations, so it works on the atmega, and more than likely will work on the uno at this point as well. i will update this log and add a link when i upload the code, currently there is no buffer so reading the sensors is slower, so i'm going to implement i2c buffer before i list the code. 

[placeholder here for when link is available]

I also want to clean up the code that does the upsample so it can be used more generally. so after this and the smart i2c cache for ram values of 64 words (128bytes) the code should run fast enough and be cleaner. the efficiency of i2c reads peaks at around 64bytes. currently i read only 2bytes at a time and this has a lot of overhead. it was for simplicity and to test it working. with buffer it will read about 8 times faster.

Discussions