Close

added ability for changing ad sensitivity, hz and single shot mode

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/30/2018 at 06:380 Comments

https://github.com/jamesdanielv/thermal_cam_mlx90640

i modified the code to the files in the fullsensorreadToterminal file. now the file has settings at top that will be checked and if different rewritten into the sensor.

//below lines change important settings of sensor
#define continuousmode true //true is default when sensor is bought, however we want step mode. this is checked by the code and only written to if it is different than value here. it is here for experimentation.
#define hzMode 2//0=0.5hz,1=1hz,2=2hz,3=4hz,4=8hz,5=16hz,6=32hz,7=64hz 
#define adSensorResolution 2 //0=16bit,it 1=17bit, 2=18bit, 3=19b

the sketch now can store the calibration data of the sensor in progmem. this will be useful after i setup to extract the calibration values. currently the flash has my sensor settings in it, but you can load yours by first installing the included sketch getEEpromDump. and in terminal copy the output (command c, or cntrl c) after highlighting everything it asks you to, then pasting into fullsensorreadToterminal sketch.

the code in sketch reads the sensor data and compares to what it finds in progmem to the data on sensor, if it is not a match it will throw out errors at you, but it will allow you to process currently.

after that it checks the hz setting and the analog resolution presets as well as the step or continuous scan mode. if settings are different on sensor it writes the settings in firmware sketch and verifites that they match after a quick reboot of Arduino.

I would like to add that adafruit and melexis do not include code for switching camera modes, so i'm excited to have it included in this sketch. next update will have things hidden away into functions and some simpler commands.

anyway currently using 9344 bytes flash and 630 bytes ram. flash can shrink about 1-2k , bytes can go down about 50-100 with placing new features into functions, and reducing the debug flash usage.

after this small clean up, ill begin making use of the calibration data. i don't expect much more ram usage but the sketch might go up to 14-15k short term.

these are the functions i need to reimplement for calibration to work on arduino:

void ExtractVDDParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractPTATParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractGainParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractTgcParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractResolutionParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractKsTaParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractKsToParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractAlphaParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractOffsetParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractKtaPixelParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractKvPixelParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractCPParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

void ExtractCILCParameters(uint16_t *eeData, paramsMLX90640 *mlx90640)

int ExtractDeviatingPixels(uint16_t *eeData, paramsMLX90640 *mlx90640)

Discussions