Run a continuous rotation servo with a PWM extension board

Our weekly LIVE video chat. Every Wednesday at 8pm ET!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
rojithag
 
Posts: 86
Joined: Thu Aug 31, 2017 2:39 pm

Run a continuous rotation servo with a PWM extension board

Post by rojithag »

Hi, I purchased a few PWM extension boards (breakout version) - PCA9685

I want to run 2 continuous rotation servos - https://www.amazon.com/20-86oz-Continuo ... BANNED/

The example code on the website doesn't explain how to control continuous rotation servos.

Could someone show me how to change it up so that I could tell the servos to rotate 3-4 times forward (360 degrees)
And to rotate it backwards the same amount of times


Any help would be much appreciated!

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Run a continuous rotation servo with a PWM extension boa

Post by Franklin97355 »

Continuous rotation servos have no way of telling how far they have traveled. We do have this servo with a feedback wire that might do what you want. As to control you need to find the idle position of the servo and then giving it shorter pulses will move it in one direction and longer pulses will move it in the other.

User avatar
rojithag
 
Posts: 86
Joined: Thu Aug 31, 2017 2:39 pm

Re: Run a continuous rotation servo with a PWM extension boa

Post by rojithag »

Actually I don’t need to know where to stop exactly. I could just put a timer on it and make it stop after a specific time.

I just need to know how to make it turn continuously using the PWM extension.

How would I change the code?

Thanks!

User avatar
rojithag
 
Posts: 86
Joined: Thu Aug 31, 2017 2:39 pm

Re: Run a continuous rotation servo with a PWM extension boa

Post by rojithag »

Hi, I just wanted to update the thread. I tried using the PWM extension with absolutely no luck.

I then tried using the piggpio library with no luck either.

How are these controlled? I'm very confused, why do these exist with no documentation to run them.

Any help would be greatly appreciated.

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Run a continuous rotation servo with a PWM extension boa

Post by Franklin97355 »

Did you happen to see the tutorial on the board?

User avatar
rojithag
 
Posts: 86
Joined: Thu Aug 31, 2017 2:39 pm

Re: Run a continuous rotation servo with a PWM extension boa

Post by rojithag »

I did.

I tried it with a normal Servo and it works fine.

When I connect the continuous rotation Servo, nothing happens.

How would I change this up so that it works?

User avatar
rojithag
 
Posts: 86
Joined: Thu Aug 31, 2017 2:39 pm

Re: Run a continuous rotation servo with a PWM extension boa

Post by rojithag »

Code: Select all

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
p = GPIO.PWM(17, 50)
p.start(7.5)
try:
        while True:
                p.ChangeDutyCycle(7.5)
                time.sleep(1)
                p.ChangeDutyCycle(12.5)
                time.sleep(1)
                p.ChangeDutyCycle(2.5)
                time.sleep(1)

except KeyboardInterrupt:
        GPIO.cleanup()
I tried this, but my servo just jitters and continuously rotates sometimes.

How would I make it rotate continuously for 5 secs forwards and backwards.

Also how would I use this with the PWM breakout if that's possible.

Thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Ask an Engineer! VIDEO CHAT (closed)”