You have one day to make a halloween decoration! What will you do!? Well, if you have a Trinket and a couple of LEDs + a photo cell you can build these randomly blinky eyes that turn on when it gets dark

A recent MAKE project, Spooky Blinky Eyes by Bill Blumenthal, demonstrates an ATTiny45 processor fading a pair of LED eyes that randomly blink, giving a more realistic effect than standard "always on" LED eyes.
This guide was written for the Trinket Mini and Gemma v2 boards. It has been updated to also support the Trinket M0 and Gemma M0 using CircuitPython. We recommend the Trinket M0 or Gemma M0 as they are easier to use and are more compatible with modern computers!

The effect is due to come clever programming of the timers available on the ATTiny processors featured on the Adafruit Trinket and Gemma microcontrollers. 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.

This project adapts the original code for use on the faster ATTiny85 processor and for the Arduino integrated development environment (IDE). It also adds a Cadmium Sulfide (CdS) photocell to allow the eyes to come on only below a certain light level. During sunlight, this will save battery power.

Parts List

This guide was first published on Oct 30, 2013. It was last updated on Mar 18, 2024.

This page (Overview and Parts) was last updated on Mar 08, 2024.

Text editor powered by tinymce.