Typical festive Halloween activities include trick-or-treating, attending costume parties, decorating home exteriors, carving pumpkins into jack-o’-lanterns, lighting bonfires, apple bobbing, visiting haunted attractions, playing pranks, telling scary stories and of course, watching horror films. We at Atmel would like to add one more item to the Wikipedia list above: building Halloween-themed Maker projects like Bill Blumenthal’s Spooky Blinky Eyes.
According to Mike Barela, the original version of the project is built around an ATtiny45 MCU; however, Adafruit’s iteration employs the ATtiny85 based Trinket or GEMMA. Tasked with fading a pair of LED eyes that randomly blink, the Atmel powered platforms offer a more realistic effect than standard “always on” LED eyes.
“The effect is due to come clever programming of the timers available on the ATTiny processors featured on the Adafruit Trinket and GEMMA microcontrollers,” Barela explained in a recent Adafruit tutorial.
“Pins 0 and 1 are capable of pulse width modulation. The timers are set to fade the pins in and out by changing the pulse width back and forth. The blink effect is using an algorithm called a linear feedback shift register (LFSR) to pseudo-randomly turn the eyes off and on quickly.”
As Barela notes, Adafruit’s version of the Halloween Blinky Eyes project adapts the original code for use on the faster ATTiny85 processor and Arduino integrated development environment (IDE). It also adds a Cadmium Sulfide (CdS) photocell to allow the eyes to activate only below a certain light level, helping to save battery power.
Other key project components include:
- 3V Trinket (may be substituted by a GEMMA)
- Cadmium Sulfide Photocell
- Two LEDs 2 56 or 68 ohm resistors (100 ohm will work also but eyes will be a tad dimmer)
- 1-1000 (1k) ohm resistor
- Tiny Breadboard (or other suitable wiring surface)
- 6V coin cell battery pack
- Two CR2032 Batteries
- A prop to put your circuit in
“The circuit is fairly straightforward and can be assembled well within an hour. Headers (included with Trinket) may be soldered to facilitate attachment to a breadboard or proto board. Other parts may be pressed into the breadboard. Ready-made hookup wire or cut to fit wires make the connections,” Barela continued.
“The same circuit with GEMMA. The LEDs go to D0 and D1 with a 56 or 68 ohm resistor (100 ohms is fine also but they will be a bit dimmer). D1/A1 is hooked to the junction of the photocell and a 100 ohm (1K) resistor. If you wish to just rely on the power pack on/off switch, you can eliminate the photocell and 1K resistor. The battery pack works well with wearables, as it has a JST connector to plug directly into GEMMA, [along with] an on/off switch to save power when the circuit is not being used.”
Interested in learning more about the Halloween Blinky Eyes project above? Be sure to read Adafruit’s detailed tutorial here.