Servo Controlled Camera Question


Just a quick question:

I'm having an issue with the face tracking in that if a face moves off screen too quickly, it is, of course, lost. It would seem iRobot's head need to move more quickly to keep up (with a reasonably moving face) but if I set the servo speed over 2 it gets jerky and kind of scary. My frame rate is pretty slow. I don't remember the exact rate but it's under the lowest setting. I have the camera resolution set to 160x120, the lowest res. Would a faster computer help? I'm running it on an old quad-core, win 7 unit. I have an i7 Asus laptop but the vid card went belly-up (I think). I may risk the $70 for a used vid card replacement. I'm assuming the camera is a processor intensive process and that more RAM or better graphics won't help.
Thanks Smile


I believe your reference or "servo speed" was incorrect. Did you mean the "tracking steps"? I.e. How many steps to increase/decrease while tracking when an object is outside of the grid lines?

Because with servo speed, the higher the number the slower the servo moves. Which is actually what would solve the jerky movement if the steps were increased.

Increasing the steps will increase jerky movements - but you will need to if the face moves too quick. Increasing the servo speed will dampen the jerky movements. I would start with a servo speed of 1, then move to 2, etc. find the most appropriate speed.


Oh, i forgot to add how to set the servo speed.

1) Press CONFIG button on the connection control

2) Edit the script for the EZ-B #0 Connection

3) Add something like...


# Init horizontal servo to center
servo(d0, 90)

# init vertical servo to center
servo(d1, 90)

# set servo speeds
servoSpeed(d0, 2)
servoSpeed(d1, 1)

Each time the software connects, that script will run. The script must run for the servo speeds to initialize. The servo positions must be set before the servo speed command takes effect.


Yes, DJ, you're correct, I had it backward in my head. I have the speed set to 2 (using script). 3, it's too slow, 1 and it's too jerky.

I haven't played much with the "steps". I'll give that a try. Thanks DJ.


Also, what's the best way to increase the frame rate (through hardware)? Would that not help with better tracking?


There is a slide dial to adjust a delay. Ensure it's set all the way to the left.

User-inserted image

The video card doesn't process the recognition algorithm - the video card displays video. There was an update to EZ-Builder a few releases ago with performance enhancements for face tracking. I would recommend upgrading to the latest EZ-Builder.

Based on your usage, the update to face tracking includes new parameters...

User-inserted image


Just a thought and question here; once all servo positions and then the speeds are initialized it seems like the servos are now energized and holding position. If you don't need them in that state would it be advisable to release them? I would think this would save power and servo life.

Once released do they have to be initialized again?

I sometimes see my servos jerk when I send a series of release commands to several servos (with sleep commands between the releases). Sometimes they jerk violently sometimes just a twitch, sometimes not at all. Any thoughts on this?


When you release a servo, it is no longer holding position. When the servo is re-initialized to hold a position, it will move to the position. The jerk you are experiencing is the servo moving into position. When released, the servo is not holding position so it may have moved. A servo that moves, is no longer in the original position.

Also I highly doubt after a release, that you're putting the servo back in the original position that it was when released. Which means not only is it moving into a position because it had moved due to the weight of... ah i'm not finishing this sentence - it's common sense Smile

Find out how a servo works here:


@Dave Although I haven't yet tested the new camera up/down micro-servo, the head left/right servo did buzz and use juice when it was done tracking. I was lucky though; when the head centered, it seemed to rest in that position. That's why I wrote the script to center the head when finished tracking. No release necessary in my case.
You, on the other hand, with those "Danger, Will Robinson!" arms, I can certainly see why you want to release them.
BTW, I have one of those digital servos, the Hitec HS 7950TH you used for the arms and modified the controller, I have one barely used if you'd like it. $75 a fair price? It didn't fit the servo housing in the top of the spine.

@DJ Thank for the info. I need to play with the new release a little anyway. I was having trouble with the face tracking after installing it. Dave suggested deleting the camera control and opening a new one. Servo speed and slider worked fine.


@DJ I do appreciate your explanation of how a servo works and the link to an more detailed explanation. However this "jerk" seems to have nothing to the normal behavior of a servo or static induction. It's seems more like a voltage serge. It happens when a series of servos fed from the same power supply are released by EZ Builder. I really don't think it has anything to do with EZ Builder. It's probably the way I have my circuit designed or my scripting. Here's the script that's runs when the most noticeable jerk happens:


release(2.D1) #Release Rt Wrist Up & Down Servo
Release(2.D0) #Release Rt Side to side servo
release(2.D4) #Release Left Wrist Up & Down Servo
release(2.D5) #Release Left Side to side servo
release(2.D6) #Release Left Claw
release(2.D3) #Release Right Claw

I know this is Mac's thread so no real need to follow up on this here. I just thought this may be useful to him.

Mac, I would be interested in your very fare offer. Please contact me at and we can seal the deal. Winky