OSError:Failed to init the MLX90640!

I connected a MLX90640 (Pimoroni) to an OpenMV H7 camera and then run “MLX90640_overlay.py”.It did not work.Window alert message show “ OSError:Failed to init the MLX90640! ”

Please give me an advice.

Are your I2C wires hooked up correctly with Pull ups? Can you list how those are attached? Also, are you using the latest firmware?

Thank you Mr.Nyamekye

I attached P4 to SCL, P5 to SDA,GND to GND camera,V3.3 to V3.3 camera.

But I’m not sure That I using the latest firmware or not.
I’ll check it and let you know.

Hi Mr.Nyamekye
“are you using the latest firmware?”
Yes, I am.
My firmware version was 3.6.2 [latest]

Please help me.
Thanks

And do you have pull ups to 3.3v on SCL and SDA? You need them.

I hooked up the cables like this. Did I correct?

Yes, but, you need two pull up resistors (1K) from DA to 3.3v and SCL to 3.3v

Appreciate, It’s working. :slight_smile:

What if I would like to create the system that captures the image when the temperature is reach the limit and then it’ll put the captured images and captured temperature value into the database or the hard disk (PC) by connect the openMV camera via usb port.

Please give me the instructions.

Today I upgraded OpenMV firmware and OpenMV IDE so I can run MLX90640 Thermal overlay.Please give me an advices.

You mean it stopped working after the firmware update ? Can you confirm this ? What was the old firmware version ?

3.6.2 now 4.0.2

My question is on latest firmware version is it still need pull up 1k resistors?

Yes, you need them.

The code’s below

# Thermal Overlay Demo
#
# This example shows off how to overlay a heatmap onto your OpenMV Cam's
# live video output from the main camera.

import sensor, image, time, fir

drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)

ALT_OVERLAY = False # Set to True to allocate a second ir image.

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)

# Initialize the thermal sensor
fir.init(type=fir.FIR_MLX90640, refresh=16)

# Allocate another frame buffer for smoother video.
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)

# FPS clock
clock = time.clock()

while (True):
    clock.tick()

    # Capture an image
    img = sensor.snapshot()

    # Capture FIR data
    #   ta: Ambient temperature
    #   ir: Object temperatures (IR array)
    #   to_min: Minimum object temperature
    #   to_max: Maximum object temperature
    try:
        ta, ir, to_min, to_max = fir.read_ir()
    except OSError:
        continue

    if not ALT_OVERLAY:
        # Scale the image and belnd it with the framebuffer
        fir.draw_ir(img, ir, hint=drawing_hint)
    else:
        # Create a secondary image and then blend into the frame buffer.
        extra_fb.clear()
        fir.draw_ir(extra_fb, ir, alpha=256, hint=drawing_hint)
        img.blend(extra_fb, alpha=128)

    # Draw ambient, min and max temperatures.
    img.draw_string(8, 0, "Ta: %0.2f C" % ta, color = (255, 0, 0), mono_space = False)
    img.draw_string(8, 8, "To min: %0.2f C" % to_min, color = (255, 0, 0), mono_space = False)
    img.draw_string(8, 16, "To max: %0.2f C"% to_max, color = (255, 0, 0), mono_space = False)

    # Force high quality streaming...
    img.compress(quality=90)

    # Print FPS.
    print(clock.fps())

What does "valueError"mean?
There is an error in line 18.

What line is line 18?