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.



Tuesday, August 20, 2013

Lego Technic iPhone Tripod


The Motivation

I downloaded the LEGO Movie Maker app for my iPhone a few days ago so my daughter could try her hand at making stop motion videos.  It is really easy to use, it only took a few minutes and my 6-year old was reenacting Luke rescuing Leia from the Death Star.  My daughter couldn't hold the phone in the same spot though so the movie ended up being a mix of Star Wars and The Blair Witch Project.  I didn't get green watching it but that is only because it was about 4 seconds long.  It was still really cool to see her make a movie on her own though :)

The Tripod

Anyway, we didn't have a tripod for an iPhone so I started building one out of technic parts.  The only parts I used that were not from my Mindstorms kit were the three technic turntables.  These cost about $1.50 each on ebay so the entire thing is probably $7 or $8 in parts.

There are two turntables on the sides so that you can tilt the phone forwards and backwards.  There is another turntable underneath that lets the phone twist left and right.

And yes I know that this isn't technically a tripod but I figure "iphone tripod" is probably googled about a billion times more often than "iphone bipod" :)




Parts List


QTY: 1

QTY: 8

QTY: 2

QTY: 4

QTY: 2

QTY: 4

QTY: 4

QTY: 46

QTY: 2

QTY: 2

QTY: 4

QTY: 2

QTY: 8

QTY: 1

QTY: 4

QTY: 4

QTY: 3

Instructions

I used LEGO Digital Designer to create the build instructions that are in the video.  If you don't feel like pausing the video every 5 seconds you can download the LDD file for the tripod here