I'm developing an algorithm using esp32 with MLX90640 IR sensor.
After I read data frames and calculated the temperature, the temperature values see a strong chessboard-pattern style. See images below (raw temperature data)
Part of measured values:
I marked some obviouslly abnormal points.
And here is my core measuring code :
int expectFrame = 0;
int subPagesRead = 0;
while (true)
{
while (subPagesRead < 2) {
vTaskDelay(250 / portTICK_RATE_MS);
status = MLX90640_GetFrameData(0x33, mlx90640Frame);
if (status != expectFrame) {
continue;
}
expectFrame = 1 - expectFrame;
subPagesRead++;
float tr = MLX90640_GetTa(mlx90640Frame, &mlx90640) - TA_SHIFT;
MLX90640_CalculateTo(mlx90640Frame, &mlx90640, emissivity, tr, mlx90640To);
}
// output mlx90640To
memset(mlx90640Frame, 0, sizeof(mlx90640Frame));
memset(mlx90640To, 0, sizeof(mlx90640To));
subPagesRead = 0;
}
Am I measuing in a wrong way? Or any other possible reasons?
(This frame is calculated at 4Hz refresh rate on a esp32 chip)
Best Answer
So I opened an issue in the official github API library repo. And @LBuydens at Github pointed out the lack of power decoupling capacitors could be a reason leading to this striped pattern. Then I read the data sheet again, and found this paragraph at the very end:
With the help of our hardware engineer adding these two capacitors, I finally got a normal frame. Though small temperature difference still exists (likely < 0.5 degrees), it can be ignored.