Electronic – arduino – How to prevent servo startup jitter

arduinoservo

I have a small Arduino Uno powered robot I'm entering in a competition, and it uses some small servos to position sensors and other actuators. According to the rules, it can't move until a pre-determined signal is received, at which point the robot is manually switched on. However, when it starts up, the Arduino will actuate the servos to random positions, causing a "jitter" that would immediately disqualify the robot.

How do you wire/code the Arduino so that, when initially switched on, any attached servos will remain at their current position and will not "jitter" at all?

The servos are connected to the standard DIO pins using the built-in servo library.

Best Answer

When powering on an Arduino obviously you won't have the Servo positions (as you say), so you need to determining the position of the servo after turn-on. This is not easy. It would involve additional rotational position sensors.

If you really need the Arduino to power up from being completely powered off then I would "park" the servos to a certain position before power-off. Then during initialisation after power-on return the servos to the parked position, and so clearly they would not move.

Alternatively, you could consider a sleep mode for your robot where the Arduino does not truly power off and therefore the variables containing the servo positions are not cleared.