05-29-2014 07:44 PM
I am testing the MLX90614 with an arduino mega board in Labview. I have no idea where these spikes are coming from.
Heres the Arduino code I am using
#include <i2cmaster.h>
void setup(){
Serial.begin(9600);
Serial.println("Setup...");
i2c_init(); //Initialise the i2c bus
PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups
}
void loop(){
int dev = 0x5A<<1;
int data_low = 0;
int data_high = 0;
int pec = 0;
i2c_start_wait(dev+I2C_WRITE);
i2c_write(0x07);
// read
i2c_rep_start(dev+I2C_READ);
data_low = i2c_readAck(); //Read 1 byte and then send ack
data_high = i2c_readAck(); //Read 1 byte and then send ack
pec = i2c_readNak();
i2c_stop();
//This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps
double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
double tempData = 0x0000; // zero out the data
int frac; // data past the decimal point
// This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
tempData = (double)(((data_high & 0x007F) << 😎 + data_low);
tempData = (tempData * tempFactor)-0.01;
float celcius = tempData - 273.15;
float fahrenheit = (celcius*1.8) + 32;
Serial.println(celcius);
delay(250); // wait a second before printing again
}
This is the image of the sketch in Labview
If anyone has an idea what is causing this then please help! Thanks!!!
05-29-2014 08:45 PM
I seen a video here http://www.youtube.com/watch?v=XTmQ0PhJnss
Maybe this is caused by not having a capacitor in place?
06-12-2014 12:44 PM
Hey Madmaz,
I am having the same exact problem here too. I am using ADT7420 temp sensor with arduino Uno. I am trying to plot the temperature from the sensor on LabVIEW and it just gives me spikes like those...
Don't know whether you have found the solution yet but I am still looking for one.
I guess it is somehow the serial connection between Arduino and LabVIEW, not needing a capacitor.