Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Coral dev board drive sg90 servo motor problem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Coral dev board drive sg90 servo motor problem

by YOUWEILIN on Wed Aug 26, 2020 1:32 am

I use Coral dev board to drive the sg90 servo motor. I follow the instructions on the official website, but I can’t drive the motor. What's wrong?

This web: https://learn.adafruit.com/circuitpython-on-google-coral-linux-blinka/pwm-outputs-servos

code:
import time
import board
import pulseio
from adafruit_motor import servo

# create a PWMOut object on Pin PWM3.
pwm = pulseio.PWMOut(board.PWM3, duty_cycle=2 ** 15, frequency=50)

# Create a servo object, my_servo.
my_servo = servo.Servo(pwm)

while True:
for angle in range(0, 180, 5): # 0 - 180 degrees, 5 degrees at a time.
my_servo.angle = angle
time.sleep(0.05)
for angle in range(180, 0, -5): # 180 - 0 degrees, 5 degrees at a time.
my_servo.angle = angle
time.sleep(0.05)

YOUWEILIN
 
Posts: 1
Joined: Wed Aug 26, 2020 1:21 am

Re: Coral dev board drive sg90 servo motor problem

by mikeysklar on Wed Aug 26, 2020 4:47 pm

Code looks good.

Can you show us a photo of your wiring? You should be connected to pin #15 on the Coral if you are using PWM3.

Please verify that the PWMs are enabled with this command:

Code: Select all | TOGGLE FULL SIZE
 ls /sys/class/pwm/

mikeysklar
 
Posts: 1730
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.