# Trinket / Gemma Blinky Eyes

## Overview and Parts

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](http://makezine.com/projects/spooky-blinking-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.

![](https://cdn-learn.adafruit.com/assets/assets/000/011/821/medium800/trinket_IMG_2334.jpg?1382482504)

Info: 

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](http://en.wikipedia.org/wiki/Linear_feedback_shift_register "Link: http://en.wikipedia.org/wiki/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**

- **Adafruit&nbsp;[Gemma M0](https://www.adafruit.com/product/3501),&nbsp;[Trinket M0](https://www.adafruit.com/product/3500),&nbsp;**[**Trinket Mini**](http://www.adafruit.com/category/261)&nbsp;or&nbsp;[**Gemma v2**](http://www.adafruit.com/products/1222)&nbsp;microcontroller board (if Trinket, either the&nbsp;[3.3V](http://www.adafruit.com/products/1500)&nbsp;or&nbsp;[5V](http://www.adafruit.com/products/1501)type works). We recommend using the&nbsp;**[Trinket M0](https://www.adafruit.com/product/3500).**
- [Cadmium Sulfide Photocell](http://www.adafruit.com/product/161 "Link: http://www.adafruit.com/product/161")
- 2 LEDs (I used two [5 mm red](http://www.adafruit.com/products/297 "Link: http://www.adafruit.com/products/297") for the evil look, you can use any size or color)
- (1k) ohm resistor
- [Tiny Breadboard](https://www.adafruit.com/products/65 "Link: https://www.adafruit.com/products/65") (or other suitable wiring surface)
- [6 volt coin cell battery pack](http://www.adafruit.com/products/783 "Link: http://www.adafruit.com/products/783")
- 2 [CR2032 Batteries](https://www.adafruit.com/products/654 "Link: https://www.adafruit.com/products/654")
- A prop to put your circuit in

- [Next Page](https://learn.adafruit.com/trinket-gemma-blinky-eyes/wiring.md)

## Featured Products

### Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE

[Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE](https://www.adafruit.com/product/3500)
The&nbsp;Adafruit Trinket M0 may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip with _a lot_ of power. We wanted to design a microcontroller board that was small enough to fit into any project, and low...

In Stock
[Buy Now](https://www.adafruit.com/product/3500)
[Related Guides to the Product](https://learn.adafruit.com/products/3500/guides)
### Adafruit GEMMA M0 - Miniature wearable electronic platform

[Adafruit GEMMA M0 - Miniature wearable electronic platform](https://www.adafruit.com/product/3501)
The **Adafruit Gemma M0** is a super small microcontroller board, with just enough built-in to create many simple projects. It may look small and cute: round, about the size of a quarter, with friendly alligator-clip sew pads. But do not be fooled! The Gemma M0 is incredibly...

In Stock
[Buy Now](https://www.adafruit.com/product/3501)
[Related Guides to the Product](https://learn.adafruit.com/products/3501/guides)
### Adafruit Trinket - Mini Microcontroller - 3.3V Logic

[Adafruit Trinket - Mini Microcontroller - 3.3V Logic](https://www.adafruit.com/product/1500)
 **Deprecation Warning: The Trinket bit-bang USB technique it uses doesn't work as well as it did in 2014, many modern computers won't work well. So while we still carry the Trinket so that people can maintain some older projects, we no longer recommend it.** <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1500)
[Related Guides to the Product](https://learn.adafruit.com/products/1500/guides)
### Adafruit GEMMA v2 - Miniature wearable electronic platform

[Adafruit GEMMA v2 - Miniature wearable electronic platform](https://www.adafruit.com/product/1222)
 **Deprecation Warning: The Gemma bit-bang USB technique it uses doesn't work as well as it did in 2014, many modern computers won't work well. So while we still carry the Gemma so that people can maintain some older projects, we no longer recommend it.** <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1222)
[Related Guides to the Product](https://learn.adafruit.com/products/1222/guides)
### Tiny Premium Breadboard

[Tiny Premium Breadboard](https://www.adafruit.com/product/65)
This is a tiny little breadboard... half the size of a half-size breadboard!&nbsp;

**As of Sep 8, 2022** - This Tiny breadboard has been updated to make plugging and un-plugging boards and headers a buttery-smooth&nbsp;operation. Updated design also includes a metal...

Out of Stock
[Buy Now](https://www.adafruit.com/product/65)
[Related Guides to the Product](https://learn.adafruit.com/products/65/guides)
### Super Bright Red 5mm LED (25 pack)

[Super Bright Red 5mm LED (25 pack)](https://www.adafruit.com/product/297)
Need some really bright LEDs? We are big fans of these clear red LEDs, in fact we use them exclusively in our kits. They are very bright and have about 20degree LED beam. They go easily into a breadboard and will add that extra zing to your project.

- Pack of 25 clear red...

In Stock
[Buy Now](https://www.adafruit.com/product/297)
[Related Guides to the Product](https://learn.adafruit.com/products/297/guides)
### Photo cell (CdS photoresistor)

[Photo cell (CdS photoresistor)](https://www.adafruit.com/product/161)
CdS cells are little light sensors. As the squiggly face is exposed to more light, the resistance goes down. When it's light, the resistance is about ~1KΩ, when dark it goes up to ~10KΩ.

To use, connect one side of the photocell (either one, it's symmetric) to power...

In Stock
[Buy Now](https://www.adafruit.com/product/161)
[Related Guides to the Product](https://learn.adafruit.com/products/161/guides)
### 2 x CR2032 Coin Cell Battery Holder - 6V output - On/Off switch

[2 x CR2032 Coin Cell Battery Holder - 6V output - On/Off switch](https://www.adafruit.com/product/783)
This tiny coin cell battery holder is ideal for small portable or wearable projects. It holds two 20mm coin cells (2032 or CR2032 are the most popular size) in series to generate 6V nominal. (If you want only 3V, we suggest sticking a crumpled piece of tin foil in one of the slots.) 20mm coin...

In Stock
[Buy Now](https://www.adafruit.com/product/783)
[Related Guides to the Product](https://learn.adafruit.com/products/783/guides)

## Related Guides

- [Adafruit Trinket M0](https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino.md)
- [Using MPL3115A2 with CircuitPython](https://learn.adafruit.com/using-mpl3115a2-with-circuitpython.md)
- [How to Choose a Microcontroller](https://learn.adafruit.com/how-to-choose-a-microcontroller.md)
- [3D Printed LED Microphone Flag](https://learn.adafruit.com/3d-printed-led-microphone-flag.md)
- [Bandolier of Light](https://learn.adafruit.com/bandolier-of-light.md)
- [Using Servos With CircuitPython and Arduino](https://learn.adafruit.com/using-servos-with-circuitpython.md)
- [Porting an Arduino library to CircuitPython: VL6180X Distance Sensor](https://learn.adafruit.com/porting-an-arduino-library-to-circuitpython-vl6180x-distance-sensor.md)
- [Mystical LED Halloween Hood](https://learn.adafruit.com/mystical-led-halloween-hood.md)
- [NeoPixel NanoRing](https://learn.adafruit.com/neopixel-nanoring-gemma.md)
- [Esenciales para CircuitPython](https://learn.adafruit.com/esenciales-para-circuitpython.md)
- [Logan’s Run Hand Jewel LED](https://learn.adafruit.com/led-in-you-hand-logans-run-life-clock.md)
- [Trinket Bluetooth Alarm System](https://learn.adafruit.com/trinket-bluetooth-alarm-system.md)
- [Color-sensor Driven NeoPixel Dress](https://learn.adafruit.com/color-sensor-driven-neopixel-dress.md)
- [MakeCode Maker](https://learn.adafruit.com/makecode-maker.md)
- [FLORA and GEMMA ICSP](https://learn.adafruit.com/flora-and-gemma-isp.md)
- [Talking d20 20-Sided Gaming Die](https://learn.adafruit.com/talking-d20-20-sided-gaming-die.md)
