Go Down

Topic: MLX90620 / MLX90621 - 16X4 pixel IR thermal array (Read 109068 times) previous topic - next topic



I am very interested to measure temperature MLX90621.

With interest I read your information concerning the sensor.

For now I am looking for running the program for the Atmel ATmega328 or ATmega2560 processor.

I found a library in different Github but apparently not they work with Arduino Atmega 328 but tenesy (ARM CPU).


If someone could help me configure the software?

Can I use the current version of arduino or are other better (older)?

Thanks in advance for your information!

Best Regards.


Hi Roman,

I am using longjos code adapted from Max Ritter with no problems on both the Leonardo and the UNO (ATMRGA328) for the MLX90621 sensor

Adapted by https://github.com/longjos



Roman here is the end product !90% complete using the MLX90621 sensor, I embedded an ATMEL32U4 and a battery charger. Its still a work in progress but it should get you going in the correct direction.

I still need to add credits in the sketch


Attached is what I have so far.


here is the attachemt of the imager


Hi all, i'm using the BAA version with the 120° fox, and i'm experiencing some problem on the output, since the sensor at ambient temperature all seems to go ok, as soon as the die heats up beacouse of the envirnment the temperature start to become negative even for object around 70-80°C (Racing Tyres) i guess if some compensations for the BAA are missing from the library value KS4 in the datasheet.
Any help apreciated !


Hi Riodda,

1. What code are you using for reference?
2. WHat processor are you using? Teensy, UNO, Leonardo?
3. What voltage levels are you using to power the part.
4. Did you build an eval board or are you going straight from Breadboard and an Arduino?
5. What sensor MLX90620 or MLX90621?

When I first started playing around with this part, I was receiving eratic data due to flux on my PCB
and noise on VCC, data sheet says best ressults are with 2.6V for the MLX90621 operating MAX of 3.6
however MAX of 2.7V for best reliability. Check the ripple on the supply you are using to power the part.

Here is the sketch I used for the Thermal Imager unit Im working on :


All the low level headache work was done by programming gurus :) I just modified
the sketch for the TFT and some data formatting with a VB.net application I created.
This is the first time I have used Githib but I belive all due credit is there.

If you are thinking about building a shield I have a public PCB at OSH park :




Hi Mike, here is my details:

1. I'm using the code at the beginning of this post
2. I'm using Teensy 3.2
3. I'm powering the IC at 2.9V trough a diode from a 3.3 regulator (teensy's one)
4. I'm did build a board
5. 90621-BAA

I had a look to your code, but also there the KS4 coefficent for BAA is missing.
I'll have in the next prototype a 2.6 voltage rgulator. i had no flux neither big ripple, i'm ok with the board i think i have a software problem, when the IC heats up the temperatures heavly drift...


Hi Guys,

I had some guys work on interpolating the colours for me, here is a quick and dirty video.


Im using the battery charged unit to try and determine if the sensor can detect a child being left in a HOT car.
My rudimentary testing yesterday in a 150F degree environment (Inside my car here in California showed some promise. However I will need a narrower FOV. Code is in the youtube link if anyone wants to play around


Dear Mike, dear other MLX90621 users,

I ordered an Open Source Thermal Imager via Sandboxelectronics last month. It arrived right after Christmas.
It runs fine using a MLX90614 sensor, but when I try to use it with a MLX90621 (BAD) sensor array, the sensor is detected as MLX90621 and for a very short time (less than one second), I can see a temperature pattern on the TFT screen, which then turns into blue uniform color. The ambient temperature is always shown as 27.3x °C.
I think this behaviour is rather a sensor / library problem than an issue of your Thermal Imager. I also use the MLX90621 in a multicopter for surface temperature detection. The first array I bought, runs smoothly on an Arduino Mega using Max Ritter's library and robinvanemden's "readTemperatures.ino".
But three other arrays I bought, show the same issue, using them on an Arduino. The serial output is always:

cpix -3873
nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  0
nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  1
nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  2
nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  nan  3
ambient 27.37
config 18236
ptat 61617

The strange thing is: using the Melexis evaluation board for the 90621 the arrays work fine.
I doublechecked all possibilities  (pull up resistors, decoupling capacitors, stable voltage supply 2.6 / 2.7) I could think of, but I always end up with the "nan" readings.

I am an agricultural engineer with very limited skills in programming.

Could you give me a hint what might cause the issue with the MLX90621 using it with your Thermal Imager and the Arduino?

Best regards and a Happy New Year!


Hi Jabo,

Did you adjust the range on the Thermal Imager from SandBox? Use the scroll wheel and goto the "Range"
selection and click it. Then scroll to the left and set it to 20 to 25C by scrolling up or down. Then Scroll to the right and do the same thing for the upper range, ~ 30 to 35C. Then exit out and see if you see a difference.

What voltage rating is the MLX90621 you are using? In the upper right hand corner there is a voltage selection switch, make sure its set to the sensor voltage you are using.




Hi, I have already bought one of MikeSBlankenship's boards for personal use, I am now trying to get your code working on a Leonardo CJCMU board without the need for a screen, just the output information.  When I try to verify your code, I get the error " 'class MLX90621' has no member named 'get_PTAT' ".  This occurs at the line "Serial.print(sensor.get_PTAT()); // GET VALUE MIKEY".  What am I missing here?  Also, do you think your code will work in the absence of a screen, and if so, what changes to the wiring would be necessary to facilitate this?  Any help you could provide would be appreciated.


Also, does anyone know if I can grab a copy of the Eval software (windows gui) used by Mike Blankenship in his earlier posts?  I am trying to grab the data from the board, but would like to be able to visualize it in windows.


You can try the dev software I used here on a PC :

Make sure the .dll's and the .exe are in the same folder when you run it.




Is there a way to data log temperatures from an array sensor to excel file ?
Kindly suggest me the steps to do so.


Hi all,
I want to config the MLX90621 BAB to sleep mode. In MLX90621 Datasheet,  at page 30th, They said that "Entering this mode is initiated by writing '1' in the configuration register bit 7". I was set that bit but it didn't sleep as I was want. It still work. Can you help me for this problem. Thank you.
This is my code :
void MLX90621::setConfiguration() {
  //Elige taza de refresco
   byte cfg_LSB = refreshRate; //0bxxxxNNNN
  //elige resolucion (0b00 - 0b11)
  bitWrite(cfg_LSB, 5, (resolution >> 1) & 1); //0bxxxNnnnn
  bitWrite(cfg_LSB, 4, (resolution >> 0) & 1); //0bxxNnnnnn
  bitWrite(cfg_LSB, 7, (resolution >> 1) & 1); //0bNxnnnnnn
   byte defaultConfig_H = 0b01000110;  //kmoto: See data sheet p.11 and 25
   Wire.write((byte) cfg_LSB - 0x55);
   Wire.write(defaultConfig_H - 0x55);
   Wire.endTransmission();Looking forward to hearing peoples thoughts.

Go Up