Problems controlling servos

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
PauliusLiekis
 
Posts: 12
Joined: Sat Dec 28, 2013 6:15 am

Problems controlling servos

Post by PauliusLiekis »

I purchased 4 MG90S servos, Raspberry pi and 16 channel servo driver and I'm having problems making servos rotate full 180 degrees. I used sample Python code from the tutorial, modified frequency to 50Hz and servo_min/servo_max to 205/409 (I also tried 250/500 - that's what you get if you used INTs to calculate those values), but servos seem to rotate only ~80-90 degrees total. Physically I can rotate it full 180 degrees (although it isn't easy). If the physical angle is (-90 to 90), then sending 1ms/1.5ms/2ms signal will correspond to (-90/-45/0) compared to physical angle on my servos.

I tried using C++ code - same results.

I tried controlling a servo through RPi GPIO pin by emulating PWM signal using code like this:

Code: Select all

while (True)
    GPIO.output(pin, 1)
    time.sleep(t)
    GPIO.output(pin, 0)
    time.sleep(0.02 - t)
I get the same results.

Any ideas why my servos won't do full 180?

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: Problems controlling servos

Post by adafruit_support_bill »

Do all 4 servos behave the same?
1ms/1.5ms/2ms signal will correspond to (-90/-45/0)
If you extend the range of pulse widths, does the movement range increase at all?

PauliusLiekis
 
Posts: 12
Joined: Sat Dec 28, 2013 6:15 am

Re: Problems controlling servos

Post by PauliusLiekis »

Yes, all servos behave the same.

The servo min/max seem to be close to border values, i.e. if I increase to 450/150 the servo stops reacting to the signal.

BTW: it looks like 200/400 range is mapped approximately to 90 degrees, because if send signals 220, 240, 260, etc, I can see that the servo moves 10 times, each time moving roughly 1/10th of the 90deg rage.

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: Problems controlling servos

Post by adafruit_support_bill »

Yes, all servos behave the same.
Let me check some servos from stock and see if we can reproduce that here.

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: Problems controlling servos

Post by adafruit_support_bill »

Update - I have some servos here now & will be testing them shortly.

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: Problems controlling servos

Post by adafruit_support_bill »

OK. I was able to reproduce the problem exactly as you described. Looks like the servo control loop is out-of-whack for the whole lot. We'll have to straighten this out with the Mfgr.

In the mean-time, you can contact [email protected] with a link to this thread, and we'll refund you for the servos.

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

Return to “Other Products from Adafruit”