H7 plus controlling a 6 axis robotic arm


I am trying to control 6 servos with the H7 plus camera but I am having some trouble. I bought the servo shield and download the python files for it but when I ran the script nothing happened even though everything was unchanged from the GitHub repo. Then a tried to control just one servo with the included example script but still nothing. It isn’t the servo, it works when I connect it to an arduino. I have an external power supply for the servo with all components sharing a common ground. Any help would be much appreciated!

Can you post a few pictures of your setup?

I am using the Arduino as a 5V power supply. I am running the basic servo example code that is inlcuded.


The servo shield uses an I2C chop to control the servo, while the pan and tilt shield use the stm32 chip directly. Which servo script where you running?

Since I was having trouble with the servo shield I hooked up the servo directly to the board to see if I could control it then but still no dice. I am running the servo_control.py script from the examples tab when connected directly to the board and this script when using the servo shield

# Servo Shield Example.
# This example demonstrates the servo shield. Please follow these steps:
#   1. Connect a servo to any PWM output.
#   2. Connect a 3.7v battery (or 5V source) to VIN and GND.
#   3. Copy pca9685.py and servo.py to OpenMV and reset it.
#   4. Connect and run this script in the IDE.

import time
from servo import Servos
from machine import I2C, Pin

i2c = I2C(sda=Pin('P5'), scl=Pin('P4'))
servo = Servos(i2c, address=0x40, freq=50, min_us=650, max_us=2800, degrees=180)

while True:
    for i in range(0, 8):
        servo.position(i, 0)
    for i in range(0, 8):
        servo.position(i, 180)

The above script is uses the python drivers for the pca9685 chip

That’s true, you need to use the Board Control->servo_control.py example, and make sure you have the latest firmware. NOTE The H7+ has 2 timer pins only (P7 and P8 I think, please check the pinout).

The ide tells me that I have the latest firmware and when I run the servo_control.py script nothing happens. The servo pulls power from a 5v power supply and the cam and the power supply have a common ground.

Okay I’ll test it and get back to you, in the meantime please make sure you use P7 or P8 (P9 is GPIO on the H7+).

I am using pin P7, thank you so much!

Seems to be working fine:

import time
from pyb import Servo

s1 = Servo(1) # P7


Note servo connected to 3.3v.

Maybe its just the servo because I have the same setup and I am getting nothing. Here is mine

I use the servo with an arduino and it is fine. Do I need a special type for this processor?

I think I need a logic level shifter

Yes looks right, are you sure it’s on firmware 4.1.1 ? The timers had issues with older firmware, check the IDE when the cam is connected for the firmware version. It could also be the pin headers not making contact or shorting, might want to try P8 (Servo(2))

Never needed one with servos before.

The IDE says 4.1.1 and I changed it to P8 and nothing still. I am stumped

Try a different cam and/or servo, there’s not much left to troubleshoot…

Actually it’s just PWM, you could connect an LED if you have one the brightness should change.

I connected it to a multimeter and the voltage bounced between 0.1 and 0.3 volts. The high value seems a little low, could that be causing it?

Yes it’s very likely, check the solder joints the pin might not be making full contact, or check for shorts with the adjacent pins.

Note you should set the pulse to 2000 followed by a while (True): pass/sleep, don’t let it vary the pulse width when measuring the voltage.

The joints look good to me and the wire has 0.3 ohms resistance.