ValueError: Failed to detect a supported FIR sensor
I bought new openmv PT and it throws an error when I am using Lepton 3.5. Lepton works fine when I use another module to test it.
ValueError: Failed to detect a supported FIR sensor
I bought new openmv PT and it throws an error when I am using Lepton 3.5. Lepton works fine when I use another module to test it.
Can you post your code? Are you using the default demo script that comes on the system?
Also, can you update the firmware and then erase the flash disk?
The system should be very functional and work with any FLIR Lepton. Our driver for these is very reliable.
Hi, I encountered a very similar problem with the OpenMV purethermal with a Lepton 3.5. I am no longer able to view thermal images and measure temperatures. The code I use is the normal main.py that is on the board. This happened after firmware update 4.5.6
Can someone help me please?
import sensor
import image
import time
import display
import fir
import math
import tfp410
threshold_list = [(200, 255)]
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.WVGA)
time.sleep_ms(50)
fir.init(fir.FIR_LEPTON)
fir_img = image.Image(fir.width(), fir.height(), sensor.GRAYSCALE)
time.sleep_ms(50)
lcd = display.RGBDisplay(framesize=display.FWVGA, refresh=60)
lcd.backlight(True)
hdmi = tfp410.TFP410()
time.sleep_ms(50)
alpha_pal = image.Image(256, 1, sensor.GRAYSCALE)
for i in range(256):
alpha_pal[i] = int(math.pow((i / 255), 2) * 255)
to_min = None
to_max = None
def map_g_to_temp(g):
return ((g * (to_max - to_min)) / 255.0) + to_min
while True:
img = sensor.snapshot()
# ta: Ambient temperature
# ir: Object temperatures (IR array)
# to_min: Minimum object temperature
# to_max: Maximum object temperature
ta, ir, to_min, to_max = fir.read_ir()
fir.draw_ir(fir_img, ir, color_palette=None)
fir_img_size = fir_img.width() * fir_img.height()
# Find IR Blobs
blobs = fir_img.find_blobs(threshold_list,
pixels_threshold=(fir_img_size // 100),
area_threshold=(fir_img_size // 100),
merge=True)
# Collect stats into a list of tuples
blob_stats = []
for b in blobs:
blob_stats.append((b.rect(), map_g_to_temp(img.get_statistics(thresholds=threshold_list,
roi=b.rect()).mean())))
x_scale = img.width() / fir_img.width()
y_scale = img.height() / fir_img.height()
img.draw_image(fir_img, 0, 0, x_scale=x_scale, y_scale=y_scale,
color_palette=image.PALETTE_IRONBOW,
alpha_palette=alpha_pal,
hint=image.BICUBIC)
# Draw stuff on the colored image
for b in blobs:
img.draw_rectangle(int(b.rect()[0] * x_scale), int(b.rect()[1] * y_scale),
int(b.rect()[2] * x_scale), int(b.rect()[3] * y_scale))
img.draw_cross(int(b.cx() * x_scale), int(b.cy() * y_scale))
for blob_stat in blob_stats:
img.draw_string(int((blob_stat[0][0] * x_scale) + 4), int((blob_stat[0][1] * y_scale) + 1),
'%.2f C' % blob_stat[1], mono_space=False, scale=2)
# Draw ambient, min and max temperatures.
img.draw_string(4, 0, 'Lepton Temp: %0.2f C' % ta,
color=(255, 255, 255), mono_space=False, scale=2)
img.draw_string(4, 18, 'Min Temp: %0.2f C' % to_min,
color=(255, 255, 255), mono_space=False, scale=2)
img.draw_string(4, 36, 'Max Temp: %0.2f C' % to_max,
color=(255, 255, 255), mono_space=False, scale=2)
lcd.write(img, hint=(image.BILINEAR | image.CENTER | image.SCALE_ASPECT_KEEP))
I also had the same issue then I downgraded the firmware to 4.5.3 and it worked!! Newer firmwares do recognize Lepton but for some reason everything is 0K.
I’ll get this debugged asap. Probably something minor changed breaking things with the MP1.23 update.
firmware.zip (1.1 MB)
Hi, this firmware fixes the issue with 4.5.6.
This is like a super critical bug… I have no idea how the system was even working. Probably need to do a firmware release very soon.
The MPU protection was not working… so this was leaving a lot of DMA buffers in cachable regions, which leads to memory corruption.
Hi, thank you very much for your reply and assistance. With this new firmware that you provided, the thermal sensor is back to working on the purethermal.
However, opening OpenMV IDE this morning, I was asked to perform a new update. Given what happened last time and how well what you provided worked, I didn’t accept. Could you please tell me what I should do? Many thanks
Yes, the update is the official firmware release for the fix.
The STM32 firmware was basically Foobar because of that bug that it required an emergency firmware release.