Excessive MLX90614 read errors

https://www.sparkfun.com/products/10740

Sometimes, this will give me a reading but most of the time (85%) it gives me an error. And it’s not on a per-reading basis.

Usually if the first reading works, they all will work; if it fails, they all fail.

if (therm.read()) {
    current_temp = therm.object();  // as opposed to .ambient()
    sTemp = String(current_temp, 2);
  } else {
    current_temp = MAX_SAFE_TEMP+1; // assume the worst
    sTemp = "\"therm.read() failed\"";      
  }

I am calling

therm_init = therm.begin();

In setup(), which reports success. My host board is a https://learn.adafruit.com/introducing-itsy-bitsy-m0/

Does anyone know why this would fail.

The green LED is on constantly.

How are you connecting the two devices?

The SDA and SCL lines are connected to a Adafruit ItsyBitsy M0 Express SDA and SCL lines respectively.

‘GND’ and ‘3.3’ are connected to ‘G’ and ‘3’ on the Itsy.

Soldered.

Do you have access to an oscilloscope? If so, check the PWM output to see if that is also producing incorrect output and that will at least mean that you aren’t having an error with the I2C lines. You could also attach the PWM output and write some code to compute the duty cycle, but that is somewhat more work.

One or more bad connections. Rewire it, and make sure there are clean solder joints.

So I’ve been working on this exclusively for the past week.

We were not able to get this board working reliably. What we tried were combinations of:

Adafruit ItsyBitsy M0 Express

Elegoo Uno R3

Neither of these worked reliably. What we found was reliable is https://www.amazon.com/HiLetgo-MLX90614 … r_1_1_sspa with the R3.

There seem to be a few things going on here. it looks like to me (a software guy):

  1. The Sparkfun board uses 10k resistors, not 4.7 for i2c. (The blue board linked above uses 4.7k)

  2. The IR sensor uses a repeat-start variant of the protocol, and the Sprkfun library we are using might not take this into account, which might be relevant on Non ATMega boards like the Adafruit M0.

Today’s task is to try with the Adafruit Library to see if that might be different. I know for a fact that begin() is different, as Sparkfun returns isConnected(), but Adafruit always returns true. I have seen situations where the sparkfun library returns false, but temperature readings still happen!!

begin() example:

https://github.com/adafruit/Adafruit-ML … 14.cpp#L40

vs

https://github.com/sparkfun/SparkFun_ML … 14.cpp#L36

I’m nw thinking that the problem might be the chip on the board? Can we have two i2c hosts?

If I wire an arduino into the i2c lines, doesn’t ti have two hosts?

Yeah I think the two hosts is your issue, he board has an Arduino on it and that’s also accessing the MLX90614.

What you really want is [SEN-09570, it’s just the bare MLX90614 sensor without anything else attached.

Don’t know if it will work but you could try putting the ATmega328 on the eval board into reset and see if that allows your other board to communicate with the sensor. Holding the reset button down all the time would accomplish that as well as connecting the reset pin on the 6 pin AVR programming header to ground.](https://www.sparkfun.com/products/9570)

I have to then question why put the I2C pinouts on the board then? Maybe add a 0-ohm resistor to disable the CPU?

This was not mentioned in the documentation, but I think should have been. It was very frustrating.

Ideally what I wanted, and went with was https://www.amazon.com/HiLetgo-MLX90614 … 14-2530069 Which contains the i2C resistors and mounting holes.

The downside is the Sparkfun board works as long as you use the serial interface, but it consumes a serial port. Having a board that does both serial and i2c [reliably] is really what I was looking for since I only have to have one part to keep on hand and is really flexible.

Hopefully you’ll make a revision and update the documentation?

TS-Chris:
Yeah I think the two hosts is your issue, he board has an Arduino on it and that’s also accessing the MLX90614.

What you really want is [SEN-09570, it’s just the bare MLX90614 sensor without anything else attached.

Don’t know if it will work but you could try putting the ATmega328 on the eval board into reset and see if that allows your other board to communicate with the sensor. Holding the reset button down all the time would accomplish that as well as connecting the reset pin on the 6 pin AVR programming header to ground.[/quote]](https://www.sparkfun.com/products/9570)

You have the evaluation board, it’s not intended to be connected to another host via I2C, it has a host built in.

SDA and SCL are broken out for your convenience if you want to connect another I2C sensor to the board, they were not intended to connect to another host. Putting the ATmega328 into reset is a hack to allow connection to another host, another option would be to write your own firmware for the board that disables I2C so that another host can connect.