Pages: 1 [2] 3 4   Go Down
Author Topic: Arduino and MLX90620 16X4 pixel IR thermal array  (Read 34971 times)
0 Members and 2 Guests are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 1
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

anyone who can tell me if i should use the 60° or 40° FOV??
And should i need a Lens?


Thanks a lot.

Cu kami
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all
I am trying to communicate using SPI protocol between two arduino uno boards. I have writthen a very simple code to transfer a single character from master. The code is as following

#include <SPI.h>
#include "pins_arduino.h"

void setup (void)
{
}


void loop (void)
{

 
  digitalWrite(SS, HIGH);  // ensure SS stays high

  SPI.begin ();

  delay (5000);  // 5 seconds delay to start logic analyser.
 
  // enable Slave Select
  digitalWrite(SS, LOW);    // SS is pin 10
 
  // send test string
    SPI.transfer ( 'c');

 // disable Slave Select
 digitalWrite(SS, HIGH);

 // turn SPI hardware off
 SPI.end ();
 
 while (1);  //loop
}

Please correct the code if its not right. And I really want to know that how to recieve that character on arduino uno in slave mode. There is a command SPI.transfer() to send data on SPI where as I haven't seen any command to recieve it.

Thanks and regards

Hi, wrong topic...


Hi,

anyone who can tell me if i should use the 60° or 40° FOV??
And should i need a Lens?


Thanks a lot.

Cu kami

it depends on your intended application, and which one you can find (I was looking for the 40° version but futureelectronics had only the 60° one, so I bought that...)
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

i would like to make good picture for a distance like 1-2 meters. What is with a Lens? Do i need one?

Thx a lot.

Cu kami
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You won't get a good picture with 64 pixels.

with the 40° version @2m distance you'll get a horizontal view of 1,46 mt, so about 9 squared centimeters per pixel
with the 60° version @2m distance you'll get a horizontal view of 2,31 mt, so about 14 squared centimeters per pixel

I'm not familiar with lenses for this type of sensors, so nothing I can say about this could help you... I just know that the mlx90620 works just fine without them. I don't know if particular lens exists and could help to narrow the FOV
Logged

Taiwan
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

there have ready module via I2C
http://www.roboard.com/G212.html
Logged

SoC and Board Provider

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i am also really interested in building my own cheap camera, but i cannot get any sensor here in Germany.
Is there any chance to get some? Any tips?

Sourcing the part seems to be a problem.
I ordered one here from as-electronic (Germany): http://as-electronic.net/shop/article_MLX90620ESF-BAD/MLX90620ESF-BAD-16x4-IR-Matrix-Temperatursensor.html?sessid=00GGQRHtRxMwPyV6emEwYDQGYumL5IhN16aK7VHOgiTEIWxkFn615nzhkErgWGDs&shop_param=cid%3D18%26aid%3DMLX90620ESF-BAD%26

Shipped within two days.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Below are the temperature values I get. The sensor is pointing towards a wall, so the temperatures should be almost the same.
Code:
-43.29 -25.06 -20.19 -14.03 -17.91 -9.14  -28.29 -14.59 -13.57 0.49   -4.85  -14.13 -10.58 -0.23  -2.00  -4.07  
-16.22 6.06   3.53   -4.15  2.72   8.47   2.10   -3.24  1.14   7.40   9.65   1.90   -7.16  7.83   6.58   3.11  
3.07   6.51   8.03   1.24   3.46   0.64   8.97   0.92   1.76   7.03   4.71   3.91   7.54   12.93  7.92   7.25  
-7.14  5.69   8.91   4.91   4.54   5.32   8.59   1.41   5.62   8.11   10.34  2.61   6.35   -8.17  0.14   1.68

This is the calibration information from my sensor:
Code:
a_ij:
-87 -82 -86 -84 -78 -76 -70 -74 -74 -71 -71 -69 -72 -66 -66 -70
-66 -65 -65 -68 -70 -64 -62 -64 -63 -59 -62 -64 -58 -59 -58 -62
-60 -59 -56 -57 -57 -51 -55 -52 -53 -50 -53 -54 -54 -50 -49 -51
-45 -45 -48 -47 -47 -43 -44 -48 -48 -43 -45 -42 -45 -39 -44 -44

b_ij:
-60 -60 -60 -68 -51 -55 -51 -60 -51 -51 -51 -68 -60 -43 -43 -51
-47 -51 -47 -43 -34 -51 -43 -51 -47 -43 -43 -47 -43 -43 -43 -43
-43 -43 -43 -77 -34 -38 -43 -51 -38 -43 -43 -38 -43 -34 -34 -34
-38 -34 -43 -34 -34 -34 -34 -34 -30 -30 -34 -30 -34 -38 -43 -30

alpha_ij:
1.01E-8 1.29E-8 1.37E-8 1.36E-8 1.16E-8 1.48E-8 1.35E-8 1.48E-8 1.26E-8 1.57E-8 1.54E-8 1.50E-8 1.37E-8 1.53E-8 1.60E-8 1.61E-8
1.41E-8 1.69E-8 1.71E-8 1.65E-8 1.61E-8 1.78E-8 1.79E-8 1.69E-8 1.56E-8 1.75E-8 1.84E-8 1.82E-8 1.55E-8 1.84E-8 1.89E-8 1.82E-8
1.68E-8 1.94E-8 1.91E-8 1.90E-8 1.66E-8 1.79E-8 1.89E-8 1.76E-8 1.64E-8 1.77E-8 1.84E-8 1.73E-8 1.65E-8 1.66E-8 1.68E-8 1.68E-8
1.36E-8 1.57E-8 1.65E-8 1.51E-8 1.49E-8 1.49E-8 1.57E-8 1.54E-8 1.46E-8 1.41E-8 1.47E-8 1.29E-8 1.30E-8 1.26E-8 1.39E-8 1.29E-8

If you compare the calibration information (espc. a_ij and b_ij) with the temperature you will notice a correlation. Is my sensor miscalibrated?
If you have such an sensor, please print the calibration data and post it here. I'd like to know if other sensors have the same huge variance between each pixel.

EDIT: This was caused by useing 3.3V instead of the recommended 2.6V supply, despite that fact the specification says "3.6V max" smiley-sad
« Last Edit: February 09, 2013, 02:29:34 pm by rmie » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

small patch to calculate alpha_ij on the Arduino instead of a spreadsheet smiley

Code:
  float da0_scale = pow(2, -EEPROM_DATA[0xe3]);
  float alpha_const = (float)(((unsigned int)EEPROM_DATA[0xe1] << 8) + (unsigned int)EEPROM_DATA[0xe0]) * pow(2, -EEPROM_DATA[0xe2]);
  for(int i=0; i<=63; i++) {
    float alpha_var = (float)EEPROM_DATA[0x80 + i] * da0_scale;
    alpha_ij[i] = (alpha_const + alpha_var);
  }

Add it before the end of "void varInitialization(byte EEPROM_DATA[])".
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Closed on Mondays
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi maxbot and IlBaboomba - thank you very much for the example code! It got me started very quickly. I hope you don't mind, but I added quite a few comments so I could better understand the code. I also created a sketch to calculate the alphas.

The repo is here: https://github.com/nseidle/MLX90620_Example

One main improvement was the removal of float v_ir_tgc_comp[64]. v_ir_tgc_comp is only calculated once so an array of floats can be removed. This saves a good pile (256bytes) of RAM.

Let me know if you see any problems or changes that can be made. This is a neat (but expensive!) little sensor.
-Nathan

Code:
//Calculate the temperatures seen for each pixel
//Relies on the raw irData array
//Returns an 64-int array called temperatures
void calculate_TO()
{
  float v_ir_off_comp;
  float v_ir_tgc_comp;
  float v_ir_comp;

  //Calculate the offset compensation for the one compensation pixel
  //This is a constant in the TO calculation, so calculate it here.
  int cpix = readCPIX_MLX90620(); //Go get the raw data of the compensation pixel
  float v_cp_off_comp = (float)cpix - (a_cp + (b_cp/pow(2, b_i_scale)) * (Tambient - 25));

  for (int i = 0 ; i < 64 ; i++)
  {
    v_ir_off_comp = irData[i] - (a_ij[i] + (float)(b_ij[i]/pow(2, b_i_scale)) * (Tambient - 25)); //#1: Calculate Offset Compensation

    v_ir_tgc_comp = v_ir_off_comp - ( ((float)tgc/32) * v_cp_off_comp); //#2: Calculate Thermal Gradien Compensation (TGC)

    v_ir_comp = v_ir_tgc_comp / emissivity; //#3: Calculate Emissivity Compensation

    temperatures[i] = sqrt( sqrt( (v_ir_comp/alpha_ij[i]) + pow(Tambient + 273.15, 4) )) - 273.15;
  }
}
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

just got the chance to order a Panasonic GRID-Eye AMG8851 (5 Volt) or AMG8831 (3.3 Volt).

What did you think which one is better the MLX or the GRID-Eye?

Thanks a lot.

Cu kami83
Logged

France
Offline Offline
Faraday Member
**
Karma: 39
Posts: 3626
There is an Arduino for that
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

i would like to make good picture for a distance like 1-2 meters. What is with a Lens? Do i need one?

Thx a lot.

Cu kami
Probably a bit late to answer the question but it could help others.
I can't remember where I read it but if my memory don't fool me, the MLX90620 works in the 5µm to 16µm range. At those wavelength glass is black so you can't use classical optics.
Logged

NY
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all

I have been following this post for awhile and decided to try and implement the thermocam on the cheap thermocam website with the MLX90620. Using the some of the code on that site and Nathan's code I develop a Processing sketch and an associated Arduino sketch for the way I set things up. Since I borrowed so much of the code from the posts I decided to share what I have so far. Its operational but not perfect.

Here is the link: https://drive.google.com/folderview?id=0BwzZjH9KYYMDcXZEVmxUamY5ZEU&usp=sharing

Hope this helps.

* Thermal_Imager Processing Sketch.7z (9.37 KB - downloaded 47 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi CyberMerln and all,

Thank you for the information. I also did some tests with the MLX90620-BAB.
I was a bit disappointed by the results but I certainly still have code/configuration/tuning issues.

One simple test that fails is to light up a candle and (manually) move the sensor around so that each of the 64 pixel picks up the heat according to the move.

I do not currently have the time to investigate more but I was wondering if such a simple test worked ok for others (and I guess so!).

BTW, I did not use the spreadsheet but the code rmie posted earlier.

Cheers
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

thanks a lot for the answer. I am still thinking about buying the MLX90620 or the Grideye?

Cu kami
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Thanks for all the information and code.  I am trying to get this working on an arduino Mega2560, but it is not communicating at all.  Do I have to change something since the SDA/SCL ports (20 & 21) are different?  I also found according to the schematic that there are 2 hardware resistors pulled to +5v on the SDA and SCL ports.  Could that be the issue?

Thanks!
Logged

Pages: 1 [2] 3 4   Go Up
Jump to: