Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into issues with the example code. #4

Open
ManiLowc opened this issue Mar 3, 2019 · 1 comment
Open

Running into issues with the example code. #4

ManiLowc opened this issue Mar 3, 2019 · 1 comment

Comments

@ManiLowc
Copy link

ManiLowc commented Mar 3, 2019

Subject of the issue

Hello, I'm attempting to use the MLX90640 with the example code generously made available but am running into some issues.

When I compile the Example1_BasicReadings the text below appears in the output window:

Example1_BasicReadings: In function 'void loop()':
Example1_BasicReadings:83: warning: unused variable 'vdd'
float vdd = MLX90640_GetVdd(mlx90640Frame, &mlx90640);

       ^

Sketch uses 31308 bytes (5%) of program storage space. Maximum is 524288 bytes.
Global variables use 19160 bytes (7%) of dynamic memory, leaving 242976 bytes for local variables. Maximum is 262136 bytes.

I get similar messages when I compile the second and third example code:

Example2_OutputToProcessing: In function 'void loop()':
Example2_OutputToProcessing:81: warning: unused variable 'status'
int status = MLX90640_GetFrameData(MLX90640_address, mlx90640Frame);

     ^

Example2_OutputToProcessing:83: warning: unused variable 'vdd'
float vdd = MLX90640_GetVdd(mlx90640Frame, &mlx90640);

       ^

Example2_OutputToProcessing:77: warning: unused variable 'startTime'
long startTime = millis();

    ^

Example2_OutputToProcessing:91: warning: unused variable 'stopTime'
long stopTime = millis();

    ^

Sketch uses 31228 bytes (5%) of program storage space. Maximum is 524288 bytes.
Global variables use 19160 bytes (7%) of dynamic memory, leaving 242976 bytes for local variables. Maximum is 262136 bytes.

Example3_MaxRefreshRate: In function 'void loop()':
Example3_MaxRefreshRate:96: warning: unused variable 'status'
int status = MLX90640_GetFrameData(MLX90640_address, mlx90640Frame);

     ^

Example3_MaxRefreshRate:99: warning: unused variable 'vdd'
float vdd = MLX90640_GetVdd(mlx90640Frame, &mlx90640);

       ^

Sketch uses 31460 bytes (6%) of program storage space. Maximum is 524288 bytes.
Global variables use 19160 bytes (7%) of dynamic memory, leaving 242976 bytes for local variables. Maximum is 262136 bytes.

The first example seems to work and when I open the serial monitor I see temperatures for 9 pixels.
The second example also seems to work but when I open the Processing code and attempt to run, sometimes I receive the error "ArrayIndexOutOfBoundsException: 87" with the display being completely red, but othertimes it seems to work fine and displays what the camera sees.
When I try to use the third example, I usually get the error "ArrayIndexOutOfBoundsException: xxx" (where xxx are numbers that seems to change) where the display is completely red but sometimes I get "ArrayIndexOutOfBoundsException: 1" where the display at first seems correct but then freezes.
Also when the error appears, the 98th line of code "if(!Float.isNaN(float(splitString[q])) && float(splitString[q]) > maxTemp){" becomes highlighted.

Your workbench

  • What platform are you using?
    I'm using the Teensy 3.5, a breadboard, Qwiic IR Array MLX90640 and qwiic connector cable as recommended on the sparkfun website (please find picture below). I am running the software on my laptop.
  • What version of the device are you using? Is there a firmware version?
    I'm using Arduino 1.8.8 and the newest Teensyduino downloadable.
  • How is the device wired to your platform?
    It is connected via USB.
  • How is everything being powered?
    It is being powered by my laptop.
  • Are there any additional details that may help us help you?
    I'm a coding novice. I have downloaded the MLX90640 libraries necessary.

Steps to reproduce

Tell us how to reproduce this issue. Please post stripped down example code demonstrating your issue to a gist.

Expected behaviour

I expected the display to have a higher refresh rate when using example code 3.

Actual behaviour

I receive ArrayIndexOutOfBoundsException errors.

20190303_180647
20190303_180713

@jamesdanielv
Copy link

jamesdanielv commented Aug 23, 2019

hello, did you get it working yet? i'm not from sparkfun staff, but i'm looking at issues with mlx setup. what is the i2c rate set too? if data rate is too low the getframe routine can not finish its check before the next read. since the mode of data transfer is continueous it needs to at least read all the data in the frame before the time sync of the frame rate. since it reads words then it needs to at least read 834 words x16bits of data) so ~13344 pulses per frame cycle. this means at default 100khz speed of data bus (not sure what it is set to ) reading more than 3 fps (which requires 2 reads per frame cycle) will not allow data to be completely dumped from sensor memory before being overwritten by sensor read. this also can effect status registers for detecting when frame data is ready and have it stuck in a loop where it always is fetching data because the status register always will be indicating new ram values have been written.

if this is your case, then simply increasing data bus speed of i2c will resolve the issue. be careful to keep data wires short, and to only increase incrementally. (maybe 100khz increments) also be sure to keep within spec of mlx controller of 1mhz. if using sparkfun board with 2.2k pullups slew rate should allow higher speeds to work.i would recommend using data bus at about 400khz, and when you know it is stable then increase it from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants