papous
Posts: 72
Joined: Fri Jan 05, 2018 5:50 am

Servo jitter and GPIO 29(??)

Mon Feb 04, 2019 6:10 pm

I am trying to detect what causes my two servos (MG90) jitter. Having tried a few solutions (that failed ) I used pigpio's PISCOPE just in case it provided with some more info. The image below shows activity at GPIO 29(??) which coincides with the jittering. I am not using and have nothing connected to GPIO 29 and anyway is there a GPIO 29??
Does joan mean BCM29 which is GPIO 5??
Any idea how to suppress this?
Thank you
piscope.jpg
piscope.jpg (159.07 KiB) Viewed 827 times

User avatar
rpdom
Posts: 14759
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Servo jitter and GPIO 29(??)

Mon Feb 04, 2019 6:33 pm

papous wrote:
Mon Feb 04, 2019 6:10 pm
I am trying to detect what causes my two servos (MG90) jitter. Having tried a few solutions (that failed ) I used pigpio's PISCOPE just in case it provided with some more info. The image below shows activity at GPIO 29(??) which coincides with the jittering. I am not using and have nothing connected to GPIO 29 and anyway is there a GPIO 29??
There are GPIOs 0 to 53. Only some of these are available on the GPIO connector of the normal Pi models. The rest are used internally on the Pi for things like the camera and power management and stuff.
Does joan mean BCM29 which is GPIO 5??
No. joan means BCM 29 which is GPIO 29.

You appear to be confusing the GPIO numbering schemes.

Board pin 29 is BCM/GPIO 5 (also confusing sometimes referred to as GPIO 21 in the WiringPi default numbering scheme).
[/quote]

User avatar
rpiMike
Posts: 835
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK

Re: Servo jitter and GPIO 29(??)

Mon Feb 04, 2019 6:41 pm


User avatar
joan
Posts: 14092
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Servo jitter and GPIO 29(??)

Mon Feb 04, 2019 7:06 pm

How are you generating the servo signals? If you are using pigpio via the dedicated servo functions it should be jitter free. A code listing may be useful.

papous
Posts: 72
Joined: Fri Jan 05, 2018 5:50 am

Re: Servo jitter and GPIO 29(??)

Mon Feb 04, 2019 9:48 pm

Thank you rpdom and rpiMike for clearing the GPIO 29 issue.

Joan, thanks for getting involved. I am using pigpio throughout my project which involves an engine and 3 servos. I also use it for the distance sensor and a LDR
Jittering starts immediately for the two small servos when running the script and really gets bad when the engine starts running despite a ferrite ring around the wires. The 3rd larger servo is not affected. The code for this is simple, the same function to move any servo:

Code: Select all

def servo_move(dir_pin, pulse_width):
    pi.set_servo_pulsewidth(dir_pin, pulse_width)
The servos and engine are powered by two 18650 cells with a UBEC to get down to 5v
I hope this is enough info

papous
Posts: 72
Joined: Fri Jan 05, 2018 5:50 am

Re: Servo jitter and GPIO 29(??)

Thu Feb 07, 2019 11:41 am

On the same subject:
I have made a proto board as in pictures to make the wires as stable as possible
New Doc 2019-02-07 12.50.06_1.jpg
New Doc 2019-02-07 12.50.06_1.jpg (160.74 KiB) Viewed 722 times
The attachment New Doc 2019-02-07 12.50.06_1.jpg is no longer available
I am the worst person in soldering but I tested everything with a multimeter and it seems to be OK
Could this be causing the jitter somehow?

pootle
Posts: 323
Joined: Wed Sep 04, 2013 10:20 am
Location: Staffordshire
Contact: Website

Re: Servo jitter and GPIO 29(??)

Fri Feb 08, 2019 9:43 am

When I first tried running 2 servos from a pi, I noticed some jitter and I solved it by decoupling caps right by the servos as well as on the driver board (which already had them) - I used a small tantalum and a larger electrolytic together. It completely resolved the problem.

papous
Posts: 72
Joined: Fri Jan 05, 2018 5:50 am

Re: Servo jitter and GPIO 29(??)

Fri Feb 08, 2019 10:45 am

Thank you pootle for your reply
Will you please elaborate your answer? Did you use a servo board? I am NOT using such a thing getting the pulses directly from the pi with pigpio.
What do you mean "decoupling caps right by the servos as well as on the driver board" ? Did uou remove them? It has been suggested by others that you should add capacitors to stop jitter
Many thanks again for taking the time

pootle
Posts: 323
Joined: Wed Sep 04, 2013 10:20 am
Location: Staffordshire
Contact: Website

Re: Servo jitter and GPIO 29(??)

Sat Feb 09, 2019 8:43 am

I blogged about this a while ago - here's the link.

So no driver board - sorry! got crossed brain wires with driving steppers! servo control wire plugged directly into gpio port
mini.jpg
decoupling caps by servo
mini.jpg (250.37 KiB) Viewed 636 times

MarkR
Posts: 154
Joined: Fri Jan 25, 2013 1:55 pm

Re: Servo jitter and GPIO 29(??)

Mon Feb 11, 2019 10:12 am

You will need to check, with an oscilloscope, the exact pulse behaviour.

I have seen, previously, in my own robots, that changing the pulse width *can*, in some circumstances, cause a short pulse to be emitted. It is unclear whether this is a bug in pigpio.

What I guess might happen is that during changes in pulse width, a short "runt" pulse is emitted - only in very specific circumstances - like changing the pulse at just the wrong moment.

Servoblaster (an earlier Pi PWM library) had some code in to handle this, it's not clear whether pigpio does the same.

The "runt" pulse might, depending on the servo, cause the servo to briefly be commanded to the "lowest" position (typically hard-left) - which it will try to drive to - but only 20ms later, a "normal" full-length pulse will arrive, which should reset it.

I haven't managed to capture this behaviour on a scope. It happens so rarely that it's hard to detect.

I also think that this might happen if you turn off the servo pulse entirely, e.g. if you send pigpio a "pigs s 17 0" command - there is a possibility of a runt pulse.

papous
Posts: 72
Joined: Fri Jan 05, 2018 5:50 am

Re: Servo jitter and GPIO 29(??) SOLVED

Tue Feb 12, 2019 5:23 pm

Thank you everybody for your answers
My problem was the extreme shaking caused on the camera mount caused by the engine when running.
Small jitter appears to be an inherent problem with small (cheap?) servos and it appears that it is difficult to solve.
I finally solved the violent shaking using a toroidal ferrite. The small shaking I will have to bear with

Return to “Automation, sensing and robotics”