Servo Jitter (was Servo Problems)

LFLekx

Member
Starting a new thread, since I don't want to hijack the other one... :)

As I stated earlier, I'm having problems with the servos jittering during a wait loop. I'm attaching a diagram of the circuit I'm using, plus the original and revised code I'm using to drive the system. The only things I haven't included in the drawing are the batteries and the switch that goes between the 0V leg of the batteries and the 0V leg of the circuit itself...

The servos themselves are unmodified, Power Racing SG-5010 devices.

Suggestions...?

(The revised code will follow...)
 

Attachments

Last edited:

BeanieBots

Moderator
Too many servo commands in sequence.
Use servo to set up the pulses and then servopos to change position.
If your PICAXE does not support servopos, make sure there is a pause of at least 20mS between servo commands or use pulsout and generate your own frame rate.
 

LFLekx

Member
Which is why I asked (in a different thread) if my older 18X chips support the servopos command.

But - with a one-second delay between commands, is that really an issue...?

I have uploaded the revision D code into the chip, which does use the servopos command for the bulk of the task... but haven't set it up for testing yet.
 

BeanieBots

Moderator
Let us know how it goes with servopos.

Bear in mind that routines like this
Code:
neutralize:

	servo roll_servo, neutral
	servo pitch_servo, neutral
	servo yaw_servo, neutral
	servo gain, poweroff
will exhibit the same problem because there is only ONE servo counter so EACH servo command will reset the counter and potentially cause a glitch.

Also, I'm not 100% sure about the effect of using 'wait'.
If the problem persists, try replacing the waits with pauses.

EDIT:
In your earlier thread you said the circuit was on breadboard.
Have you included decoupling caps?
Does your servo ground send current down the PICAXE ground connection? (layout is important)
 
Last edited:

hippy

Ex-Staff (retired)
Also, I'm not 100% sure about the effect of using 'wait'.
If the problem persists, try replacing the waits with pauses.
The compilers convert "WAIT N" to "PAUSE N*1000", hence the limit of N=65 and inability to use "WAIT variable", so there will be no diference in operation.
 

BeanieBots

Moderator
Thanks for clearing that one up Hippy. Must make a note of that.

LFLekx, break your code down to absolute minimum and find out when/where the problems start.
For example, is the problem ONLY when updating position or does it happen even when the servos are (should be) stationary?
 

LFLekx

Member
will exhibit the same problem because there is only ONE servo counter so EACH servo command will reset the counter and potentially cause a glitch.
So... I should put delays in between them as well...?

In your earlier thread you said the circuit was on breadboard.
Have you included decoupling caps?
Does your servo ground send current down the PICAXE ground connection? (layout is important)
See the diagram - I've put 100uF capacitors between the PICAXE power leg and the ground, as well as the servo power leg and ground. There's also a .1uF cap immediately before the power rail connects to the chip itself.

Regarding your other suggestion - I can break down the code into smaller segments, but I'm currently finding that the servos are jumping only when they're supposed to be stationary in their neutral position.

Thanks for the advice, BTW...
 

BeanieBots

Moderator
So how do they behave with a simple prog like this?
(not sure which pins you used but you get the idea)

Code:
servo 1,150
servo 2,150
servo 3,150
servo 4,150

do:loop
 

LFLekx

Member
I used 0-3... but I get the idea. :)

I'm starting to wonder if trace lengths are a factor... since the problem seems to only be on outputs 2 and 3, which have the greatest separation between source and resistor.

I've decided to re-make the board layout, with the connectors positioned much closer to the chip itself. I'll be testing it shortly...
 

BeanieBots

Moderator
The signal path length should not be a problem unless you're talking several meters.

It's not so much track length but path which is important.
Particularly supply lines.
If either supply or 0v is common to the PICAXE and current carrying of the servos, then there will be problems.
 

LFLekx

Member
The 0V rail is common to both... but since the problem manifests on two outputs instead of all four, I don't consider that to be the issue.

(I could be wrong, of course... :) )
 

BeanieBots

Moderator
If they weren't common, they wouldn't work at all.
It LAYOUT that matters.

Did you try the code I suggested?
What was the outcome?
Rock solid or still jittering?
What happens if you apply a little pressure to each one.
 

LFLekx

Member
Haven't tried the code yet... but added a circuit board that works as a pass-through for the servo signal, while providing a separate (though still switched via the 0V common connection...) battery pack for the servos.

Be and Lo-Hold, the jittering stopped!

Maybe it's the third battery pack that provided a marginally more isolated power source to the servos, maybe it's the third capacitor, or maybe it's the simple fact that power doesn't go through a Y-harness to reach the servos that did it. All I know is that they're now rock-solid, even when I apply pressure to any of the control arms.

My next task is to perform the same tests, with the heading-hold gyros installed between the processor and the pass-through board - see if that works. Then, I'll swap out the existing control circuit for the second one I've assembled... which will power both the control circuitry and the gyros from the same 4.8V battery. (If that doesn't work, no big deal... but if it does, I save the weight of the one battery pack. :) )

If you're interested... this is going to be installed in a high-powered rocket, in order to keep it in a roll-free, vertical trajectory for video recording of the flight.
 

BeanieBots

Moderator
It'll be the path your servo 0v current takes rather than the 3rd battery.
I'll put money on it.
The art of 'decoupling' is to get the capacitors in the right places AND have the currents flowing in right tracks. The result is the same as having a seperate battery for every part of the circuit but only using one.

Anyway, the important thing is that you've got it working so you know it CAN work.

Please post the video when done.
 
Top