Go Down

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

Hi guys!
In my case, it seems the program stops at i2c_start_wait()
Could you help me to solve this?

I am sure the connection is correct. I connect to arduino 3v3 and regulated to 2v6 by LM317 as suggested. I also connect 4k7 resistors to scl and sda.

Any help is really appreciated. Thanks.

=========================
void read_EEPROM_MLX90620()
{
  i2c_start_wait(MLX90620_EEPROM_WRITE);
//STOPS HERE...... :-(
=========================

Paul1989

Hey All,

  I'm using the code from reply #23 (Mr.Sparkfun himself) to read data from the MLX90620.  It works, but I'm getting data that "jumps" around - i.e. there's sometimes a variation of 5 degrees between datasets when the sensor is pointed at nothing but the ceiling.  Anyone else experience this?  This is what I mean(I changed the output to Celcius - I'm Canadian!):
Code: [Select]
[size=10pt][size=10pt][size=10pt]
27.71 27.08 26.47 27.09 27.65 27.11 27.63 24.56 26.50 26.52 24.80 26.47 24.25 27.60 25.45 25.92
25.46 27.59 26.03 26.50 26.06 26.03 27.07 27.07 27.07 27.54 26.58 24.87 24.60 25.14 24.62 25.99
26.55 26.58 28.01 26.55 26.08 25.15 27.53 27.07 25.10 27.06 26.12 25.48 26.07 27.06 26.09 25.46
27.07 26.07 28.05 27.58 27.07 25.53 26.55 27.61 25.95 24.41 25.51 27.04 24.19 26.53 25.45 26.49

23.88 24.60 23.33 24.31 24.15 23.05 22.52 21.98 23.01 26.52 23.64 24.60 25.39 24.38 24.90 25.33
22.72 24.44 24.46 22.41 22.96 23.48 22.43 23.15 23.04 26.10 23.59 27.61 23.59 25.14 23.63 24.93
23.63 23.16 23.66 23.40 24.60 25.15 25.15 23.93 23.59 25.63 27.06 25.48 23.55 25.10 23.63 24.38
23.44 24.55 22.53 21.45 24.35 23.44 22.33 23.24 23.68 26.01 24.99 23.06 23.60 22.68 22.68 22.9 [/size][/size][/size]


I'm using a buck converter to output the 2.6volts from 3.3v supplied by the an Arduino with 4.7ohm resistors on  SDL and SDA.  In the commented intro to his code, he states that the wiring should be :
A5 to 330 ohm to SCL
A4 to 330 ohm to SDA
3.3V to VDD
GND to VSS

but I've read that the readings won't be too accurate using 3.3v.  Anyone have any ideas on where I'm going wrong?   

Cheers,

Paul

Paul1989

Yup, me again,

    Just wanted to see if anyone was willing to point this idiot in the right direction/give some clues as to how to log this data with a microSD card - I've been trying to use the SD library and going off their examples, but I've put over 20 hours into working on it, and I'm about to lose my mind. My card is good and the example SD codes work, it's just a matter of getting the two hashed together.... Please, someone have some pity on this poor soul!!  I can't take it anymore!!!

P

atyndall

#48
Oct 31, 2014, 04:57 am Last Edit: Oct 31, 2014, 04:59 am by atyndall Reason: Fix URLs
Hi all,

I'm not sure who still maintains interest in this, but for a research project I am using the MLX90260 in conjunction with an Arduino, and have rewritten the code herein to use the Wire library (as I couldn't find the right version of i2cmaster) as well as to be more readable.

My code computes all the necessary values, and outputs both the computed temperatures as well as the raw values over serial.

I'm using a Diecimila, which only has 1KB SRAM, meaning I don't actually have the space for a lot of the arrays, so there is a #define MORE_MEMORY present, which when disabled computes values on the fly to save memory (but slow down the refresh rate), but when enabled will use more arrays and thus more memory.

You can find the most up to date version of the code on Github.

I'll be continuously updating it, but as of writing the code looked like this.

Looking forward to hearing peoples thoughts.

Ash

Ruffy84

Hey Guys,

i'm from germany an having some troubles to get my MLX90620 running. I apologize in advance for my english...

Ok, here is my problem: I've noticed that my temperature readings are not accurate. Also i'm having a lot of noise and i tried a lot to improve supply quality but it doesn't help.

So i took a look on every parameter and there is a problem with the parameters tgc, a_cp, b_cp and so on...

The values are:

tgc = 0
a_cp = something over 1000
b_cp = something over 1000


When tgc is zero a big part of the calculation in the formulas equals 0. Furthermore a_cp and b_cp cannot have values over 127 according to the datasheet (8bit 2's complement).

It seems that every reading out of ram of a parameter of type 2's complement ist wrong, unsigned parameters seem to be correct.


Does anybody have an idea what the problem could be?


Thanks!

marcel90

Hi all,

I'm not sure who still maintains interest in this, but for a research project I am using the MLX90260 in conjunction with an Arduino, and have rewritten the code herein to use the Wire library (as I couldn't find the right version of i2cmaster) as well as to be more readable.

My code computes all the necessary values, and outputs both the computed temperatures as well as the raw values over serial.

I'm using a Diecimila, which only has 1KB SRAM, meaning I don't actually have the space for a lot of the arrays, so there is a #define MORE_MEMORY present, which when disabled computes values on the fly to save memory (but slow down the refresh rate), but when enabled will use more arrays and thus more memory.


You can find the most up to date version of the code on Github.

I'll be continuously updating it, but as of writing the code looked like this.

Looking forward to hearing peoples thoughts.

Ash

Nice Job!

Thank you very much.
I also couldn't find the right lib.

Best regards
Marcel


atyndall

#51
Jan 07, 2015, 04:10 am Last Edit: Jan 07, 2015, 04:17 am by atyndall
A further update to my code above: I have finalized the circuit that I am using to connect the Arduino and the MLX90620. I felt uncomfortable wiring the 3.3V connection to the sensor directly, as I feared it might cause garbled data or other issues, as it is near the edge of the acceptable voltage inputs.

Instead, I've purchased an Adafruit 4-channel I2C-safe Bi-directional Logic Level Converter - BSS138 which I use in the attached circuit diagram to allow the sensor to receive the recommended 2.6V power and communication signal.

It appears to be working fine, and as been for some time, but as with all electrical work; I won't guarantee that this circuit is correct, or that it will not harm your components in some way.

(I should also note that I can't take much credit for this circuit, as it was devised by someone with a lot more knowledge than I, and I've merely translated the physical copy into this diagram)

marcel90

Hi,

I got the same problem like Ruffy84 exactly for the first 10 temperatures every measurement.

I'm using the code of atyndall in a adapted version.
 
Code: [Select]
000 000 000 000 -1285 000 -1432 000 -1499 -1149 269 302 322 314 323 277 228 208 238 260 252 266 256 284 275 273 287 297 284 255 277 258 169 215 228 218 238 242 264 238 261 233 233 297 253 252 262 234 156 177 213 212 177 191 191 211 278 223 275 246 269 228 222 197

(every value was multiplied with 10)

Any ideas why the first 10 values are going to compute wrong?


Best regards
Marcel


Hi all,
Thank you very much for your code, it has helped me a great . :D

But i have some questions:

1. I used the I2CMaster library coded by Peter Fleury (http://homepage.hispeed.ch/peterfleury/avr-software.html#libs), and not sure it can be available for this code which coded by maxbot?

2. In my case, it seems the program stops at i2c_stop() when i read eeprom data in "read_EEPROM_MLX90620" function.

3. So i comment this code"i2c_stop()" in the function ,but finally the output temperatures is error at the same positions(0,1,2,3 and 5),this position seems no data.

My platform :Arduino Mega 2560 R3.

Thank you for all your assistance.

FC.CHANG.

maxbot

I attached the code for the MLX90621 in case someone wants a quick start to work with this nice upgraded version ;)

Hi all

Just got one of these mlx90620 sensors and also an mlx90621

Im new to all this and using this as a learning curve

Could someone please give me some pointers in the rite direction on how to display this data once I have programed my arduino pro mini with the code from this forum ?

Best regards,

Jono

 

ZiamG

#56
Mar 09, 2015, 03:17 am Last Edit: Mar 09, 2015, 03:24 am by ZiamG
Hi everyone,

I took the code maxbot & Baboomba originally posted on this forum and uncommented v_ir_comp[64], so that when I am calculating T_o, emissivity would always be accounted for. However, the code seems to be repeating in void setup().

I have attached the parts of the code that I modified but the rest of it is identical to the original post. If you run it as is, you well see that "initialization" will be repeated printed in the serial port.

Here is the link to the i2cmaster library that worked for me on the original code. II know a lot of ppl have been looking for it. http://bildr.org/2011/02/mlx90614-arduino/

Here I uncomment v_ir_comp. Note that I also am calculating each alpha_ij value as well. I have plenty of room, accuracy is my first priority.
Code: [Select]

/*
* 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.
* Page and section numbers refer to the MLX90630 Datasheet
*/

#include <i2cmaster.h>

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

int IRDATA[64];
byte CFG_LSB, CFG_MSB, PTAT_LSB, PTAT_MSB, CPIX_LSB, CPIX_MSB, PIX_LSB, PIX_MSB;
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];
int delta_alpha_ij[64];
float alpha_ij[64]; //I recalulcate alpha_ij in varInitialization function (nested inside read_EEPROM_MLX90620 function) during setup loop for automatic calibration

//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 because emmissivity == 1


Then I callculate v_ir_comp using emissivity
Code: [Select]

void calculate_TO(){ //Calculates the temperature seen from sensor in C (pg 16-19)
 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;        //if emissivity is not equal to one, this line should be used instead on the preceding line
   //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
 }
}


Finally, here is were the code repeats. I do not understand how void setup is able to loop.
Code: [Select]

void setup(){
 pinMode(13, OUTPUT);
 Serial.begin(115200);
 i2c_init();
 PORTC = (1 << PORTC4) | (1 << PORTC5);
 delay(5);
 Serial.println("initialization");
 read_EEPROM_MLX90620();
 config_MLX90620_Hz(freq);
 Serial.println("configuration done");

}



Please let me know what could be causing this. I am trying to multiplex four mlx90620's together to read tire temp on my university FSAE car, and if I can get over this hurdle, I should be able to finish my code.

Thanks everyone!

Hi maxbot,

Thank you very much for your code.

I got a problem when I use the "90620" sensor, the output temperature had big change.

I am wondering is the new sensor (90621) can be more stable?


Best regards,

FC.CHANG

riodda

Thanks for the fantastic work guys, i'm planning to use 4 of this sensors for measuring tyre temperature spread accros each wheel on a race car and then publish data trough canbus.
is it there a way to change the i2c address on the sensor to use 4 sensor on the same i2c line ? thanks.

riodda

Anybody has information about MLX90621ESF avilability in small quantyties? thanks

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy