Just an FYI for jbarchuk -- for now, I've managed another workaround, which is to simply extend the locking pin further than before. When the servo jitters on power-up, it doesn't move far enough anymore to momentarily unlock the box. So, I have a half-ass solution that at least works for the moment.
I just remembered... In model airplanes and probably in any servo system the most common cause of jitter is sloppy linkage OR plastic servo gears, OR both. Think of a long train of railroad card and the bit of slop between each coupler.
A description of what's going on in a 'list' kind of format rather than paragraphs...
Servo is motionless.
Servo receives a command to 'go here.'
Servo motor moves, force travels through the gear train, and the servo arm moves. At the same time the pot that senses position also moves.
The force of the servo arm is connected to linkage, maybe to more linkage, but there's usually at least a control arm and then another connector at the other end of the control arm that fastens to the item you want to move.
Actually in your case, the lock thing, it might be just one link at the end of the servo arm, and the lock pin at the end of the control arm. But hang with me...
If there's any slack in any of the linkage connections, when the motion starts it may not actually be solidly contacting whatever it's pushing. The servo arm moves until the slack distance is crossed, *bangs* into the control arm, and the control arm moves.
At the far end of the control arm there might be more slack. Again the control arm side of the linkage *bangs* into the end effector, and the end effector moves.
Now the end effector is moving, and because the servo is still pushing all the slack is taken up
The train analogy... As the engine starts to move, the slack in the coupler to the first car is taken up, then the first car moves. Then the slack in the next coupler is taken up, the second car moves, and eventually the whole train is moving.
The servo is moving, the pot is turning, When the circuit senses that the pot is rotated the correct amount, the circuit yells STOP!
The motor stops, and the servo arm stops moving.
But, because of the slack in the linkage the control arm doesn't stop immediately. Momentum lets the control arm keep on moving till the slack is taken up, and -then- it stops.
There's a *bang* of force -back- -into- the servo gear system, similar but opposite to the bang when the motion started.
The control arm stops moving.
The -force- of the control arm stops, but because of the slop at the other end of the linkage the momentum of the end effector allows it to travel a little more, until the slack is taken up and there's another *bang*.
Because the servo end of the linkage is now tight, the *bang* force of the end effector stopping is similarly transferred back to the servo.
Especially with plastic gear servos there's a little slop. The force of the bang-bang turns the gears, and the -pot- turns a little.
Control circuit says 'nope, the pot is in the wrong position, reverse the motor and move till the pot is in position.'
The move-bang-bang / pot is in correct position / stop-bang-bang happens again, except in the opposite direction.
The momentum again moves the slop in the gears, the pot moves again in the original direction.
Circuits says 'nope, still not right, try again,' and turns on the motor in the original direction.
I guess by now you see where this is going. The circuit tells the servo motor to stop at the correct point as reported by the pot, but then the momentums -allowed- by sloppy linkage and gears forces it away from that point.
The circuit struggles valiantly to hold the pot in the correct position, but the linkage repeatedly shoves the pot which causes the circuit to repeatedly try to control it.
The result is interminable oscillation/jitter. I have one plane that does this in the rudder. I used a -lighter- than recommended servo, but the spec is -strong- enough for it to work great in flight. The -linkage- is fairly tight, but not rigid, for reasons that I'm not going to go into here. However, when I turn it on, as the servo centers the rudder, there's sometimes enough pure -mass- in the rudder to pull the servo pot out of position and cause it to oscillate.
Oscillation is a *TREMENDOUS* stress on servo, gears, and linkage, and a nearly continuous maximum power draw.
About the lock pin... Even with tight linkage there -might- be enough -mass- in the pin to pull the plastic gear slack far enough to throw the pot out of position, very similar to the rudder I mentioned.
Two potential fixes.
1) If you're using a metal pin change it to something much lower mass such as bass or spruce wood, or carbon fiber rod. That fix is mechanical work and new parts and such.
2) Slow down the servo motion speed to reduce the force of the 'bangs' of the slack. That fix is pure code and no mechanical changes.
(The problem I'm having is apparently totally different from this one. It's not a jitter at all. I'll start another thread after I look at for a while more.)