Introduction: Super Spooky Evil LED Eyes of Doom Using AtTiny85 and Arduino IDE

There are a few spooky eye instructables out there. For example, there is one based on a 555 timer, one based on an on/off switch, one based on Arduino, and one based on tape.

I wanted to make a set of spooky evil eyes that met the following criteria:

1. Eyes that fade on and off (pwm)
2. Random duration of eye on and off times without using a pot or other input control to make the effect more realistic
3. Ultra low cost mcu so I can leave it in the decoration without having to re-program or re-insert the mcu.
4. Small controll/power box to make mounting easy

So here is how I did it, and I am pleased with the result.

At any point in this instructable, you will be able to make substitutions to fit your needs or materials on hand. If you like this, vote for it and if there are suggestions, I welcome all ideas to improve it.

Super Spooky Evil Eyes of Doom Using atTiny85 and Arduino IDE from vatosupreme on Vimeo.



Step 1: Spooky Materials and Tools Needed

Materials:

5 sticks or pieces of wood for the base of the eyeballs
10 ping pong balls - white 
High quality masking tape
Flat black spray paint 
10 Red super-bright LED's
1 atTiny85
Solderable perf board
Screw terminals
20 or 22 Guage Wire
Heat Shrink
Black Silicone
Gel Super Glue
Super Glue Accelerant ---- this stuff is just plain useful. Now you have an excuse to buy some
Vinyl electrical tape -Black
4AA Battery Holder
4 AA Batteries - rechargable if you don't want to use a resistor



Tools:

Razor Knife
Drill & Bit
Wire Strippers
Voltmeter
Staple Gun
Soldering Iron
Arduino
Breadboard & jumper wires
Needle Nose Pliers
3rd Hand

Step 2: Prepare Sticks

I found some scrap 5/8" OSB (oriented strand board) and cut 5 pieces that were about 3/4" wide, then I cut each piece to a different length between 4" and 8" so that the distance between the eyes would vary.

After cutting, you can spraypaint the sticks.  I sprayed them black to they will blend in earlier in the evening.  I guess you could do green or brown or something also.

***Alternative Build Idea***

You can use pretty much whatever material you want for this as long as it will be relatively weatherproof and allow you to staple into it ( attaching the eyeballs).

Step 3: Making the Spooky Eyballs Part 1 - Drill Hole for the Optic Nerve.

Take your drill and find a bit that is the same size as the LED's you will be using. 

Drill a hole in the "back" of the eyeball. 

Try to make sure that your hole is perpendicular to the plane of the seam in the ping pong ball so there isn't a line running through the lit part of your eyeball. 

Be patient as you drill, if you push too hard, when the material gives way, you can shove the drill bit through the other end of the ping pong ball and ruin it. ( Don't ask me how I know this, just trust me.) 

Safety Tip:  Don't drill while holding the ball in your palm, use something to hold the ball or hold it against some wood, otherwise you could end up creating a very scary zombie hand.

***Alternative Build Idea***
if you wanted a bigger size for the eye, you could use acrylic cutouts and side light them  or use some other bigger size ping pong balls. 

Step 4: Making the Spooky Eyballs Part 2 - Make a Spooky Mask - (get It?).

Now you need to design some spooky eye designs and transfer them to your masking tape.  You will use this to "mask" the spooky eye shape so that it will remain white while the rest of the eye is black allowing only your spooky eye shape to glow. 

I just free handed a few eyes that looked spooky: wolf, evil rodent, frog, cat, x girlfriend, etc.,  on the masking tape and used my razor knife to cut the shapes out.   You can search clip art for other ideas on shapes that you like.

Next I mounted the masks  on the ping pong balls.  Make sure that you put your mask directly in line with the hole you cut for the LED, otherwise the circle of light from the led may not line up correctly with your eye shape.

Make sure to use a plastic pen or credit card or something similar to push down the edges of the tape so paint doesn't crawl under your mask.

***Alternative Build Ideas** 
If you had one of those silhouette or other vector based cutter machines you could make perfectly symmetrical eyes and cut them out on a piece of sticky label.  I would still stick the label on the masking tape because it will keep paint off better.

I didn't do this because at 3 feet, in the dark, freehand looks pretty good.

Step 5: Paint the Evil Spooky Eyeballs

After masking your eyeballs, put on some latex free gloves and clean the ping pong balls with some denatured alcohol or Windex or something to get the grease off.

Take out the spray paint and give them 2 or 3 coats of flat black paint. 

Mount the eyeballs on sticks or something so you can paint the entire eyeball at once.  I painted the back half and then the front and it caused some hassles.

Let dry overnight.  DO NOT succumb to the temptation of handling the eyes until the next  day or you will get finger prints on them.

When they have dried, you can take your razor knife and peel away your masking tape.

Removal of the mask is a fun surprise where you will find out how good you are at masking.  If you had some problems with the paint creeping under the mask like I did, don't worry, just take a black Sharpie and clean up the lines.

Step 6: Solder the LEDs to Your Control Wires

I decided to hook up my LED's in series.  My LED's are 2 volt super bright.  LEDCALC said that I needed a 20 ohm resistor (which I did not use).

I clipped the legs off my LED's shorter so they would not get broken. (make sure when you are done the long leg stays longer or figure some way to denote the polarity.  (Don't use a marker!  it makes a big problem with the solder joint.)

Remember to put your heat shrink on your wires prior to soldering.

Solder the connections.

Test each pair of eyes to make sure they are working, if not check polarity of each LED and rework if necessary.

Slide the heat shrink over the connection and heat with a lighter.  do this with all 5 sets of wires.

Take some 220 grit or 500 grit sandpaper and sand the LED so that it diffuses the light.

****Alternate Build Idea****

You could use green or blue super bright LED's and wire them up in parallel (because in series they requre more voltage than the max allowable voltage on the atTiny85 which is 5.8v) and calculate the resistor needed.  I am not sure how much current the atTiny85 can handle in terms of how many LED's you could run on each pin but hopefully someone out there can enlighten us.

***Update***from what I have learned, the atTiny85 can handle 40mA per pin but a max of 200mA for the whole chip

Step 7: Mount LED's in Back of Eyes and Mount Eyes to Stick

Power your LED's and dry fit them in the back of the ping pong ball to check and make sure the glowing area is aligned with your masked spooky eye shape.  When you have the LED aligned how you like it, pull the LED out a little and apply some Gel super glue. 

The gel super glue is a total rip off but it works way better than even the viscous super glue and  I love it so.... whatever.

When you have the LED glued and positioned, hit it with the accelerant and you are ready to go on to the next eye.

After you have all the eyes glued, take ten 1" strips of vinyl electrical tape (black) and wrap around where the heat shrink is on the wire - LED junction.  This will help protect the wires from the crown of the staple rubbing against it. 


Now it is time to mount the eyeballs on the stick..

Take one eye and position it where you want it and use a staple gun to staple the wire to the stick.  Give your eyeball a little wiggle room for adjustment. 

Repeat with the other eye.

After that, I wrapped my wire pair around the stick and stapled them in place.  I did this to act as a strain relief in case the wire gets jerked hard by something. 

Next, I took some black silicone caulk and sealed up behind the eyes and over the electrical tape.  This helps keep the weather out and it keeps the light from the bottom and sides of the LEDs from showing. 

Finally, take some spray paint and hit the staples and wires to turn them black.





Step 8: Solder Up Control Board

I took a IC holder and soldered each of the pins to some screw terminals so that I could more easily attached the eye wires to the control board.

I also added a separate terminal for the battery pack to hook into.

***Battery Note: 
According to the datasheet the atTiny85 can handle 5.8 volts.  I don't really know if it can handle 6v so I used 4 rechargeable AA batteries at 1.2v each so I would be below the 5.8.  If anyone has info that verifies that we can use 4 normal AA at 6v I would like to know.  Alternatively you could use a voltage regulator and a 9v battery


****Battery Update***
calenso gave us a great suggestion in the comments, I wanted to list it here: "
If you want to run from regular AA's and still meet the max voltage, you can insert some regular silicon rectifier diodes (1N4000 series) in the power supply line. Each will drop the voltage 0.6 volts, so, with new AAs at 1.6X4 or 6.4 volts, two diodes would leave your project running at about 5.2 volts.



The second photo shows the back of the control board where I did the soldering.  I only had plain perf board; and since I am impatient and did not want to go and pick some up, I am paying the price through community ridicule of  this photo.   I would recommend solderable perf board for better results.

I hooked the ground from the Battery Pack  hookup terminal to pin 4 and continued that to the ground terminal for all the LED's.

I hooked the Positive screw terminal to pin 8

I then hooked the 5 terminals that control the eyes to pins 2,3,5,6,7  The pinout diagram shows the Arduino pin names. Since the sketch randomly lights up the LED's it doesn't matter the order you wire them.

**Update** Added a schematic so hopefully this will help a little.

Step 9: Connect Eye Wires to Control Board and Hang Up the Spooky Eyes.

I used a single ground screw for the eyes and put all those wires into that terminal.  There are 5 positive terminals soldered to the 5 output pins of the atTiny85.  I also added 2 more screw terminals for the battery holder.  I ended up putting a switch between the Positive terminal and pin 8 (+5v)  on the atTiny85 which has proven handy,

This method makes the board bigger, but I think it makes the whole thing more useable.

After making all the connections, put the control board in a container and you are ready to hang the eyes. 

When hanging the spooky eyes you can use zip ties, wire ties, black tape or whatever.  Try to hang the eyes where they won't get stepped on or tripped over.  I put mine in a tree, or a hedge or a garden bed. 


***Alternate Build Idea***

if you wanted the control box to be real small, you could go with cr2032 battery cells(and holder) and solder all the wires directly to the board




Step 10: Spooky Code & Programming the AtTiny85 (45) With the Arduino IDE

I will assume you are familiar with the Arduino to handle this project.

Using these atTiny chips was real fun and interesting to learn.

In order to program the atTiny85 there are some great resources out there so I won't repeat them. Here is how I learned how to work with the atTiny85

This tutorial helped a ton. It is from the Hig-low tech lab at mit. http://hlt.media.mit.edu/?p=1695

Another is this video tutorial on makezine http://www.youtube.com/watch?v=30rPt802n1k

My code for this project is a tweeked version of the code for this project. http://www.kobakant.at/DIY/?p=3393
Use the code found here for testing and troubleshooting your setup to make sure everything is working. I used this code after getting frustrated trying to locate a bad solder joint with the randomized code.

Changes I made to the code:
"randomize" the amount of time the lights fade on and stay on. the longer the time, the slower the fadeon is.
"randomize" the pin that turns on each time so that the pattern doesn't discernably repeat.
(see arduino.cc for discussion of limitations to the random() function.)

Here is the Code for the project. I attahced it as a txt as well

I am not an expert programmer, so if anyone has better/more efficient ways to accomplish this, let me know!


********UPDATE 11/10/2013***** This code is designed to run on the internal 8MHz clock so be sure and choose this option when you burn the bootloader and upload the sketch...
See this reference http://hlt.media.mit.edu/?p=1695

***************************************
//--scary lights pwm test v 2.0
//--This code is based on the work of:
/*
Ernst Christensen 16.okt. 2011, taken from >> http://arduino.cc/forum/index.php/topic,75334.0.html
Edited by Hannah March 2012 >> http://www.kobakant.at/DIY/?p=3393
Super Spooky Evil Eyes of Doom Revison by Matt Pearson September 2012 >>instructables.com
*/


int led[]={0,1,2,3,4};
int count=0;
int delayTime = 40;

void setup()//--set all pins to output
{
for (int x=0;x<5;x++){
pinMode(led[x],OUTPUT);
}
}

void spwm(int freq,int spin,int sp){
//--on
digitalWrite(spin,HIGH);
delayMicroseconds(sp*freq);

//--off
digitalWrite(spin,LOW);
delayMicroseconds(sp*(255-freq));
} //spwm




void loop()
{
delayTime= random(3,80);// Set values between 2 and 80 -- How long LED stays on
count= (random(0,5));

// Fading On--
for (int x=1;x<254;x++)
{
spwm(x,led[count],delayTime);
}

//--Fading Off
for(int x=254;x>1;x--)
{
spwm(x,led[count],4);
//--the last argument can be "delayTime" variable if you want to fade out same way as you faded on.
//--Setting it to 1 or 2 turns off lights real fast like the eyelid is closing
}
count= random(0,2);

delay(random(100,9000));//--- amount of time leds are OFF before next eye turns on 9 seconds is pretty long but makes it harder to locate the eyes


}

Make It Glow

Second Prize in the
Make It Glow

Halloween Decorations Contest

Participated in the
Halloween Decorations Contest