I bought the MLX90640 breakout board from you ((#PI279072) and tried it out with an M5stack and the
software https://github.com/DIY-projects/M5Stack-MLX90640-Thermal-Camera as well as the Sparkfun
examples linked on the product page and I only get no acks. The Sparkfun example gives the following
MLX90640 IR Array Example
No ack read
Parameter extraction failed
followed by lots of
No ack read
No ack read
No ack read
GetFrame Error: -8
Pixel 0: 166.83C
Pixel 1: nanC
Pixel 2: nanC
Pixel 3: 507.73C
Pixel 4: nanC
Pixel 5: 507.79C
Pixel 6: nanC
Pixel 7: 507.73C
Pixel 8: nanC
Pixel 9: 507.79C
Is the device broken? Please help and tell me what to do.
I’d start by triple-checking your wiring. Does the M5Stack have pull-up resistors on the i2c pins?
I soldered the female right-angle header to the breakout board and crimped a female plug to a cable with a grove connector on the other end. The grove plugs into the M5Stack. I can not clearly see how the connections
are on the breakout board.
Do you have a multi-meter to check the voltage on the SDA and SCL lines? I have a suspicion there are no i2c pull-ups on the M5 Stack- albeit I cant’ see anything about a Grove connector in the schematic.
I checked the voltages I get 5V for the VCC on the grove plug and 3.8 for SDA and SCL respectively.
I also tried another I2C pinout on the bottom of the M5Stack and the MLX wasn’t even detected on the bus.
It seems to be very sensitive.
That may be because I2C was never meant to work down any length of wire- do you know what bus speed you might be running at?
I didn’t even know the M5 Stack existed until today- so I’m probably not going to be especially useful.
The bus speed is set to 400kHz in the example.I have no way to verify it. I will try with shorter cables and maybe set up a raspi to check if it works there. I will get back to you.
In this situation I’d be probing it with an oscilloscope. Otherwise it takes a lot of guesswork to figure out if it’s software, hardware or misbehaving electrons.
I did some more testing and switched from the esp32 M5Stack to a D1 Mini esp8266 and the MLX90640
worked fine with the Sparkfun test sketch. It seems that either the I2C connection with the M5Stack causes
some issues or the timing with the esp32.
That’s interesting- the example code you linked was written for the M5Stack so I would expect the combination is capable of working. It’s a really nice combo- too- the M5Stack display is a perfect 10x the pixel width/height of the thermal camera.
I’m glad you’re up and running, though, and sorry I couldn’t be of more help!
It seems the example was either for a Board built by M5Stack containing the MLX90640 which could be
found on aliexpress, but is not available right now, or there are also indications that it was used with the
Sparkfun Qwiic board, which they say has pull-ups for SDA and SCL. So I have to see if I put in some
pull-ups and try the M5Stack (or any of the other esp32 boards I tried, which don’t seem to work without
pull-ups) or use an esp8266 (maybe the Huzzah and a LCD wing). In the end is probably a question of
CPU speed needed and overcoming the esp32 I2C issues, which seem to be more than just the pull-ups
from what I could find.
FYI, I got it to work with the M5Stack. It was a combination of a bug i2c driver in the Arduino implementation of
the esp32 which is fixed in the github version and a small change in the file MLX90640_I2C_Driver.cpp
of the Sparkfun MLX90640 arduino examples. You have to remove the check for ack in MLX90640_I2CRead
and just use a plain
That seems to improve the timing in such a way that it suddenly works.
Yikes! I’m glad you’re up and running. The MLX90640 has definitely been one of the more challenging sensors to get working reliably. It really likes precise timing on the frame reads and I can’t seem to get it to work in any other way.
I’m currently adding generic Linux I2C support into the C library so we can run it alongside other sensors on the Pi. Seems to be a maximum of 8FPS at 400kHz which is the maximum speed for most SMBus devices.