Show Posts
Pages: 1 [2] 3 4 ... 6
16  Community / Exhibition / Gallery / Re: Arduino and MLX90620 16X4 pixel IR thermal array on: January 04, 2013, 02:34:45 pm
Thanks a lot for your work, IlBaboomba !
I finished my code in a short time and all the recommendations you made are completely right.
Am I allowed to replace the code in my first post with yours ?
17  Using Arduino / General Electronics / Re: Connecting to a MLX90620 on: October 08, 2012, 02:47:59 pm
I got the MLX90620 working with the arduino, you can find the sketch and circuit diagramm here:,126244.msg949212.html#msg949212
18  Community / Exhibition / Gallery / Arduino and MLX90620 16X4 pixel IR thermal array on: October 08, 2012, 02:40:06 pm
Hello guys,
I want to share with you the code and wiring circuit to get the new MLX90620 working with the arduino. Like the well-known MLX90614, the sensor detects thermal radiation and measures temperatures without making contact with the object. The advantage of this sensor is that it can read 64 pixels at the same time VERY fast and accurate. For the price and size, it is a great thermal sensor.

Specifications of the sensor:
- Small size, cost effective 16X4 pixel, thermal array
- Active thermopile pixel technology for fast readout Easy to integrate
- Factory calibrated in wide temperature range: -40 to 85 °C for sensor temperature and -20 to 300 °C for object temperature. 2 Field Of View options: 60X15degrees or 40X10degrees
- High speed I2C digital interface for fast data transfer
- Programmable frame rate 0.5 to 64Hz.

45€ / 60$ for the 60° version ->
47€ / 65$ for the 40° version ->

You connect the MLX90620 to 3.3V over a diode, to break it down to the required 2.6V.
GND to GND, SCA to PIN 4 and SCL to PIN 5. Check out the official datasheet concerning the pin connections on the sensor.

Source Code - thanks to IlBaboomba for his various improvements:
 * Attention! I commented out the alpha_ij array, so if you're going to compile the sketch you'll get for sure an error.
 * You should replace all 64 values with the alpha_ij calculated using the values stored in your MLX90620's EEPROM.
 * I suggest you to make an EEPROM dump, print it on the Serial port and store it in a file. From there, with the help of a spreadsheet (Libreoffice, Google Docs, Excel...) calculate your own alpha_ij values.
 * Please also pay attention to your emissivity value: since in my case it was equal to 1, to save SRAM i cut out that piece of calculation. You need to restore those lines if your emissivity value is not equal to 1.

#include <i2cmaster.h>

int freq = 16;  //Set this value to your desired refresh frequency

int IRDATA[64];
int PIX, v_th, CPIX;
float ta, to, emissivity, k_t1, k_t2;
float temperatures[64];
int count=0;
unsigned int PTAT;
int a_cp, b_cp, tgc, b_i_scale;

int a_ij[64];
int b_ij[64];
//float alpha_ij[64] = {1.591E-8, 1.736E-8, 1.736E-8, 1.620E-8, 1.783E-8, 1.818E-8, 1.992E-8, 1.748E-8, 1.864E-8, 2.056E-8, 2.132E-8, 2.033E-8, 2.097E-8, 2.324E-8, 2.388E-8, 2.161E-8, 2.155E-8, 2.394E-8, 2.353E-8, 2.068E-8, 2.353E-8, 2.633E-8, 2.708E-8, 2.394E-8, 2.499E-8, 2.778E-8, 2.731E-8, 2.580E-8, 2.539E-8, 2.796E-8, 2.871E-8, 2.598E-8, 2.586E-8, 2.801E-8, 2.830E-8, 2.633E-8, 2.609E-8, 2.894E-8, 2.924E-8, 2.633E-8, 2.464E-8, 2.778E-8, 2.894E-8, 2.673E-8, 2.475E-8, 2.737E-8, 2.796E-8, 2.679E-8, 2.394E-8, 2.708E-8, 2.714E-8, 2.644E-8, 2.347E-8, 2.563E-8, 2.493E-8, 2.388E-8, 2.179E-8, 2.440E-8, 2.504E-8, 2.295E-8, 2.033E-8, 2.283E-8, 2.295E-8, 2.155E-8};  //<-- REPLACE THIS VALUES WITH YOUR OWN!
//float v_ir_off_comp[64];  //I'm going to merge v_ir_off_comp calculation into v_ir_tgc_comp equation. It's not required anywhere else, so I'll save 256 bytes of SRAM doing this.
float v_ir_tgc_comp[64];
//float v_ir_comp[64]; //removed to save SRAM, in my case v_ir_comp == v_ir_tgc_comp

void config_MLX90620_Hz(int Hz){
  byte Hz_LSB;
    case 0:
      Hz_LSB = B00001111;
    case 1:
      Hz_LSB = B00001110;
    case 2:
      Hz_LSB = B00001101;
    case 4:
      Hz_LSB = B00001100;
    case 8:
      Hz_LSB = B00001011;
    case 16:
      Hz_LSB = B00001010;
    case 32:
      Hz_LSB = B00001001;
      Hz_LSB = B00001110;

void read_EEPROM_MLX90620(){
  byte EEPROM_DATA[256];
  for(int i=0;i<=255;i++){
    EEPROM_DATA[i] = i2c_readAck();

void write_trimming_value(byte val){

void calculate_TA(){
  ta = (-k_t1 + sqrt(square(k_t1) - (4 * k_t2 * (v_th - (float)PTAT))))/(2*k_t2) + 25; //it's much more simple now, isn't it? :)

void calculate_TO(){
  float v_cp_off_comp = (float) CPIX - (a_cp + (b_cp/pow(2, b_i_scale)) * (ta - 25)); //this is needed only during the to calculation, so I declare it here.
  for (int i=0; i<64; i++){
    v_ir_tgc_comp[i] = IRDATA[i] - (a_ij[i] + (float)(b_ij[i]/pow(2, b_i_scale)) * (ta - 25)) - (((float)tgc/32)*v_cp_off_comp);
    //v_ir_comp[i]= v_ir_tgc_comp[i] / emissivity; //removed to save SRAM, since emissivity in my case is equal to 1.
    //temperatures[i] = sqrt(sqrt((v_ir_comp[i]/alpha_ij[i]) + pow((ta + 273.15),4))) - 273.15;
    temperatures[i] = sqrt(sqrt((v_ir_tgc_comp[i]/alpha_ij[i]) + pow((ta + 273.15),4))) - 273.15; //edited to work with v_ir_tgc_comp instead of v_ir_comp

void read_IR_ALL_MLX90620(){
  for(int i=0;i<=63;i++){
    PIX_LSB = i2c_readAck();
    PIX_MSB = i2c_readAck();
    IRDATA[i] = (PIX_MSB << 8) + PIX_LSB;

void read_PTAT_Reg_MLX90620(){
  PTAT_LSB = i2c_readAck();
  PTAT_MSB = i2c_readAck();
  PTAT = ((unsigned int)PTAT_MSB << 8) + PTAT_LSB;

void read_CPIX_Reg_MLX90620(){
  CPIX_LSB = i2c_readAck();
  CPIX_MSB = i2c_readAck();
  CPIX = (CPIX_MSB << 8) + CPIX_LSB;

void read_Config_Reg_MLX90620(){
  CFG_LSB = i2c_readAck();
  CFG_MSB = i2c_readAck();

void check_Config_Reg_MLX90620(){
  if ((!CFG_MSB & 0x04) == 0x04){

void varInitialization(byte EEPROM_DATA[]){
  v_th = (EEPROM_DATA[219] <<8) + EEPROM_DATA[218];
  k_t1 = ((EEPROM_DATA[221] <<8) + EEPROM_DATA[220])/1024.0;
  k_t2 =((EEPROM_DATA[223] <<8) + EEPROM_DATA[222])/1048576.0;
  a_cp = EEPROM_DATA[212];
  if(a_cp > 127){
    a_cp = a_cp - 256;
  b_cp = EEPROM_DATA[213];
  if(b_cp > 127){
    b_cp = b_cp - 256;
  tgc = EEPROM_DATA[216];
  if(tgc > 127){
    tgc = tgc - 256;

  b_i_scale = EEPROM_DATA[217];

  emissivity = (((unsigned int)EEPROM_DATA[229] << 8) + EEPROM_DATA[228])/32768.0;

  for(int i=0;i<=63;i++){
    a_ij[i] = EEPROM_DATA[i];
    if(a_ij[i] > 127){
      a_ij[i] = a_ij[i] - 256;
    b_ij[i] = EEPROM_DATA[64+i];
    if(b_ij[i] > 127){
      b_ij[i] = b_ij[i] - 256;

void Temperatures_Serial_Transmit(){
  for(int i=0;i<=63;i++){

void setup(){
  pinMode(13, OUTPUT);
  PORTC = (1 << PORTC4) | (1 << PORTC5);

void loop(){
  if(count ==0){ //TA refresh is slower than the pixel readings, I'll read the values and computate them not every loop.
  if(count >=16){
    count = 0;

You also need the I2CMaster library from here: (SCL_CLOCK has already been set to 400000)
This sketch transfers all 64 pixels to the computer over the serial window. For information about which pixel correspond to which position, check out the MLX90620 datasheet:

I originally intended to integrate this sensor into my Cheap-Thermocam project, but it did not make it at the end.
19  Community / Exhibition / Gallery / Re: Cheap-Thermocam | A cheap thermographic camera for everyone ! on: August 18, 2012, 07:12:46 am
Update: All parts for the new version are here - MLX90620 sensor is coming on Monday.

Trying to create the menu for the display now with touch implementation and sd store function  smiley
20  Using Arduino / Displays / Re: ITDB02 + Shield 2.0 = Touch not working on: August 17, 2012, 07:30:45 pm
Alright, solved the problem on my own smiley
I forget to call "" before reading the touch-coordinates and I changed the initialisation to "ITDB02_Touch  myTouch(15,8,14,9,10)".
21  Using Arduino / Displays / ITDB02 + Shield 2.0 = Touch not working on: August 17, 2012, 01:02:37 pm
Hello guys, I need your help:

I just received your ITDB02 Shield 2.0 in combination with the ITDB02-2.4E 2.4" TFT LCD Module on an Iteaduino 2.2.
Screen functions work fine so far. Now i want to show the X and Y positions from the touch controller on the display.
The problem with the new Shield 2.0 is that there is not output for the D_IRQ signal at all. The previous version (1.3) had this output on digital pin 8.
However, the ITDB02_Touch library requires this signal on its initialisation: ITDB02_Touch(TCLK, TCS, TDIN, TDOUT, IRQ);
Can you tell me how I can get touch function to work ?
Datasheet from my Shield:

My test-code:
#include <UTFT.h>
#include <ITDB02_Touch.h>

extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

UTFT myGLCD(ITDB24E_8,19,18,17,16);
ITDB02_Touch  myTouch(15,8,14,9,8);

void setup()
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);

void loop()
   while (myTouch.dataAvailable() == true)
      int x,y;
      x = myTouch.getX();
      y = myTouch.getY();
      myGLCD.printNumI(x, CENTER, 100);
      myGLCD.printNumI(x, CENTER, 120);

Thanks for your help !
22  Community / Exhibition / Gallery / Re: Cheap-Thermocam | A cheap thermographic camera for everyone ! on: March 02, 2012, 07:25:12 pm
This sounds really interessting.
I printed that page out and will read it through as soon as I have time  smiley

This is probably one of the best projects I have ever come across, and I almost have all of the necessary parts to begin my build.  I had one question,

Did you ever consider the technique of "stacking" a number of scans?  Even though the data is not video, it is pixel centric. The technique increases the signal-to-noise ratio and increases the dynamic range , by pixel.  Here, a 'pixel' is a data measure point in temperature, but it is related to a specific area that has been measured, just like a pixel of RGB would be in video.  The technique uses averaging and summing, so that the image can be , say put into a higher resolution , much like in photoshop, you take a low resolution image and convert it from 72dpi to 300dpi, you get much more definition. This works by using a stacking algorithm from the data in one image only, but true stacking lets you create a bitmap of higher resolution, and then fill in the data using from 2 to up to a hundred similar scans run through the stacking algorithm.   The concept is explained below in this astronomy website that covers the technology fairly well:

When I get my system built , I planned on trying it, however I wanted to run it by you to see if it made technical sense in this context.

Thanks so much for what you did.   Hope to hear from you soon.

23  Community / Exhibition / Gallery / Re: Cheap-Thermocam | A cheap thermographic camera for everyone ! on: September 30, 2011, 09:13:30 am
I came across your project and find it to be very interesting.  I'm wondering how your getting the actual image from a basic web camera without adding the necessary lense to see the the correct wavelengths?  Is what I'm seeing in the images a simulated thermal image through software?

No, this would not be possible. There is no filter for seeing thermal infrared, you need an ir sensor or thermopile for this.
I only added the webcam so that you can see an optical image of the scanned area. The MLX90614 infrared sensor then moves above that area like a scanner and measures the temperatures at many points. The computer software processes those data and creates a "thermal image" by transforming temperature values into specific colours.
That means you can not get a live stream of images, each takes time for the one single sensor to get across the area.
I hope you now understand what my project is about ;-)
24  Community / Exhibition / Gallery / Re: Cheap-Thermocam | A cheap thermographic camera for everyone ! on: September 25, 2011, 06:37:53 am
May I suggest you put a button on the final display to re-compute and re-display the data "logarithmically" to compress it and show up the finer details if so desired.

I currently have no time to get into this. If you have a mathematical approach how to compress the data logarithmically, I could implement it fast.

It also might be a good idea to have a custom scan resolution window so you can enter something like 5X64 for a quick scan to check for termites in the wall. That's what I'm trying to do with your scanner in my house. Every two or three years they attack it.

Good idea, I will include that in the next version.
25  Community / Exhibition / Gallery / Re: Cheap-Thermocam | A cheap thermographic camera for everyone ! on: September 03, 2011, 04:24:46 pm


I have already ordered most of the parts needed to build the Thermocam. I also wanted the fun of building it myself so, I guess just send me the links for the PCB and the case and I will order them. I will take the risk on the PCB not being correct.

Thank You in advance!


pm sent. i hope everything works  smiley
26  Community / Exhibition / Gallery / Re: Cheap-Thermocam | A cheap thermographic camera for everyone ! on: September 02, 2011, 06:20:29 pm
This is exactly what I have been looking for! I was looking for something to look for thermal leaks around my doors and windows. I was wondering when the enclosue and PCB might be ready for purchase? I can't wait to build this project! Thank You very much!


As I am currently out of money (student life is expensive  smiley ), I cant test the new version of the case (with modified servo mount) and the newly created PCB at the moment :-(
If you don't want to wait 1-2 months until i become "rich", you have 2 posibilities:
I give you the order links for both and a instruction on how to put everything together (should be a lot more easier than the current building process on the website), but there may be the possible risk that the PCB is not working correct (the case should be fine anyway).
Second, you send me the material and shipping costs in advantage. I order the components for you, put everything together here and try if it works. If I find any mistakes, i will solve them and if that is not possible immediately, I order a second revision of the pcb/case and pay it on my own. At the end, I sent the whole package to your home adress.
27  Community / Exhibition / Gallery / Re: Cheap-Thermocam | A cheap thermographic camera for everyone ! on: August 23, 2011, 11:43:06 am
Still dont understand something, i like your thermocam, but what is the maximum celsius degree that can be possible to mesure? I saw in the datasheet of the sensor the value, i dont understand what is the different..
And other thing: this thermocam is show the degrees in live? So i can use this thing to soldering with heat gun? I can see in live how to increase the degree?

Thank you!

You can measure temperatures from -70° to 370° Celsius. Objects above/under this range will have the temperature of -70° and 370°.
Concerning your second question: You can only see the temperature of one specific point live, not the whole image. The image is created by measuring a specific amount of  pixels in the measuring area one after another, just like a scanner does. But if you want to see for example how hot your soldering gun is, you can select single point measurement in the menu and then see how hot the object in front of the sensor is.
28  Community / Exhibition / Gallery / Re: Cheap-Thermocam | Thermal Imaging for around 100$ on: August 22, 2011, 05:47:17 pm
There is a new software version (2.0) which includes several new features and bugfixes.
I created a Printed Board so that no soldering will be required to build the device ( -> and an enclosure to make it stable and nice-looking ( ->
Both components will be available as soon as I have tested them for the material price of 20$ each.
29  Community / Exhibition / Gallery / Re: Cheap-Thermocam | Thermal Imaging for around 100$ on: August 16, 2011, 08:42:54 pm
Congratulations on winning the Jugend forscht  award. It's a great idea. I have built one but am having problems with it.
I can download the software to the eprom and if I open the serial port monitor and send a "1" it will go through the scanning process ok. When I fire up the "JAR" file it opens up, grabs  camera frames ok and when I press "START" the "remaining time: 70 seconds" screen comes up but nothing happens. The log file says "Error the arduino is not correctly connected". Now this is where I'm getting confused. Does all the output data go to the computer via the USB serial port or is an RS232 port (Null modem??) also needed? I guess I'm asking what port the "JAR" file expects to talk to the arduino board or do you have a connection diagram? Oh, while I'm here there may be a bug on your home page. The schematic sensor pinouts are back wards I.E. 1234 should be 4321 as pin 4 is GND and 3 is 3v3.

Hi Stephan,
its great you built my project  smiley The Java Software talks to the Arduino via the "virtual" USB Serial port (no extra port is required smiley-grin ). For this, the rxtx java library from is required. Have you already installed this library properly ? Follow the install instructions on their site and you will be fine i hope..
Concerning the schematic: I copied the sensor bottom view graphic from the official datasheet and therefore didn't adjust my own schematic to this one. I will fix the bottom view to avoid any confusion.
If you have further questions, feel free to write me an email (contact data on the official website).
30  Community / Exhibition / Gallery / Re: Cheap-Thermocam | Thermal Imaging for around 100$ on: May 26, 2011, 04:01:35 pm
Email from As-Electronics

Hi Johan,

Thank you for your mail. Today I received a delivery from Melexis the MLX90614ESF-BCI. The MLX90614ESF-DCI is specialy made for medical reasons. On page 31 in the datasheet you can find the differents.
For the MLX90614ESF-DCI, I don´t have a delivery date yet.

Best regards,
Matthias Schenzinger

Sales Engineer

I just wondered if the MLX90614ESF-BCI if could used in its place as still no delivery date on the MLX90614ESF-DCI . Spec's seem very similar according to the datasheets the only difference seems to be the supply voltage . Other wise will have to wait a little longer for the exact ir sensor.

I think you can use the BCI version without any problems. The supply voltage is also the same (3V). I don't know exactly if you can use the EEPROM Sketch with this version, but as it also work with other, more different models i hope there won't be any issue.
Pages: 1 [2] 3 4 ... 6