Friday, August 23, 2013

LED Photo Drawing Robot

LED Photo Drawing Robot


A few years ago on a camping trip my friends and I started playing around with drawing shapes with our headlamp while someone else took a 30-second exposure with the camera.  I drew Pac-Man chasing a ghost and it came out fairly well for blindly waving a flashlight around in the dark.

I thought it might be cool to build a robot that could draw a picture like this.  I built a robot that moves a LED around a grid and then turns on the LED to the desired color at each location on the grid.  I used my DLSR to take a very long exposure while the robot is moving the LED around the grid.   The end result is a photo of the LED at all of the various points in the grid which (hopefully) looks like the image the robot is trying to reproduce.

LED Photos

Pac-Man

Given the photo that gave me the idea for the robot I had to try a Pac-Man image first.  This was a nice photo to start out with because there was a lot of black in it so it only took the robot about 10 minutes to draw it.  That made it nice for troubleshooting because I only had to wait 10 minutes to see if it worked.



The Starry Night

Next on the list was The Starry Night.  This was a big jump in complexity over the pac-man photo.  It took me a few attempts to get all of the kinks worked out.  There aren't many all black pixels in this one so it took about 30 minutes to complete.   It is a long shot from a perfect replica but at least you can tell what it is :)

Lego Mona Lisa

I stumbled across this image and it seemed too fitting for this project :)


In Action


How It Works

The LED


The color sensor from lego can also produce light of various colors but it is pretty limited.  You can only tell it basic colors like "red", "green", "yellow", etc.  I needed a way to produce a larger range of colors so I bought a dLight from Dexter Industries.  It comes with four LEDs but I only ended up using one of them.  Most of the time you see these used in robot cars so people can add turn signals and/or headlights.

The LED was a little bright though so I punched a small hole in a piece of black construction paper and taped that over the LED.  That gave me a smaller light source which meant that I could squeeze in more pixels.


Robot Hardware

I needed the position of the LED to be very accurate so that I could draw the right color pixel in the exact spot where I needed it.  I've tried doing super accurate movements like this before with a robot that drives around on rubber wheels but at some point the wheels always slip a little and that throws everything off.  To get the accuracy I needed I built a platform with two rows of gear-racks on top.  The LED sits on top of a motor which has gears for wheels, these gear wheels drive along the gear racks.  This is how the LED moves up and down.



Getting the left to right movement was a little trickier.  I put wheels at the ends of my "up/down" platform and attached a long arm of beams to the platform.  I put gear-racks on top of the really long arm and used a 2nd motor to turn a gear that joined with those gear racks.  This gave me a way to slide the "up/down" platform left and right.

Robot Software

I wrote small program in PERL reads an image file and gets the color for each pixel in the image.  This ends up being information like "Pixel 10x50 has Red=57, Green=140, Blue=200".  I just printed all the information about what color each pixel should be into a simple text file.   I then copied that text file over to the robot where the robot would read the text file to learn how much Red, Green, and Blue for the LED to output at each location.  Then you just have it move to every location listed in the text file and tune the LED to the correct color.



5 comments:

  1. I read your blog and I noticed some useful tips about best car accessories from this post.Thanks for sharing unique information about car accessories.

    floor locks & appliance casters

    ReplyDelete
  2. Interesting post and thanks for sharing. Some things in here I have not thought about before. Thanks for making such a cool post.
    LED Robot Party Service

    ReplyDelete
  3. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post.


    LED robots

    ReplyDelete
  4. Share great information about your blog , Blog really helpful for us . We read your blog , share most useful information in blog . Thanks for share your blog here .
    โคม ไฟ ถนน led

    ReplyDelete