Controlling 5 Servos With a Raspberry Pi

John Baichtal

My interests include writing, electronics, RPGs, scifi, hackers & hackerspaces, 3D printing, building sets & toys. @johnbaichtal nerdage.net

2246 Articles

By John Baichtal

My interests include writing, electronics, RPGs, scifi, hackers & hackerspaces, 3D printing, building sets & toys. @johnbaichtal nerdage.net

2246 Articles

Article Featured Image

Pierre Villeneuve attached five hobby servos to a Lego model, controlled with a motor control board board and a RasPi. This is a nice way of controlling a Lego robot without needing to use Lego’s robotics components!

I initially tried to control my servos directly from the Raspberry Pi through its GPIO ports using the RPIO library, which has built-in support for software PWM. In my first implementation I saw excessive jitter in the resulting servo motion. This may have simply been a problem with my code?? I bailed on that approach and switched over to the nifty yet inexpensive hardware 16-channel 12-bit PWM controller board from Adafruit.

The most intriguing part of the project for me, however, is how Pierre made a histogram of a royalty-free music track he found, and used that to sync the motors’ movement to the beat. His GitHub has the source files for this project.