I2C mlx90614 temperature readout suddenly changes to 1037.55 °C

I use the mlx90614 temperature sensor with a Spark core. I use a simpel code making use of the pkourany/Adafruit-MLX90614-Library. The temperatures are stored in two variables which I read out via a web service (tinamous.com). After quite some time (first attempt 3 hours, second attempt about 26 h) the temperature reading change to 1037.55 °C. What could be the issue?

As far as I know on the chip are pull-up resistors included. The sensor is powered via VIN.

Did anyone had similar issues with the sensor or another I2C sensor?

Can you try taking two readings at once and throw out the first reading? I had to do this for another I2C sensor that I am using. First reading had about a 50% chance of being correct but the 2nd reading was always correct (so far anyways).

1 Like

I have an I2C sensor connected to a Spark Core that ‘suddenly’ stopped working a few days ago. I haven’t figured it out yet.

I forgot to mention that I’m reading out the spark variable every minute from the core. Suddenly the reading jumps to the high value and stays there until I repower the core.
What do you mean by reading out to values “at once”? Anyhow the reading should work always.

Hi @superholz

Maybe you should post your code so we can have a look.

What @wgbartley was suggesting is that your sensor does not always return good data the first time and reading it twice might make it work better.

There are some issues on the ST32F205 processor used in Photon with i2c. The manufacturer has an errata that shows some work-arounds which have been tried in the Photon firmware. These recommended work-arounds improved but did not fix all problems for all users, so a few new ideas have been tried, like doing a Wire.beginTransmission(addr); Wire.endTransmission(); to flush out i2c problems in the processor.

Hi @bko

here the code, it is the example sketch from the library adding a statement to expose a spark variable. I'm using the older core by the way with the newest firmware, I think. Do you know if the workaround you mentioned lead to a solution for other projects? The add variable is the I2C address of the sensor?

For convenience I did not remove the serial code. Could lead that to an overload over a long time?

#if defined (SPARK)
#include "Adafruit_MLX90614.h"
#else
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#endif
double tempC = 0;
double tempA = 0;
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
Serial.begin(9600);
Serial.println("Adafruit MLX90614 test");
mlx.begin();
Spark.variable("tempA", &tempA, DOUBLE);
Spark.variable("tempC", &tempC, DOUBLE);
}

void loop() {
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF());
Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");
tempC=mlx.readObjectTempC();
tempA=mlx.readAmbientTempC();
Serial.println();
delay(500);
}

Am having the same problem @superholz , I bought three photons now and there are all not working as required. They started behaving weird after i upload the similar code as yours using the same sensor Adafruit MLX90614. Am just depressed destroying three consecutive photons. I think it is because of the I2C library as well but am not sure. Please if anyone can help out how to get over this, it will be very much appreciated. Thanks…

CHECK THE POWER !!!
I meet with this problem and spend a lot of time.
This sensor VERY dependence from power. When I use this sensor with Arduino powered by USB and Arduino has any another devices connected - sensor drop to 1037 state. But when I connect Arduino to external power via power connector all is OK(in case when some another devices connected to Arduino). I think this case produced because power from USB is not enough and stable. May be STABLE is more important.
So, I recommend check your power and try to power from good stable source.