Thermal Imaging Camera - MLX90641 GetFrame Error: -1

I got GetFrame Error: -1 with ESP32 WROOM & MLX90641

#include <Wire.h>
#include "MLX90641_API.h"
#include "MLX9064X_I2C_Driver.h"

    const byte MLX90641_address = 0x33; //Default 7-bit unshifted address of the MLX90641
    #define TA_SHIFT 8 //Default shift for MLX90641 in open air

    uint16_t eeMLX90641[832];
    float mlx90641To[192];
    //uint16_t mlx90641Frame[834];
    paramsMLX90641 mlx90641;
    int errorno = 0;

void setup() {

    Wire.begin();
    Wire.setClock(400000); //Increase I2C clock speed to 400kHz
    
    Serial.begin(115200); //Fast debug as possible
    delay(2000);
    Serial.println("MLX90641 IR Array Example");


    if (isConnected() == false) {
        Serial.println("MLX90641 not detected at default I2C address. Please check wiring. Freezing.");
        while (1);
    }
    else Serial.println("I2C devices found\n");
    
    //Get device parameters - We only have to do this once
    int status;
    status = MLX90641_DumpEE(MLX90641_address, eeMLX90641);
    errorno = status;//MLX90641_CheckEEPROMValid(eeMLX90641);//eeMLX90641[10] & 0x0040;//
    
    if (status != 0) {
        Serial.println("Failed to load system parameters");
       while(1);
    }
    
    for (int x = 0 ; x < 32 ; x++)
    {
      if(x % 32 == 0) Serial.println();
      Serial.print(eeMLX90641[x], 2);
      Serial.print(",");
    }    Serial.println("");
    status = MLX90641_ExtractParameters(eeMLX90641, &mlx90641);
    //errorno = status;
    if (status != 0) {
        Serial.println("Parameter extraction failed");
        while(1);
    }

    //Once params are extracted, we can release eeMLX90641 array
    MLX90641_SetRefreshRate(MLX90641_address, 0x03); //Set rate to 4Hz  

  //Once EEPROM has been read at 400kHz we can increase to 1MHz
  //Wire.setClock(1000000); //Teensy will now run I2C at 800kHz (because of clock division)

}

void loop() {
    float vdd = 0;
    float Ta = 0;
    uint16_t mlx90641Frame[242];
    for (byte x = 0 ; x < 2 ; x++) {
        int status = MLX90641_GetFrameData(MLX90641_address, mlx90641Frame);
        if (status < 0) {
            Serial.print("GetFrame Error: ");
            Serial.println(status);
        }

         vdd = MLX90641_GetVdd(mlx90641Frame, &mlx90641);
         Ta = MLX90641_GetTa(mlx90641Frame, &mlx90641);

        float tr = Ta - TA_SHIFT; //Reflected temperature based on the sensor ambient temperature
        float emissivity = 0.95;

        MLX90641_CalculateTo(mlx90641Frame, &mlx90641, emissivity, tr, mlx90641To);
    }
    Serial.print("vdd=");
    Serial.print(vdd,2);
    Serial.print(",Ta=");
    Serial.print(Ta,2);
    Serial.println();

    
    for (int x = 0 ; x < 64 ; x++) {
        Serial.print(mlx90641Frame[x], HEX);
        Serial.print(",");
    }Serial.println();

    for (int x = 0 ; x < 10 ; x++) {
        Serial.print("Pixel ");
        Serial.print(x);
        Serial.print(": ");
        Serial.print(mlx90641To[x], 2);
        Serial.print("C");
        Serial.println();
    }
        Serial.println();

        
    delay(2000);

}

//Returns true if the MLX90641 is detected on the I2C bus
boolean isConnected() {

   for (byte i = 0; i < 5; i++) {
          Wire.beginTransmission((uint8_t)MLX90641_address);
      if (Wire.endTransmission() == 0) {
          return (true);    //Sensor did not ACK
      }
   }   
   return false;
}

the software code 1 used into my Arduino IDE and open the Serial Port , outcome of visualization format as following:

OUTPUT

14:51:55.831 → MLX90641_ExtractParameters(0) : 0
14:51:55.865 → MLX90641_ExtractDeviatingPixels(0) : 0
14:51:56.955 → vdd=-2.11,Ta=338.03
14:51:56.955 → FE53,FE68,FE8A,FE92,FE93,FE8A,FE9B,FE9B,FE89,FE88,FE83,FE81,FE66,FE5A,FE47,FE35,FE97,FE9C,FEAD,FEA7,FEA6,FEB0,FEB4,FEAF,FEAE,FEAD,FEAD,FE97,FE86,FE89,FE7A,FE51,FE76,FE90,FE94,FEA3,FEA8,FEA4,FEAA,FEAE,FEA3,FE97,FEA1,FE9C,FE84,FE7A,FE70,FE57,FEAC,FEA3,FEB2,FEB6,FEBA,FEB8,FEB9,FEB5,FEAD,FEB0,FEB5,FEA7,FE9E,FE96,FE8C,FE74,
14:51:56.990 → Pixel 0: 337.40C
14:51:56.990 → Pixel 1: 338.32C
14:51:56.990 → Pixel 2: 339.97C
14:51:56.990 → Pixel 3: 339.61C
14:51:56.990 → Pixel 4: 339.43C
14:51:56.990 → Pixel 5: 339.11C
14:51:56.990 → Pixel 6: 340.19C
14:51:56.990 → Pixel 7: 340.63C
14:51:56.990 → Pixel 8: 340.55C
14:51:56.990 → Pixel 9: 339.40C
14:51:57.031 →
14:51:58.984 → GetFrame Error: -1
14:52:00.563 → vdd=-0.69,Ta=310.68
14:52:00.563 → FC80,FC9D,FCDF,FCE6,FCE5,FCCB,FCEE,FCE8,FCC8,FCBE,FCB6,FCAE,FC7E,FC5E,FC3A,FC1E,FCE7,FCF6,FD15,FD03,FCF4,FD03,FD0A,FD04,FCFE,FCF6,FCFB,FCCD,FC9E,FCA6,FC90,FC4A,FCB2,FCE0,FCDD,FCED,FCFC,FCEE,FCFC,FCF7,FCE5,FCC3,FCDF,FCCF,FCA1,FC8C,FC7A,FC50,FD09,FCF9,FD0C,FD0B,FD0F,FD09,FD09,FD01,FCEB,FCEB,FCF9,FCE2,FCCA,FCBA,FCA9,FC80,
14:52:00.563 → Pixel 0: 308.43C
14:52:00.563 → Pixel 1: 309.19C
14:52:00.563 → Pixel 2: 310.65C
14:52:00.563 → Pixel 3: 310.40C
14:52:00.563 → Pixel 4: 310.34C
14:52:00.563 → Pixel 5: 310.05C
14:52:00.618 → Pixel 6: 310.91C
14:52:00.618 → Pixel 7: 311.21C
14:52:00.618 → Pixel 8: 311.16C
14:52:00.618 → Pixel 9: 310.21C

Hi there,
What MCU are you using?, you have a picture of the connection setup?
is the ESP a dev board or a Seeed board?
anyway… The data doesn’t look right.
should be numbers, not hex?
I want to get one of these cameras, so I’m interested in helping.
GL :slight_smile: PJ :v:

Hi,

using the ESP32 wireless dev board, MCU, by Espressif Systems.
Yes, a connection was made using the below link: Template:MLX90641 Thermal Camera manul - Waveshare Wiki

Hi there,
Can you change this size and go again :grin:
first try bigger, then smaller…
Typically it’s a buffer issue, is why I say that. YMMV
HTH
GL :slight_smile: PJ

Hi,

//uint16_t mlx90641Frame[834];    
uint16_t mlx90641Frame[860];

also tried. Output attached pls check. 1st time received right output. but it was changing.

Hi there,
that output looks correct, What Wiki are you using or following?
Your close.
GL :slight_smile: PJ

Hi,

Software Code 1 Followed

can you refer the exact array size for mlx90641Frame, to resolve this issue.