Saturday, February 18, 2012

Baby Star Lights

My daughter just turned 3 months old, and she is completely fascinated by lights and things that move.  I got the idea to make a star projector from seeing one of these stuffed animals that puts a star pattern on the ceiling, although mine is a little different.  My project uses an MSP430 to control an LED inside of a ping pong ball that's mounted on the end of a servo to rotate it.


I started out by taking a ping pong ball and drilling holes all over it with a 1/16" bit, the smallest in my set.  I used a 3/16" bit to make hole for an LED and I spray painted the ball black to avoid having the ball glow.  To test it out, I wired up a quick LED circuit and when I went into a dark closet it was clear that 1/16" was too big of holes--the light was not near focused enough on the ceiling, and  it'd look even worse in the baby's room.  I started over with a new ping pong ball and used a hot sewing needle to poke tiny holes and got closer to the look I wanted.




 Switching over to the electronics, I used an MSP430G2211, which is one of the chips that comes with the MSP430 Launchpad.  Any of the small MSP430's would work just as well...the firmware's really simple.  Basically when you switch it on, the LED turns on, and then the servo rotates slowly one way to the max and then goes back the other way, and repeats.  It runs for a set amount of time (15 minutes right now...it can be varied based on how long it takes for my daughter to calm down and go to sleep), and then shuts everything down and goes to sleep (LPM3).  The servo control is on P1.1, and the LED is on P1.2.  I got a servo for $2.50 that works great.  I tried to use a red-yellow two color LED, but the one I had was too dim, so I used a bright bluish-white LED instead.  I might use an RGB LED in the future if I come back to this and clean it up.  It's powered by a 4xAA holder from Radio Shack with a power switch built in, and an L78L33 provides 3.3V for the MSP430.  The PCB I used is a spare from a stalled project (a Wii Nunchuk controlled RC car...the same board is used as the controller/transmitter and receiver/motor driver and also serves as a simple breakout board for 14 pin MSP430F/Gs) that I had made at Seeed Studio.


The most frustrating part of this project was when I tried to package it up.  I used a small Sparkfun box as a case, and once I put everything inside the box I realized that the wires I was using from the PCB to the LED at the end of the servo arm were way too thick and there wasn't enough give.  The servo was straining really hard and not moving much, so I reduced the swing range to only a few degrees, but that still didn't fix it.  I had to cut out that wire and use the thinnest I could find, which was some wire I snipped off of a spare battery holder.  It works...but I may decide to start over with the whole enclosure (maybe use this as a chance to try out a laser cutting service) and use thinner wire yet so that it works more like I'd initially planned.


The picture here is a longer exposure, so its fuzzy because of the movement, but you get the idea of how it looks on the ceiling.  The source code is very simple, but it's available at https://sourceforge.net/projects/babystarlights/.  The project didn't turn out quite like I'd planned, but it's tons of fun to see my daughter staring at the lights and following them as they move around the room, and my wife even asked to help me solder it.  My camera wouldn't pick up the light on the ceiling, but here's a quick clip of the light in action.