Hi,
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
output:
MLX90640 IR Array Example
MLX90640 online!
No ack read
Parameter extraction failed
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.
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.
Hello again,
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
Wire.endTransmission(false) ;
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.