Halloween is a "big deal" in our neighborhood and ever since we moved into our house my wife has wanted to display "spooky eyes" in our attic window. I finally got around to building a very simple Arduino sketch and circuit that I'm sharing in this Instructable.
To replicate my design you will need:
Step 1: Designing the Setup
One of my requirements was that I wanted the "eyes" to have a variety of effects, including on, off, blinking and the "breathing" effect you see when your laptop is in sleep mode. Most of these would be simple to accomplish with standard Arduino functions like delay(). For the breathing effect I found a great tutorial from Sean Voisen that uses a sinusoid wave function to control LED brightness. You can read it here: http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/.
My other requirements was that I wanted the Arduino to be located far away from the LEDs where i could access it easily if I wanted to reprogram it and add some new effects. Since the window was in the attic and only accessible by the access door in the master closet this mean a wire run of about 30 feet. I was considering using standard electrical or maybe speaker wire when I got Sparkfun's "new product" email in my inbox featuring their RJ11 connectors. I already had a box of telephone extension cables (remember when telephones had wires?) so this was just the ticket. I would connect the Arduino to the "eyeballs" using a long extension cable.
Step 2: Set Up the Hardware
The hardware build was super simple. I haven't included a schematic or Fritzing sketch figuring that if you know how to solder and program an Arduino then you can follow my written instructions and refer to the pictures.
The first step was to solder some lead wires on to each LED so I would have some length to play with when mounting them. You can see from the pictures I used some leftover luan plywood and just attached the breadboards using the adhesive backing. Not shown are the holes I drilled, roughly 6 inches apart, where I inserted the LEDs.
The next step was to assemble two RJ11 connectors, which involved soldering it to the breakout board along with 6 header pins. I then mounted an Arduino Nano (you can choose any Arduino version you want) on a mini breadboard and connected that breadboard to a second one where I mounted one completed RJ11 assembly. I connected the two innermost pins of the RJ11 to GND and then Arduino pins 10 and 11 to the RJ11 pins next to the ones connected to GND.
For the "receiving end" I mounted the second RJ11 assembly to a mini breadboard and then connected the LEDs, inserting a 100 Ohm resistor in between the positive lead on the RJ11 and LED itself. NOTE: in truth I did not pay much attention to how the RJ11 was wired and just used trial and error to get the circuit right.
Step 3: Program the Arduino and Test
Once the connections were made I connected the telephone cable, uploaded the attached sketch to the Arduino and tested the circuit. A few notes about the sketch:
- I threw it together pretty quickly so I'm sure it can be improved
- Each time through the loop() function a boolean variable is checked to see if one of the effects is currently running
- If no effect is running (which will be true the first time loop() executes) the code waits for short period and then selects a new effect at random
- Based on the effect chosen a select statement either calls a function or toggles the LEDs directly
Feel free to copy, modify and improve on the sketch.
Step 4: Install and Frighten!
Once I had tested the hardware on the workbench I scrambled up into the attic to mount it in our eyebrow window. I used the same luan strips to create a cross brace and tack-nailed it in place. (You can see the strips in the video and while these aren't really visible at night I may decide to paint them or cover them in fabric to disguise them a bit.)
I fed the telephone cable down into the bedroom closet and connected it to the Arduino. Now I can power the LEDs on and off without having to climb back into the attic.
Happy Halloween everyone!