Connecting a basic servo

I can’t seem to get my openmv board to send signals to my servo. I’ve got a very basic setup with pin P7 sending signals to the servo.

I know the servo works as I can attach the cable pin to the arduino board which moves the servo. The openmv board works fine for all the ML functions.

Not sure how to debug this.

import time
from pyb import Servo
import utime

s1 = Servo(2) # P8

s2 = Servo(1) # P7

    s1.angle(45, 100)
    s2.angle(45, 100)

Does pulse_width work ? Also how do you connect and power the servo ?

Does pulse_width work ?


Also how do you connect and power the servo ?

I’m using an arduino to power the servo.

I’m using one of the openmv plus boards on m1 mac.
When I try to use this sketch

# Servo Control Example
# This example shows how to use your OpenMV Cam to control servos.

import time
from pyb import Servo

s1 = Servo(1) # P7
s2 = Servo(2) # P8
s3 = Servo(3) # P9

    for i in range(1000):
        s1.pulse_width(1000 + i)
        s2.pulse_width(1999 - i)
        s3.pulse_width(1000 + i)
    for i in range(1000):
        s1.pulse_width(1999 - i)
        s2.pulse_width(1000 + i)
        s3.pulse_width(1999 - i)

and upload it I get an error in the IDE: ValueError: Servo(3) doesn't exist

Not sure if that’s a clue or not.

The OpenMV Cam H7 Plus only has 2 servos.

I’ve attached a video of my setup, and uploading the program to openmv cam:
Video of my setup

I’ve tried multiple servos, and using the P7, P8 pins. As well as different openmv functions like angle and pulse_width.

I’ll see if a workaround will work by sending signals from openmv to my arduino board.

Voltage? I’m using a micro servo that has an operating voltage: 3.0V~7.2V so it should be compatible.

You need a shared GND with the servo. Try adding a ground wire from Arduino to OpenMV ?