Project: Anniversary

It’s my and my girlfriend’s one-year anniversary is on February 25, 2008 and I want to make something special for her. The other night I was unable to sleep and I think I came up with an AWESOME idea. I want to make a heart-shaped lamp that can change colors. This lamp will be hooked up to my server via a serial connection. The server will constantly check for an e-mail from my cell phone. I can send the lamp a message when I am thinking about my girlfriend and the lamp with throb like a heart would. The kicker is that if I use an RGB LED I can have the lamp flash multiple colors for different things. For example, red can mean I am just thinking about her, purple can mean I miss her, etc.

I’m thinking I will have the lamp sit idle by default. It will constantly be listening on a serial connection for a “ping”, if you will, from the server. The server will check every minute for a new e-mail with different key words. The key words will just be colors in the subject line. If the server finds an e-mail with one of these key words it will send a message to the lamp to have it acknowledge that it is listening. The lamp will send the acknowledgment and wait for the server to send the new command. The server will then send the color codes as three separate binary integers. The server will also send a value from 1-10 representing the speed at which to pulse the lamp. Basically, the serial command would look like this:

RED GREEN BLUE SPEED
11111111,00000000,00000000,5 —-> This tells the lamp to turn red and pulse at half speed.

If the stamp receives the command correctly, it will tell the server and close the connection.  If not, it will tell the server and start listening for the command again.  Once the command is received successfully, the server will start keeping track of the time.  After five minutes it will start sending “pings” to the lamp to get its attention.  Once the lamp acknowledges the server, the server will send the STOP command to tell the lamp to stop throbbing.  This means that the lamp will only throb for five minutes after it receives my e-mail.

It all sounds oh-so-simple but I have a feeling it’s going to get complicated real fast.  I already have a good start on a perl script to check for e-mails thanks to another project.  I just need to modify it to not use any shell commands and to also start doing serial communication.

I figure the easiest way to get this done in time is to use a BS2 for now. I found this great reference on how to use pulse width modulation with a BS2 to control the brightness of an LED. The best part is there is already code on the site that makes the LED throb just the way I want it too. The pulse width modulation is essential for the throbbing effect, and also to get many more colors out of an RGB LED than just the initial seven.

I’ve already flashed the BS2 code to my stamp and it works perfectly. Unfortunately I don’t have any RGB LEDs to mess with the color changing effects right now, however even if I can’t make that work I should at least be able to get seven different colors from the LED which should be more than enough.

The next thing I am going to work on is serial communication from the BS2.  I am just going to keep the BS2 on the Board of Education for simplicity’s sake right now.  I hope to port this whole thing over to a different micro once I finally learn a new one.

Category(s): Electronics, Scripting, Update

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>

Powered by Sweet Captcha
Verify your real existence,
Drag the"E" to the "NEW!"
  • captcha
  • captcha
  • captcha
  • captcha