[SOLVED] Servo trouble - Servo moves unexpectedly on power up and during regular operation

Hi,
My servo is suffering from some unexpected behaviour.

  • When I power up (both on raspberry adapter and GoPiGo battery pack) the servo often takes a small swing. This happens nearly immediately when connecting the power. According to an older thread this is a known issue. I can easily get around this by reseting the servo position with a small script. Just pointing it out for future readers :wink:

  • A bigger annoyance is the fact that the servo sometimes moves unexpectedly during normal operation of the motors. The behaviour I’m getting sounds similar to the issue reported in this thread. If someone has tips on what to do to improve this situation I would appreciate it :slight_smile:

Thanks,

Frost

I have noticed that the servos do indeed move when power is connected.

Hi @Frostlock,

Thank you for bringing this up.

Let’s start analyzing your observations.


When I power up (both on raspberry adapter and GoPiGo battery pack) the servo often takes a small swing. This happens nearly immediately when connecting the power. According to an older thread this is a known issue. I can easily get around this by reseting the servo position with a small script. Just pointing it out for future readers.

This is all normal to happen. Happens with every servo.


A bigger annoyance is the fact that the servo sometimes moves unexpectedly during normal operation of the motors. The behaviour I’m getting sounds similar to the issue reported in this thread. If someone has tips on what to do to improve this situation I would appreciate it.

Since the GoPiGo uses SoftwareServo library, this means the servo PWM signals are actually calculated by the AVR chip that’s on the GoPiGo.

The SoftwareServo library (which was developed by the Arduino team) is only using one timer and it was made up so it can control up to 12 servos on any output pin - that’s huge.
But when you win, you also lose something.

So because of this SoftwareServo library, the timings are not perfect - they do have some jitter.
You can see the jitter in the following gif I’ve made with the oscilloscope - the vertical line shouldn’t have moved to left and right, but stay in one position - hence the jitter we’re talking about.



The final conclusion is that, there’s nothing wrong with the servo, nor the GoPiGo.
It’s just the way it works.


Hope I’ve made myself clear. Please tell me if there’s anything else left unclear.

Thank you!

Hey @RobertLucian,
thanks for the very interesting answer, I learned something new! :slight_smile:

One additional remark though to make sure that we are aligned on symptoms. I wouldn’t call what I’m seeing jitters. I drive around a bit and every now and then the servo moves a number of degrees. It can be small steps or even big steps. On a few occasions the servo even moved all the way to 180 position. Is this kind of behavior still in line with what you would expect?

I’m trying to reproduce the issue but of course tonight I’m not seeing it :wink: I did mess around with the cabling earlier, so maybe I had a loose contact or something earlier.

thanks,

Frost

Hi @Frostlock,

I’m glad to hear that.


Regarding the issue on the servo motor, it’s normal for it to move for a number of degrees (even 10 degrees are acceptable - and that’s from what I have seen).

What’s not normal is to have it rotate all the way up. This effect can be caused by an improper electrical contact between the servo lines and the power supply.
You might want to check that out and see if it persists in rotating so much.


If the electrical contacts are okay and it still rotates so much (by going up to 180 degrees position), I think posting a video here with the servo doing it is going to help us come with a good diagnostic.


So, please keep me updated on how your situation is evolving.

Thank you!

Hey @RobertLucian,
after plenty of driving around I have had no luck in reproducing the issue. I guess it was bad cabling or a loose contact that I fixed while redoing the cabling the other day. It is not really a lot of cables so the loose contact feels unlikely. The only thing I can think of would be to have had the motors cross-cabled by accident.
Anyway, it is OK now so we can close this one and chalk it up to being PEBKAC :wink:

thanks!

Hi @Frostlock,

Thanks for the feedback :wink:.
If anything breaks from now on, just let us know.

Thank you!