Fun with Flashing Lights 

 A hack and a social experiment all in one...

 or  "How to build a Morse code signaler and see how long it takes before someone figures it out."

Update

At 7:45PM on sunday evening, less than 24hours of operation later, two policemen (nice guys actually) knocked on my door while I was watching Scrubs.  Someone had reportedly seen the light and was concerned enough to call the cops.  I told them that everything was ok and they left without searching my apt for the kidnapped woman I keep ducktaped next to the wall socket.  Gotta teach her a  lesson, she's been trying to escape. 

In all seriousness, I find it heartwarming to know that someone out there was concerned enough to report it and that the cops where actually willing enough to investigate a flashing light.

Now I just need to set up some sillouetted stabbing scenes... that'll really freak that pervert vouyer out.

By the way, the message was "if you can read this, email me at notmyreal@email.address"  (it was my real email address but I'm not going to put that here)

Intro

Ok, so even though I've got way too much freelance work on my plate at the moment, when the idea for this struck, it distracted me to the point of one late night quick coding session. The code took about 30 minutes to put together. The PIC was programmed and the whole thing put together in about 3 hours.

Props

Right off the bat I need to say that without the help of dutchie (my buddie in tech) I wouldn't have known how to transform my blinking lights in Virtual Breadboard into a real life blinking light that's visible over a kilometer away. I'm thinking friggen laserbeams next!

Ok, Go!

For reference, the Wikipedia entry on Morse Code is a good place to start.  (All hail Wikipedia!)

If you're into code, you can download the full source code here. (It's the full Microchip MPLab folder with compiled .hex file for anyone who just wants to recreate this for themselves without modifying the code)

Probably the most challenging thing about Morse Code (and it really isn't that challenging) is the timing. I eventually decided on using a standard "dit delay" function that is really just a delay for n miliseconds... Once you've got that you just call it as many times as it's needed.  For example, a dah (or dash) is 3 dits long with a 3 dit gap in between etc.  The wiki entry has more on timings.

The Components:

  • 1 x Microchip PIC16F84A (pdf)
  • 1x 5v Power supply (Cell phone/Palm pilot chargers ahoy)
  • 2x LEDs (different colors)
  • 2x Resistors. (1k Ohm for the memclr pin and 330 ohm LED to ground)
  • 4MHz Crystal

If you want to make it switch a 220v lamp  (or 110v if you're living in one of "those" countries):

  • 1x Mosfet (BUZ901D) (This switches the solid state relay since the PIC couldn't handle the load)
  • 1x Solid State Relay (pdf) (Lets just say we were lucky to have one of these lying around)

Putting it all together

 It should be pretty obvious how to build this circuit, but essentially set up your PIC and connect the two LEDs to PortA0 and PortA1.  If all is well then when you power it up you should see PortA1 blink twice and then see something that resembles morse code blinking out on PortA0.

Once you've got that working you can either just leave it like that and astound your friends with your brilliant electronic genius or you could confound the entire friggen neighbourhood. I'm lucky enough to live in Cape Town, arguably one of the world's most beautiful cities in the world and I live in an apartment that is visible by probably a few thousand people.

 

The view from my apt 

 

The finished prototype

 

In its packaging (yes, it's a spindle)

 

Side view, everything is soldered onto the chip and just pressed into the foam

 

The fully clothed unit. The white flex is carrying 220v so we figured a closable box is a good idea

 

A view from across the road

 

A view from the mountain (click to view full size) I want to go and get this pic again with my tripod.

 

So what does it say?

That my friends is a secret... but I encourage all Cape Townians to have a go.  It is clearly visible from Tafelberg road, just to the left of Gardens Center.

Got Questions?

Besides asking me what it says, feel free to email me at arbitraryuser at gmail