Servo Light Graffiti – Preliminary Results “Servo-Painting” a Circle

servo-and-light-graffiti-resultsThose that read this blog regularly know that I enjoy light graffiti.  I’ve also been experimenting heavily with the pyMCU*and servo use. Combining all of this together with a cheap laser, it would seem possible use these elements for an automatic light graffiti assembly.

You can see some very preliminary results in the picture to the right, but be sure to check out the video of the servos in action after the “read more.”  The hobby servos with their pan-tilt mechanism (a Servocity SPT100) look really cool moving in a sinusoidal pattern.

Here’s the Python code that I used to accomplish this task using the pyMCU.  I’m not a professional programmer, so it could probably be improved Python-wise, but the mathematics behind making and scaling a circle with two servos could be useful.  One has to consider a sine/cosine relationship with the circle, then another one to figure out what angle each servo should be tilted at to achieve this on your surface.  You also have to scale the radian Python function value to a servo value, so it’s not the easiest task in the world.

The Python script that I wrote also includes routines to compensate for how far away the projected image will be as well as how large you would like the circle.  I’m not certain that it scales perfectly, but it’s a start.

The servo mount for the laser is modified from what I used with this CNC laser light painting project.  I put a 1/4 – 20 screw through the bottom allowed me to attach it to hobby servo pan-tilt bracket.  Repair putty (Loctite 431348 available from Amazon) was used for better threading.  One improvement over the CNC project was that power is provided from the pyMCU to turn the laser on and off, rather than relying on the battery and manual switch used in the bracket’s first life.  That and the fact that the graffiti assembly is much smaller should give it a lot of further potential.

CNC light paiting setup "JCOPRO.NET"

CNC light painting setup “JCOPRO.NET”

More Background: Of course, this isn’t the first time I’ve tried some form of automatic light painting, and a lot more stuff that I’ve written about went into it:

Wow, a lot of background goes into this.  Sometimes when I make projects everything seems like common sense in hindsight.  Seeing it written out really gives me more of an appreciation for the various technologies involved.  That being said, I plan to do more with this light-painting apparatus than just light-paint a circle.  I won’t reveal exactly what is planned, but it’s closely related to this CNC project…

*Please note that the pyMCU used in this post is a beta version that can control multiple servos simultaneously.  Some commands may not work in the standard pyMCU currently available.

Update 1/20/2013: I originally had a version of another related program I was working on for download instead of the “circle trace” program.  The correct code is listed now.


  1. How to Tap Wood for Machine Screw Use - pingback on January 23, 2013 at 6:43 am
  2. Servo Light Graffiti with Python and the pyMCU - pingback on January 30, 2013 at 6:22 am
  3. Light Graffiti with Servos and Python - pingback on April 5, 2013 at 5:28 pm

Trackbacks and Pingbacks: