Let's Make Robots!

Object tracking servo jitters... in only one direction?

I've come across a problem during the fine-tuning of my object tracker. When the "neck" servo is steadily decending positions (turning to the left) the movement is smooth, even with decrements > 1. It acts completely different when turning right. There is a distict pause between each SERVOPOS and I noticed it takes longer to process a debug cycle as well. The head shakes, rattles and rolls, the values used to adjust turning speed based on object distance are insufficient, and it just looks terrible. Like I made me a reject robot piece from a Herbie Hancock video.

Things I've done:

  • replaced the servo
  • swapped servo pins
  • checked voltages (servos on their own L7806, rest on 7805)
  • did all sorts of changes to the code to try and eliminate the hiccup
  • ran it at 8MHz
  • stared at debug endlessly

None of it changed the results. I should note that if I plug in a very simple min-position-to-max-position-sweeping program the jitter seems to go away. Maybe something in my code makes it slow? I've tried to make each direction routine exactly the same, process wise. I don't know, I've been staring at it too long. Any input would be epic.

20X2_eyes_debug_v3.3.bas2.74 KB
20X2_neck_and_eye_test.bas928 bytes

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

If I read you correctly than the ultrasonic ping signal (in the TX wire) creates brief interference, hampering the servo movement? If so I would think that the ping would make servos twitch even when in a stationary position. No?

Regardless, I've had a temporary setback, and had a new idea, which I'll make a fresh comment on.

Ignore my laundry laying around in the background, thanks :)

Sounds like a great write-up, I can't wait  ;)

Your explaination seems to make sense. I'll implement it and report back, Cap'n. Thanks!

I have the two sensors set up in a daisy chain that constantly loops after you send a startup pulse. After the chain starts you can access the sensor values through the analog pin or measure the next pulsewidth reading (what I do). Good thinking though.

It is probably the ping. Ping and servo gives always servo jitter if the pulse is send to the ping. Switch off the servo (set the servo pin low), before the ping pulse is send out, then use the servo command. In your case it is possible because no force acting on your servo, so the servo will not move if you set the servo pin low.

I had also some success replacing the servo cable by a three-wire shielded cable.