Automated Light Painting Write Up

*Wordpress can be a pain to format in, so please check out our PDF version of this writeup with photos and proper formatting.  PDF can be found on our Resources page. Enjoy!

The Automated Light Painting Machine is a creation that allows us (and you) to do some pretty interesting things with light painting! At its most basic, it a robotic device that moves back and forth across the camera’s vision using LEDs to create a light painting. The most interesting features of this machine are that it is connected to the Internet, has smooth motion, and can be scripted for repetitive tasks. These features allow our light painting machine to be used by anyone in the world with Internet, and also allow for easy light painting animation. Let us explain more…

We originally set out with the goal of wanting to give as many people as possible the ability to create light paintings. Since we first discovered what light painting was, we’ve been obsessed. Naturally, the Automated Light Painting Machine became a project because it allowed us to continue exploring our artistic goals with light painting as well as (hopefully) expose many more people to light painting. Taken from our projects page, here is a quick description of how the Automated Light Painting Machine works:

  • You submit an image file (jpg, png, etc.) to our interactive webpage
  • Our website takes your submitted photo and saves it
  • Your photo then travels through the Interwebs to our local Light Painting Machine
  • The brains of our light painting machine, a microcontroller called the Parallax Propeller (similar to Arduino), receives information about the photo
  • The Propeller then choreographs motor movement, DSLR camera triggering, and LED pattern timing
  • A light-painted photo of your submitted image is then uploaded to our website, and delivered back to you for you to enjoy

For our convenience (laziness), and your reading enjoyment, the technical details of this project will be presented in a bulleted style. The details included are a hodgepodge of materials used, things we learned, things we would change, summaries, and plenty of incomplete sentences.

Instead of inserting pictures every other paragraph, we tried to keep things neat and placed some photos at the end. We tried to keep them in the same order as they are described in the text, so if our descriptions are poor check out the image and hopefully it will make sense. Also, check out the video on our website to see this thing in action or hopefully even use it yourself!

  • Drive Mechanism
    • Linear Bearing
      • We used some cheap Amazon ones that were pretty poor. We recommend spending a little more to get something half decent. We were told Ebay is a good resource for moderately priced linear bearings.
      • In retrospect, I think the rollerblade or skateboard wheel version of DIY camera sliders/linear bearings would be a better option for this project.
      • We found that Teflon oil makes a big difference on how smooth the bearings roll – we used a Teflon bike chain oil
      • Aligning and mounting linear bearings on carriage is very difficult. We needed 4 sets of 4 square holes that all needed to be parallel. Easier said than done with no drill press or machinist tools
  • “Supported” rail
    • Picked up some copper rail from Lowes that worked OK for how cheap it was ($10 total)
    • Getting the rails parallel was difficult. Since we were building our own “supported” rails we had 2 axes that we needed to ensure were parallel
    • Definitely needed support midway along the rail to prevent flexing under weight of itself and carriage. To solve this issue we placed an angle bracket and shimmed it until the rail was level
    • There was some “gunk” on the pipes, so we lightly sanded them down and cleaned with acetone – this definitely made the carriage ride smoother on the rails
  • Chain and sprocket
    • A great cheap way to find parts was Charlottesville’s community bike center (thanks!).  We got more chain, sprockets, and pedal assemblies than could ever be used in a lifetime. For free.
    • Instead of buying a long, custom chain assembly, we wanted to splice a couple bike chains together
    • Everyone will tell you that you need a “master” key for splicing bike chains back together, but we found that it wasn’t necessary
      • Using a vice and punch, you can knock out one of the pins holding the links together
      • To put the chains back together, use the vice as a press and press the pin back into the link
      • Tip: we originally tried pushing the pin back into place using the punch but found it very difficult to do, so that’s why we recommend using a vice or press to do it
      • Tip: when “breaking” your first chain, don’t punch the pin all the way out because it has a flared end that makes it a pain to get back in. Just punch it enough to wiggle the inner link free
    • Bike sprocket was easy to mount to Pololu motor – we used the coupler they sell with the motor.  One slight modification we made was to drill out larger holes in the coupler to accommodate some larger bolts we wanted to use.
    • The skateboard truck was perfect hack to have as the free-spinning side. Having this work perfectly right off the bat was definitely one of the triumphs of the project. We reused the truck’s original mounting holes to secure the truck in place and it worked great.
      • We pressure fit a sprocket on the wheel and used a zip tie to prevent it from slipping off – it has run for many hours and has never needed any adjustment.
      • Tip: tighten the hell out of the kingpin so that the truck doesn’t flex under load
      • Motor Position and Drive
        • Limit switches
          • Ideally you’d like your limit switches ordered like this: software > optical > physical
          • We made a big mistake by excluding the optical switch. It would have been real easy to include some photo resistor as the optical switch, but we were ignorant then lazy so it never happened.
          • For the physical switch, we used mechanical relays that were offset from the actual physical boundary to ensure there was plenty of space for deceleration in case of emergency
          • An Initialization routine at startup sets up where the software boundaries are located.
  • Movement software
    • Ramping acceleration profiles for starting and stopping the motor made the overall operation of the machine much smoother
    • Even with the backlash in the motor, we were able to get great position replication (eyeballing says within < 1/2 inch on each end)
    • We cheated the starting and stopping location of the carriage by using the acceleration profiles we discussed. Since we weren’t implementing a control algorithm (like PID) on the position of the carriage, we just experimentally found how far the carriage would “drift” once we turned off power to the motor.
    • This worked fairly well for how crude it was, but by adding the acceleration ramp up and downs, we were able to get much better positioning repeatability
  • Pololu Driver Chip
    • Lower end chip that is effectively just a power amplifier
    • Requires us to send the PWM signal
    • http://www.pololu.com/product/1212
  • Pololu Motor
    • Comes with built-in quadrature encoder
    • 100:1 Gear ratio
    • http://www.pololu.com/product/1446
    • Power
      • An old desktop computer was salvaged and its ATX power supply was used for all the power needs in this project
        • For those who don’t know, you can get these for very cheap at thrift stores – they offer regulated 12, 5, and 3.3 volts and can pull many amps
  • LED
    • 5V – 1.5A (max)
  • Motor
    • 12V – 3A (max)
  • Parallax Propeller
    • 5V – 200mA
  • Nikon D40 Camera
    • 8V – 500mA
      • A Pololu variable voltage regulator bucks the ATX PSU’s 12V to 8V
      • A custom battery replacement allows for continuous long term use of the camera
  • Camera IR remote
    • 5V
    • Remote was hacked open and hardwired to the power source and a I/O pin for trigger

 

  • Nikon D40 Camera
    • To take the light painting photos, a Nikon D40 was used
      • Aperture = 29
      • Exposure = 4 seconds
      • Many people debate on the best aperture setting for light painting, for this application we wanted a dark background so that’s why we chose the smallest setting
  • Shooting in tethering mode
    • For those who don’t know, tethering mode is a when you connect your camera to the PC for shooting. It allows you to do cool stuff like controlling camera parameters from within the PC.
    • For our application, we needed to be able to immediately upload a photo that was taken on the camera to the PC, so this is why tethering was necessary for us.
    • digiCamControl is the software that runs on the local computer and allows tethered control of the camera
    • We played with a few other free software packages like DIYphotobits, but digiCamControl was above and beyond the best one. We recommend checking it out.
  • Remote photo triggering
    • To automatically release the camera’s shutter, an IR remote is triggered by a Propeller pin to trigger the camera
    • The IR remote was torn apart and hacked so that it no longer required a manual, physical button push, but could be triggered electrically using an NPN transistor and the Parallax Propeller
    • Local PHP script
      • The local PHP script was responsible for two actions in this project. First, it needed to grab and download to our local machine the newly submitted photos users uploaded on our website’s interactive page. Second, it needed to take the photos acquired by the camera and digiCamControl and upload them back to our website’s server so they could be displayed for the user to see.
      • As a note, neither of us had used PHP at all prior to this project. Undoubtedly we did things in a roundabout or naive manner, but we were happy overall with how approachable it all was with XAMPP and NetBeans.  We definitely recommend these tools to anyone trying to familiarize themselves with running PHP locally.
      • Uploading
        • As mentioned before, the uploading portion was responsible for taking photos from the camera and putting them on our website’s server
        • To do this, the PHP script found photos put into a designated folder by the digiCamControl camera tethering software, then uploading the image to another folder on our website’s server through FTP
  • Downloading
    • The local PHP script also monitored a queue folder on our website’s server to see if any new user photos have been submitted
    • If there has been submission, the script grabs the photo and downloads it locally
    • Then, via serial communication to the Parallax Propeller, it passes on byte by byte all of the colors and frames required to reproduce the photo via light painting
    • Server PHP
      • The server-side script was responsible for taking a user’s submitted image and placing it in a “queue” folder
      • Additionally, the script resized every image (proportionally) to make sure that the height was only 30 pixels. 30 pixels was chosen because that is the quantity of LEDs we have in our LED strip
      • The server-side script also was responsible for displaying the user his or her light painted photo once it gets passed to the server from the local PHP script
      • Parallax Propeller
        • The Propeller took care of the motor control, encoder reading, serial communication with local PC, camera triggering, and LED strip writing
        • How it all works together is something like this:
          • Propeller receives start signal from serial communication with PC
          • Propeller starts moving motor
          • Propeller triggers camera shutter
          • Propeller starts pushing each “vertical slice” of color data from image to the LED strip
          • Keeps changing LEDs based on picture until finished
            • Time between “vertical slices” is calculated based on picture pixel width divided time required to move completely across the frame of the camera
    • Propeller monitors encoder until it hits software limit switch and starts deceleration
    • LEDs shut off, motors turn off, and camera closes aperture

 

We hope you enjoyed reading about our robotic light painting project and maybe even learned a little something along the way. If you have any comments or criticism, we welcome them! We know for a fact that things could be done different and/or improved, so we’d love to hear what you have to say about it. Reach out to us on our website, or send an email to embeddedaesthetics@gmail.com.

Leave a Reply

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

You may 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>