Running 5+ Servos on a uC32…Can I Do It?

Welcome back to the Digilent Blog!

 

In the not too distant past, we made a couple of posts on Pmods that can help drive motors as well as a post on stepper motors. Today, we’re going to check out running multiple servo motors on a chipKIT board. Why would we want to do this? Well, aside from the nice feeling that comes from successfully doing some extreme multitasking, we’d also be able to run some super cool mechatronics projects, such as a robot arm!

A mechanical servo arm.
A mechanical servo arm.

 

The short answer to our question of being able to running five or more servos of chipKIT uC32 is a definite yes… if we follow some guidelines.

 

Classic servo motors work by by receiving a PWM signal from the host board. Within the servo motor itself, there is a small potentiometer that receives this voltage signal and adjusts its angle (as well as the servo arm) based on how long the voltage pulse that it receives is. Normally, you might think that if something requires a PWM signal we would need to use a PWM capable pin on our system board in order to send out that signal; I know I certainly did. Luckily, servo motors do not have such intensive pin requirements. The motors themselves are actually expecting a pulse width that is (usually) somewhere between 1 and 2 milliseconds, which every GPIO pin on a chipKIT board can easily achieve. This becomes even easier with the chipKIT servo library, where you can simply tell a motor to rotate to a certain angle and not even have to worry about the pulse width.

Tower Pro SG92R servo motor available in the chipKIT Starter Kit.
Tower Pro SG92R servo motor available in the chipKIT Starter Kit.

 

You may be thinking to yourself, “If basically every pin on a chipKIT board is able to run a servo motor, then what’s the issue with running multiple servos?” This is a valid question. If you are operating the servo motors one at a time, then there is no issue with having a bunch of them. However, when you start running multiple motors at the same time, you start running into power issues. Servo motors are known to draw quite a bit of current (upwards of 100 mA) so when you get five or more servos running at the same time, you’ll likely end up drawing more power than you can supply through a computer’s USB port.

 

What can we do about this? The answer to this is what you might expect –use a larger power supply. What I recommend using is a 5V 2.5A power supply while bypassing the 5V regulator. This will allow the 3.3V regulator that operates the PIC32 microcontroller to work correctly and easily power multiple servo motors on the 5V power supply line without any fear of over-drawing current…unless you plan on running 20+ servo motors at the same time. Then you should give us a comment to find out what you should do next.

 

You can check out a uC32 in action with five servo motors in the YouTube video below!

Author

  • James Colvin

    A local Digilent employee who is sometimes tricked into making other content besides documentation and supporting customers on the Digilent Forum, but then I get to write a little more informally so that's a plus. A sassy engineer, lover of puns and dad jokes, father and husband. I know both way too much and simultaneously almost nothing about a number of nerdy topics. If you want to hear me rant, ask me what data rate USB C operates at.

About James Colvin

A local Digilent employee who is sometimes tricked into making other content besides documentation and supporting customers on the Digilent Forum, but then I get to write a little more informally so that's a plus. A sassy engineer, lover of puns and dad jokes, father and husband. I know both way too much and simultaneously almost nothing about a number of nerdy topics. If you want to hear me rant, ask me what data rate USB C operates at.

View all posts by James Colvin →

Leave a Reply

Your email address will not be published. Required fields are marked *