MLX90640 issue
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
MLX90640 issue
I have one of you MLX90640 – 110 degree fov but i have some issues with her. I am trying to run it with an Arduino DUE and i tried your exemple MLX90640_simpletest.ino but it does not work. First of all, sometimes it does not found the camera so i just unplug and plug back my 3.3V cable and run back the code and it works. But when it works and found the camera, the function setMode, setResolution, and setRefreshRate do not work. I did some side test and i figure out that even the function getMode, getResolution and getRefreshRate do not work. And of course the function getFrame do not work i have a succesion of « nan » and « 0.0 ». I think there is an issue with the I2C communication. I did some test and figure out that the I2C_Write function return -2 sometimes so that mean that the write did not work. But maybe the I2C_Read do not work either I do not know. I also tried Melexis’ librairy but it do not work either. Do you know how I can fix this problem. The camera and the arduino DUE card are new. And i plug the cables on the good place.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: MLX90640 issue
Please post some photos showing all of your soldering and connections.
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
Re: MLX90640 issue
Here are some photos of my Arduino card connected with camera.adafruit_support_bill wrote: ↑Tue May 30, 2023 4:59 am Please post some photos showing all of your soldering and connections.
- Attachments
-
- unnamed (2).jpg (974.8 KiB) Viewed 555 times
-
- unnamed (1).jpg (808.16 KiB) Viewed 555 times
-
- unnamed.jpg (643.74 KiB) Viewed 555 times
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
Re: MLX90640 issue
And here is a screenshot of my serial monitor when i run the simpletest exempleadafruit_support_bill wrote: ↑Tue May 30, 2023 4:59 am Please post some photos showing all of your soldering and connections.
- Attachments
-
- Image2.jpg (34.94 KiB) Viewed 554 times
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: MLX90640 issue
Try running the i2c scanner and post the results: https://learn.adafruit.com/scanning-i2c-addresses
The Due has always had trouble with i2c. Do you have a different Arduino to test with?
The Due has always had trouble with i2c. Do you have a different Arduino to test with?
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
Re: MLX90640 issue
Here is the result.adafruit_support_bill wrote: ↑Tue May 30, 2023 6:15 am Try running the i2c scanner and post the results: https://learn.adafruit.com/scanning-i2c-addresses
The Due has always had trouble with i2c. Do you have a different Arduino to test with?
I do not have a different Arduino to test with so I ordered a Arduino MEGA 2560 and i will test with it as soon as i receive it.
- Attachments
-
- Image3.jpg (15.99 KiB) Viewed 548 times
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: MLX90640 issue
Looks like the device is acknowledging the default address when addressed by the scanner.
Another thing to try while waiting for the Mega is the second I2C port on the Due:
* Connect via the SDA and SCL pins next to the AREF pin. And change "&Wire" to "&Wire1" in the call to mlx.begin():
Another thing to try while waiting for the Mega is the second I2C port on the Due:
* Connect via the SDA and SCL pins next to the AREF pin. And change "&Wire" to "&Wire1" in the call to mlx.begin():
Code: Select all
if (! mlx.begin(MLX90640_I2CADDR_DEFAULT, &Wire1)) {
Serial.println("MLX90640 not found!");
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
Re: MLX90640 issue
I tried it and it did not work either. It is the same result.adafruit_support_bill wrote: ↑Tue May 30, 2023 9:01 am Looks like the device is acknowledging the default address when addressed by the scanner.
Another thing to try while waiting for the Mega is the second I2C port on the Due:
* Connect via the SDA and SCL pins next to the AREF pin. And change "&Wire" to "&Wire1" in the call to mlx.begin():
Code: Select all
if (! mlx.begin(MLX90640_I2CADDR_DEFAULT, &Wire1)) { Serial.println("MLX90640 not found!");
- Attachments
-
- Image4.jpg (54.67 KiB) Viewed 523 times
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
Re: MLX90640 issue
Do you have a code that will launch an I2C communication in 2 random pins of my cards ? Maybe if i do this the I2C communication will be better than using the default I2C pinsadafruit_support_bill wrote: ↑Tue May 30, 2023 9:01 am Looks like the device is acknowledging the default address when addressed by the scanner.
Another thing to try while waiting for the Mega is the second I2C port on the Due:
* Connect via the SDA and SCL pins next to the AREF pin. And change "&Wire" to "&Wire1" in the call to mlx.begin():
Code: Select all
if (! mlx.begin(MLX90640_I2CADDR_DEFAULT, &Wire1)) { Serial.println("MLX90640 not found!");
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: MLX90640 issue
There are a few software i2c libraries out there. I don't have any experience with them.
Here is one:
https://github.com/stevemarple/SoftWire
Here is one:
https://github.com/stevemarple/SoftWire
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
Re: MLX90640 issue
Sadly i did not manage to make it work. I do not have any experience with them either.adafruit_support_bill wrote: ↑Wed May 31, 2023 5:01 am There are a few software i2c libraries out there. I don't have any experience with them.
Here is one:
https://github.com/stevemarple/SoftWire
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: MLX90640 issue
The other thing you can do with the hardware i2c ports is to slow down the clock. That sometimes helps with marginal devices:
https://www.arduino.cc/reference/en/lan ... /setclock/
https://www.arduino.cc/reference/en/lan ... /setclock/
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
Re: MLX90640 issue
When i slowed it too down (around 35000) it prints "failed" after the getFrame() fonciton. So it does not work either.adafruit_support_bill wrote: ↑Wed May 31, 2023 6:07 am The other thing you can do with the hardware i2c ports is to slow down the clock. That sometimes helps with marginal devices:
https://www.arduino.cc/reference/en/lan ... /setclock/
- kashif9
- Posts: 19
- Joined: Tue May 30, 2023 2:44 am
Re: MLX90640 issue
I receive the Mega 2560 R3 and it seems like that I do not have enough dynamic memory on my Arduino, how can I fix this ?adafruit_support_bill wrote: ↑Tue May 30, 2023 9:01 am Looks like the device is acknowledging the default address when addressed by the scanner.
Another thing to try while waiting for the Mega is the second I2C port on the Due:
* Connect via the SDA and SCL pins next to the AREF pin. And change "&Wire" to "&Wire1" in the call to mlx.begin():
Code: Select all
if (! mlx.begin(MLX90640_I2CADDR_DEFAULT, &Wire1)) { Serial.println("MLX90640 not found!");
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: MLX90640 issue
I just tried compiling the example code for the Mega here:
You can cut back on the dynamic memory requirements in the example by optimizing all the literal strings. Not sure if that would be enough to run or not.
https://learn.adafruit.com/memories-of- ... gs-1747221
Looks like the MLX90640 library pulls in a library from Melexis. That code alone takes over 6Kb of RAM. Then we need some additional buffer space for manipulating the frame data from the device.Sketch uses 19904 bytes (7%) of program storage space. Maximum is 253952 bytes.
Global variables use 8627 bytes (105%) of dynamic memory, leaving -435 bytes for local variables. Maximum is 8192 bytes.data section exceeds available space in board
You can cut back on the dynamic memory requirements in the example by optimizing all the literal strings. Not sure if that would be enough to run or not.
https://learn.adafruit.com/memories-of- ... gs-1747221
Please be positive and constructive with your questions and comments.