Driver for the Melexis MLX90620 infrared temperature sensor array. 64 pixels in a 16 x 4 format. Updated driver for KL25Z
Melexis MLX90620 home page:
Note: I had to delete the original repository and start a new one due to issues I had with publishing. It should be at Rev 2, but it starts fresh at Rev 0. The reason for the new revision was basic ic2 command cleanup in order to work with the KL25Z board.
The datasheet for the MLX90620 can be found here: http://www.melexis.com/MLX90620
Note that the conversion-start process that is used in the mbed driver, the "Step" mode in section 9.3.2, is not longer in the datasheet. It was last described in the datasheet dated 20120620. Step mode was bit 6 of the Configuration Register 0x92, section 184.108.40.206, Table 10. Melexis claims that the temperature readings were not as accurate as the back-to-back-to-back "Normal" continous conversion method.
However, in my main.cpp code, I do start another conversion immediately after the current conversion completes and all of the sensor array RAM values have been read. Then, I perform all of the floating point math and update the display while the new conversion is taking place. At 4 conversions per second using the KL25Z board, there is about 110mS of idle time before the new conversion is ready to be read out. Reading bits 8 and 9 in the Configuration Register tell you when it is time to read the sensor array RAM values.
The datasheet says the the MLX90620 needs to operate at 2.6V for best performance (certain versions can operate up to 3.0V). Use an LDO from 3.3V to generate 2.6V. Though you could use a regular diode to drop 3.3V to 2.6V, it is not consistent from diode-to-diode and the voltage drop will vary with temperature. I highly recommend using an LDO. And don't forget to use bypass caps!!! BTW: Though the device VCC is limited to 2.6V, the i2c I/O pins can operate at 3.3V.
With an mbed1768, the MLX90620 operates with an i2c frequency of 400KHz and 4 feet of 4-wire cable. I have not tried 4 feet on the KL25Z, but it does work at 1 foot. The i2c pullup resistors are 2.2k.
In the overall program that I use for the MLX90620 (to be published), an mbed1768 can run with a USB Serial output of 921600 baud, whereas the KL25Z is limited to 115200 baud. Anything faster on the KL25Z, output characters get dropped.