Servo circuit

Preventing random servo movement during Arduino reset

When controlling a servo with a microcontroller such as an Arudino or Raspberry PI you will likely face that the servos tend to move randomly when the microcontroller powers up or down.

Servos wants to be fed power and a PWM signal. The PWM signal is a continous electrical pulse that tells the servo where it should be positioned. When using a microcontroller it will be responsible for generating this pulse.

During power up, power down, and while the microcontroller is booting and before it starts providing the PWM pulse the servos can get confused and move randomly.

Most of the time this is not a problem, but for some applications where there are mechanical elements you don’t want to move to the wrong position this can be a problem.

One way to solve this is to make sure the servo power is controlled from the microcontroller. This can be achieved with a power MOSFET transistor.

Here is a circuit I made for this purpose, based on circuits I found on the internet. It uses a IRF510 Power MOSFET because that was what I had at home. For this application I’m using the Arduino Pro Micro.

Circuit

Lately I have made myself a nice Illustrator template with a grid and components so that I can create nice perfboard layouts. In this case I added headers for the Arduino Pro Micro so that it can be fasteded solidly onto to the perfboard.

Perfboard circuit layout

Also, I bought some nice covering pens to label the pins. Here is the resulting perfboard circuit. Pretty nice I think.

Servo circuit