Servo Control with the pyMCU

pymcu-servo-helicopterAfter an idea for another crazy device, I decided that being able to control servos with the pyMCU, a real-world Python language interface, would be a good skill to have.  Fortunately, I had a few miniature servos on a helicopter frame left over from “Boxie the Creepster,” and decided to hook them up.

The pyMCU site has a good tutorial about hooking up a servo to this board.  This was a great introduction, and I had one servo tested in no time.  One difference between what I did and the tutorial, is that I didn’t hook up an external power supply.  This didn’t appear to be a problem, as there was very little load on the servos.  Depending on your servos (mine included) the wire color may be different than the tutorial.

After using only one servo got old, I decided to hook up two at once.  This was easy as well, and part of the code was duplicated in order to make the second servo work on a separate pin.  Servos currently cannot be controlled simultaneously with the pyMCU; instead one is actuated after another as shown in the first part of the video after the “read more” thing.

The code used in the first part of the video is a modified version of what’s on the pyMCU tutorial. The hold time is reduced to “20″, which seems to make them switch faster, while still allowing a seemingly full rotation.

rc-helicopter-servo-close-upAfter running the servos through their paces, I decided to program a simple GUI (graphical user interface) using Python’s “tkinter” module.  This can be seen in the second part of the video, where I push a button with the mouse to control whether a servo is up or down.  The code is available for download here.  It’s pretty basic, but maybe someone would like to expand on it.  You could really control a lot of things from LED lights to a remote control car using the pyMCU with a simple GUI like what is shown here.

  1. Robot with pyMCU Python controlled servos and LEDs - pingback on December 19, 2012 at 5:44 am

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks and Pingbacks: