MLX90640 issue

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

MLX90640 issue

Post by kashif9 »

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.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: MLX90640 issue

Post by adafruit_support_bill »

Please post some photos showing all of your soldering and connections.

User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

Re: MLX90640 issue

Post by kashif9 »

adafruit_support_bill wrote: Tue May 30, 2023 4:59 am Please post some photos showing all of your soldering and connections.
Here are some photos of my Arduino card connected with camera.
Attachments
unnamed (2).jpg
unnamed (2).jpg (974.8 KiB) Viewed 555 times
unnamed (1).jpg
unnamed (1).jpg (808.16 KiB) Viewed 555 times
unnamed.jpg
unnamed.jpg (643.74 KiB) Viewed 555 times

User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

Re: MLX90640 issue

Post by kashif9 »

adafruit_support_bill wrote: Tue May 30, 2023 4:59 am Please post some photos showing all of your soldering and connections.
And here is a screenshot of my serial monitor when i run the simpletest exemple
Attachments
Image2.jpg
Image2.jpg (34.94 KiB) Viewed 554 times

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: MLX90640 issue

Post by adafruit_support_bill »

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?

User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

Re: MLX90640 issue

Post by kashif9 »

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?
Here is the result.
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
Image3.jpg (15.99 KiB) Viewed 548 times

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: MLX90640 issue

Post by adafruit_support_bill »

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!");

User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

Re: MLX90640 issue

Post by kashif9 »

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!");
I tried it and it did not work either. It is the same result.
Attachments
Image4.jpg
Image4.jpg (54.67 KiB) Viewed 523 times

User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

Re: MLX90640 issue

Post by kashif9 »

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!");
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 pins

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: MLX90640 issue

Post by adafruit_support_bill »

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

User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

Re: MLX90640 issue

Post by kashif9 »

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
Sadly i did not manage to make it work. I do not have any experience with them either.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: MLX90640 issue

Post by adafruit_support_bill »

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/

User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

Re: MLX90640 issue

Post by kashif9 »

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/
When i slowed it too down (around 35000) it prints "failed" after the getFrame() fonciton. So it does not work either.

User avatar
kashif9
 
Posts: 19
Joined: Tue May 30, 2023 2:44 am

Re: MLX90640 issue

Post by kashif9 »

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!");
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 ?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: MLX90640 issue

Post by adafruit_support_bill »

I just tried compiling the example code for the Mega here:
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
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.

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”