Help for a beginner(noob) trying to detect hands and send signal to arduino

Hello, I just got an OpenMV4 Cam H7 Plus and its interesting how a relatively low cost camera can work so good. I have some questions that I think should be easy for an experienced user (unlike me)

  1. I usually connect arduino boards independently with an external power source through pins 5V and GND. Can I do the same with the H7 Plus through pin Vin and GND?
  2. I already learned how to detect objects training a model in EdgeImpulse (very easy process BTW) and I found out it usually generates the same python file. I am a total noob in python and I’ve tried different ways to turn on an external LED when the H7 Plus detects the object it is programmed to detect. I’m trying to use pin P4 and I’m only detecting one type of class (only 1 label)
while(True):
    clock.tick()

    img = sensor.snapshot()

    # detect() returns all objects found in the image (splitted out per class already)
    # we skip class index 0, as that is the background, and then draw circles of the center
    # of our objects
    result = net.detect(img, thresholds=[(math.ceil(min_confidence * 255), 255)])
    print(result)

    for i, detection_list in enumerate(result):
        if (i == 0): continue # background class
        if (len(detection_list) == 0): continue # no detections for this class?

        print("********** %s **********" % labels[i])
        for d in detection_list:
            [x, y, w, h] = d.rect()
            center_x = math.floor(x + (w / 2))
            center_y = math.floor(y + (h / 2))
            print('x %d\ty %d' % (center_x, center_y))
            img.draw_circle((center_x, center_y, 12), color=colors[i], thickness=2)

    print(clock.fps(), "fps", end="\n\n")
  1. I want to ask you people what would be a good approach to send a signal (HIGH or LOW) from the openMV to an arduino but without using serial comm. Just to be able to generate a signal like a switch on and off. I dont know if its posible to connect the output signal from one of the OpenMV pins to an input pin on the arduino with a pulldown resistor. Or maybe a transistor is better? Maybe im complicating this too much but Im just curious of how to do it without using serial communication.

Thank you very much in advance and I hope I can be of help in the future.

Hi:

  1. I usually connect arduino boards independently with an external power source through pins 5V and GND. Can I do the same with the H7 Plus through pin Vin and GND?

Yes

  1. I already learned how to detect objects training a model in EdgeImpulse (very easy process BTW) and I found out it usually generates the same python file. I am a total noob in python and I’ve tried different ways to turn on an external LED when the H7 Plus detects the object it is programmed to detect. I’m trying to use pin P4 and I’m only detecting one type of class (only 1 label)

You just need to declare a pin object and set the value to high when you the class you are looking for.

from machine import Pin
pin1 = Pin("P4", Pin.OUT)

...

detected_object = False

for i, detection_list in enumerate(result):
        if (i == 0): continue # background class
        if (len(detection_list) == 0): continue # no detections for this class?

        print("********** %s **********" % labels[I])
        detected_object = True
        for d in detection_list:
            [x, y, w, h] = d.rect()
            center_x = math.floor(x + (w / 2))
            center_y = math.floor(y + (h / 2))
            print('x %d\ty %d' % (center_x, center_y))
            img.draw_circle((center_x, center_y, 12), color=colors[i], thickness=2)

pin1.value(detected_object)
  1. I want to ask you people what would be a good approach to send a signal (HIGH or LOW) from the openMV to an arduino but without using serial comm. Just to be able to generate a signal like a switch on and off. I dont know if its posible to connect the output signal from one of the OpenMV pins to an input pin on the arduino with a pulldown resistor. Or maybe a transistor is better? Maybe im complicating this too much but Im just curious of how to do it without using serial communication.

Just connect the pins directly. There’s no need for a pulldown if you assume both devices are always running. If the camera may not be on all the time then add a pull down resistor.

Hey, thank you very very much for your help.
Everything worked great, now I just need to make a better training for my hand detection project!

1 Like