Accuracy Issues in Temperature Measurement Using OpenMV PureThermal Board with FLIR Lepton 3.5


Hello Sir,
I’m working on a project involving temperature measurement using the OpenMV PureThermal board paired with a FLIR Lepton 3.5 thermal sensor. I’m currently evaluating its accuracy by comparing the readings to a thermocouple placed in contact with a heated object.
In my setup:
• The object is heated in a controlled manner.
• Temperature readings from the FLIR Lepton are taken from the pixel nearest to the thermocouple’s position.
• Readings are recorded over time and compared against the thermocouple measurements.
However, I’m observing some discrepancies in the thermal data:

  1. Area 1: A sudden jump in temperature occurs after a certain interval.
  2. Area 2: At around sample #224, there’s a sudden drop in the thermal reading while the thermocouple remains stable.
  3. Area 3: Another sudden drop appears in the thermal reading after a separate interval.
    Here’s the simplified code I used for data collection:

import json
from ulab import numpy as np
import sensor, fir, pyb

fir.init(fir.FIR_LEPTON)

for i in range(500):
    pyb.delay(5000)
    img = sensor.snapshot()
    ta, ir, to_min, to_max = fir.read_ir()
    fir.draw_ir(img, ir, x_scale=4, y_scale=4, alpha=255, hint=1)
    with open(f"/sdcard/color_images2/thermal_{i}.txt", "w") as f:
        json.dump(temperature_data.tolist(), f)
    img.save(f"/sdcard/color_images2/thermal_{i}.jpg")
    avg_temp = np.mean(temperature_data)
    print(f"Frame {i}: Average temperature = {avg_temp:.2f}°C")

Questions:
• What could be causing these sudden jumps and drops in thermal readings?
• Is there a recommended filtering or correction method to improve temperature accuracy over time?
Any insights or recommendations would be greatly appreciated.

Not sure, by default, the FIR Lepton outputs 14-bit thermal data. The sensor will calibrate it’s self via FFC but you shouldn’t see those periodic drops. The object you are looking at isn’t very hot either.

We had another customer testing this code in a reading some extremely hot 300C+ things and was not encountering issues.

Is this code right?

for i in range(500):
    pyb.delay(5000)
    img = sensor.snapshot()
    ta, ir, to_min, to_max = fir.read_ir()
    fir.draw_ir(img, ir, x_scale=4, y_scale=4, alpha=255, hint=1)
    with open(f"/sdcard/color_images2/thermal_{i}.txt", "w") as f:
        json.dump(temperature_data.tolist(), f)
    img.save(f"/sdcard/color_images2/thermal_{i}.jpg")
    avg_temp = np.mean(temperature_data)
    print(f"Frame {i}: Average temperature = {avg_temp:.2f}°C")

temperature_data is not a defined variable.

I’m going back and forth with Lepton Support. They answer slowly for the LEPTON. Got answers in 1 day with BOSON. Anyway:


If the customers are so inclined, they could perform some SDK commands to customize the FFCs for better results.

The Lepton camera includes built-in support to correct the thermal “bump” that occurs after a Flat-Field Correction (FFC). This correction can be enabled by adjusting specific parameters.

The compensation follows this formula:
Offset = Amplitude × timeSinceFfc × exp(−timeSinceFfc / Decay)

To activate this feature, set the Offset mode to AUTO using the function LEP_SetRadArbitraryOffsetMode(). Then, configure the parameters with LEP_SetRadArbitraryOffsetParams().
In testing, using an Amplitude of 0xFFE6 (-26) and a Decay of 0x0007 (seconds) significantly reduced the bump. These values can be further fine-tuned for optimal performance.


You can issue custom commands to the lepton through our SDK, however, it’s somewhat challenging as you have to represent the command as a 16-bit number and then provide a byte array with the arguments serialized in the format of the struct the command expects.

I can also provide a custom firmware with these features enabled. Please let me know if you want that (which camera model) and then let me know if you have a way to test it.

@2020ren9629