# Electronic Animated Eyes for ARM Microcontrollers

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/027/604/medium800thumb/light_big-eye-anim.jpg?1448320287)

Are you looking into&nbsp;these creepy animated eyes…or are they looking into&nbsp;you?

These peepers were inspired by&nbsp;a concept by David Boccabella (Marcwolf)&nbsp;on the [Stan Winston School of Character Arts forums](http://forums.stanwinstonschool.com). David is creating servo-driven animatronic eyes with&nbsp;a small OLED screen to simulate a dilating pupil.&nbsp;I'd chimed in with some suggestions and code to boost&nbsp;the refresh rate. Taking it to the next level here, we can&nbsp;render the _entire eye_…this makes the overall project simpler, as animatronics can be very fussy work (and the noise&nbsp;detracts from live&nbsp;performance).

**UPDATE: This project was originally designed with the [PJRC Teensy 3.1 or 3.2 microcontroller board](https://www.adafruit.com/product/2756) in mind. Since then, the code’s been expanded to support many Adafruit boards: most [Feather](https://www.adafruit.com/category/946) or ItsyBitsy boards with the “[M0](https://www.adafruit.com/product/3727)” or “[M4](https://www.adafruit.com/product/3800)” designation (_not_ AVR or 32u4 boards), plus&nbsp;[HalloWing M0](https://www.adafruit.com/product/3900), and [Circuit Playground Express](https://www.adafruit.com/product/3333) with the optional [TFT Gizmo](https://www.adafruit.com/product/4367). For the [HalloWing M4](https://www.adafruit.com/product/4300) and [MONSTER M4SK](https://www.adafruit.com/product/4343) boards, we have [a more evolved eye project](https://learn.adafruit.com/adafruit-monster-m4sk-eyes).**

**Most of the documentation and diagrams here proceed with the Teensy 3.2 in mind. With a pinout diagram for one of the above boards, it’s usually straightforward to adapt.**

![](https://cdn-learn.adafruit.com/assets/assets/000/027/605/medium800/light_dragoneyes.jpg?1441516383)

 **This is a “choose your own adventure” project.** There&nbsp;are&nbsp;many ways to build it…this guide is not really aiming toward any particular finished _thing._ It’s the start of a recipe, but where it goes is up to your imagination…

- Spooky&nbsp;eyes in the window for Halloween
- An amazing costume for Dragon\*Con
- A single eye worn in a pendant or a bracer, or in the headpiece of a staff
- World’s creepiest taxidermy

Read through to see what parts are involved for different configurations.

 **Parts from Adafruit:**

- **PJRC [Teensy 3.2 microcontroller](https://www.adafruit.com/product/2756)**&nbsp;(one board will control 1 or 2 eyes); Teensy 3.1 will also work. **(As noted above, many Adafruit M0 and M4 boards can also be made to work.)**
- Display(s) - **one per eye** : either **[1.5" OLED](https://www.adafruit.com/product/1431)**&nbsp;or **[1.44" TFT](https://www.adafruit.com/product/2088)**. OLED looks _amazing_&nbsp;but costs more. TFT is affordable but colors are less intense. Tradeoffs!

**Additional parts and tools:**

- Soldering iron and paraphernalia
- 28 gauge ribbon cable
- Optional: 1.5" Acrylic cabochons (half-spheres)
- Optional: 3D printer to make enclosures, held&nbsp;with #2-56 screws and nuts
- Optional: LiPoly Backpack and battery (500mAh for OLED, 150mAh for TFT)

**The following components&nbsp;are OPTIONAL. Our&nbsp;software&nbsp;can handle all of these effects autonomously, but you can optionally add any or all of these parts to enable manual control:**

- Analog joystick for movement
- Button(s) for eye blinks or winks
- Photocell makes pupils&nbsp;react to light

If using a PJRC Teensy board, this project _requires_ the Teensy 3.2 (or 3.1) microcontroller (or one of the aforementioned Adafruit boards). _Not_ the Teensy 2, 3.0, LC, nor any other Arduino-like board, period. **It relies on features unique to ARM microcontrollers.**

This project involves detailed&nbsp;soldering around costly parts; **read through before deciding if this guide is for you**. Newcomers to electronics might start&nbsp;with the [Animating Multiple LED Backpacks](../../../animating-multiple-led-backpacks)&nbsp;guide — it achieves a similar effect with easier, more affordable&nbsp;components!

# Electronic Animated Eyes for ARM Microcontrollers

## 3D Printing

This project doesn’t necessarily _require_ 3D printing. Depending what you’re making, it may be sufficient to mount the display breakout boards on something as-is.

These little 3D-printed enclosures are _useful_ for holding domed lenses over the displays. And&nbsp;they’re absolutely **_essential_ if creating something wearable.** &nbsp;The ambient humidity in a costume will _kill_ exposed circuit boards in no time!

We’ll start with the 3D printing&nbsp;because it&nbsp;affords the opportunity to **test-fit** these parts before buying the electronics, to check whether they’ll even&nbsp;work&nbsp;in the spot&nbsp;you have planned. They add some bulk behind the eyes and the whole idea may be a bust.

# Lenses and Hardware
1.5 inch (38mm) cabochons (domes) magnify the screens slightly and give the eyes a cool 3D shape. I found mine at&nbsp;[Tap Plastics](http://www.tapplastics.com/product/plastics/plastic_rods_tubes_shapes/acrylic_cabochons/139), but&nbsp;any good plastics supplier should have these…or there’s eBay or Etsy. For good magnification and for the cases to hold them properly, the lenses&nbsp;you use should have a high dome to them…a full half-sphere.

![light_cabochons.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/601/medium640/light_cabochons.jpg?1441475500)

_Each enclosure_ requires&nbsp;_four_&nbsp;(4) #2-56 flat-head machine screws, 3/8" long, plus matching nuts.

This is another “probably easier to find online” part, unless you’re blessed with a well-stocked local hardware store.

![light_screws.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/606/medium640/light_screws.jpg?1441516830)

# 3D Printables

The enclosure&nbsp;pieces&nbsp;are small and will fit even on compact&nbsp;entry-level printers.

[Click to download 3D-printable enclosures](http://www.thingiverse.com/thing:1002413/zip)
There are separate versions of the enclosure for OLED vs TFT LCD…the mounting holes and cutouts are slightly different. There’s a top and bottom piece for each: for example, “LCD Top.stl” and “LCD Bottom.stl.”

I found it best to print each part as a separate job (rather than tiling all the parts on the printer bed) — less oozing / strings means less post-print cleanup — but every printer is different and maybe yours fares better in this regard.

**Some filaments such as ABS are known to shrink slightly (about 2%). You may need to scale the .STL files very slightly larger before printing. DO NOT&nbsp;force parts into a too-small case…THEY WILL BREAK.**

File or sand away any major protruberances. If you rinse off the parts afterward, make sure they’re _completely_ dry before&nbsp;assembly, maybe leave them on a fan for a couple hours for good measure.

There’s a lot of variation among cabochons (lenses) from different sources, and even different batches from the same source. So it’s possible they&nbsp;won’t fit perfectly on the first try…

The ideal goal is for the lens to _just_ fit in the case front, with the back faces flush.&nbsp;Too snug and the lens will press against the screen (possibly cracking it), too loose and it will simply fall through.

**If a little too snug:** use sandpaper around the opening to make it just a little wider, and try again.

**If too loose:** if it falls through but is&nbsp;a _close_ fit, that may be good enough…we’ll glue the lens and case later.

![light_perfect-fit.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/611/medium640/light_perfect-fit.jpg?1441647464)

If it’s _really_ loose or snug, you may need to tweak the geometry&nbsp;to fit your specific cabochons. A CAD model&nbsp;for Autodesk 123D is included with the files. Use the “Press/Pull” feature to tweak this ring…positive values for a tighter fit, negative for looser…try just a fraction of a millimeter at a time. Export as STL and try again.

![light_pullpress.png](https://cdn-learn.adafruit.com/assets/assets/000/027/612/medium640/light_pullpress.png?1441648029)

# **Assembly**

**Assembling the screens requires that the electronics be completed first.** &nbsp;But since the 3D printing doesn’t apply to everyone, it’s all kept on this page rather than throughout the guide.&nbsp;Therefore, **go ahead and work on the electronic assembly** starting on the next page, and **return here** when you’re ready to assemble the enclosures.

Danger: 

For each eye, you should have **four** major parts: a top and bottom case, a lens, and the display with ribbon cable attached. (Plus the aforementioned screws and nuts, not shown here.)

**Peel off the plastic screen protector** if you haven’t done this already.

![light_caseparts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/610/medium640/light_caseparts.jpg?1441647024)

The display and front piece fit together a certain way — it’s not symmetrical. A little notch provides some clearance for solder connections that tend to protrude from the front of the board (with the wires on the back).

**The solder connections should be at this end of the case. NOT&nbsp;the thin plastic ribbon cable to the screen.**

![light_soldernotch.png](https://cdn-learn.adafruit.com/assets/assets/000/027/613/medium640/light_soldernotch.png?1441649145)

 **I don’t have a 3D-printed case design for the Teensy yet.** &nbsp;If this is going inside a costume, you’ll need&nbsp;one, to keep out moisture.

If you’re handy with 3D CAD, it&nbsp;shouldn’t be too hard…a rectangle with some cutouts for wires.&nbsp;Otherwise, you can just get creative with a small plastic box (like some mints or breath strips come in) and hot glue.&nbsp;No rocket science required.

Danger: 

Ideally, this is how the front will go together. Board sits flush in case, dome sits flush against display…doesn’t press hard against it and doesn’t fall out.

As mentioned earlier, if it’s too tight you can sand the opening, if too loose the dome can be glued later.

![light_install-front.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/614/medium640/light_install-front.jpg?1441650008)

A small notch on the back of the display provides clearance for the ribbon cable. (It’s slightly off-center on the OLED case, this is on purpose.) File as necessary if it doesn’t quite fit.

![light_backnotch.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/615/medium640/light_backnotch.jpg?1441650565)

Fit&nbsp;four #2-56 nuts to the notches in the front of the case.

The notches may have some detritus from 3D printing…clean these out with tweezers or a file.

![light_nuts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/616/medium640/light_nuts.jpg?1441650877)

Add four #2-56 x 3/8" flat-head machine screws from the back, and tighten carefully.

If the case puts up resistance to closing, **STOP.&nbsp;** Something inside isn’t fitting right. Open the case and look for any plastic that needs filing down, or wires not sitting flat.

**The display is made of glass and will break if forced.**

![light_backscrews.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/617/medium640/light_backscrews.jpg?1441651077)

# Gluing the Lens

If the lens is loose, it needs to be glued in place. Even if it’s a good fit, gluing is a good idea for added durability! But choose wisely…

Hot glue is too clumsy and random; we need **fine control**. Other glues are too runny…they’ll **seep into the gap and ruin the screen**. Some react badly with acrylic and will make the cabochon hazy. (Cyanoacrylate glue is both too runny _and_ causes haze…do not use it for this!)

Danger: 

Don’t laugh… **t-shirt puff paint** actually makes a decent adhesive and sealant for this project! The applicator tip lets you draw a fine&nbsp;bead where the case and lens meet. Just like caulking a bathtub!&nbsp;Allow several hours to a full day&nbsp;to dry completely.

You could&nbsp;also use this to draw a gasket between the two case pieces before closing it up, and add a bead around the&nbsp;hole where the wires enter. Obviously, you should test all the electronics 100% first before committing&nbsp;to this step.

For a more _industrial_ bond, these same steps&nbsp;can be done (_very carefully_) with a toothpick dipped in **epoxy** or **E6000** craft glue.

**DO NOT USE CYANOACRYLATE (“KRAZY”) GLUE.**

![light_puffpaint.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/603/medium640/light_puffpaint.jpg?1441497163)

The enclosures can now be installed into something else (e.g. taxidermy dinosaur head) with your adhesive of preference…hot glue, E6000, etc. and will link up with the Teensy board as described on the “Wiring” page.

# Electronic Animated Eyes for ARM Microcontrollers

## Wiring

![](https://cdn-learn.adafruit.com/assets/assets/000/027/581/medium800/light_think.jpg?1441398430)

Before diving in, give some thought to how you’ll be using this.

At the very least, this project uses a Teensy microcontroller and a display or two. The animation effects are all capable of running **autonomously** if need be, or there are options to have them **manually controlled**. The **method of assembly** is also open to interpretation.

If you’re making&nbsp;a spooky prop&nbsp;to sit in the window on Halloween, but plan to **disassemble** it afterward and use the parts in other projects, you can use a **breadboard** and **jumper wires** for quick assembly and re-use.

For something **portable** , like jewelry or a costume piece, **soldering** wires directly between components is&nbsp;vital — both for space savings and for durability.

If creating eyes for a puppet, you probably want _manual controls_ for nearly everything, as that’s&nbsp;the&nbsp;very _nature_ of puppetry.

For a costume, I&nbsp;think&nbsp;_autonomous_ works&nbsp;better. Good cosplay is all body language…but when electronics are added, fantastic&nbsp;characters are spoiled&nbsp;when the performer is focused&nbsp;on&nbsp;modes and buttons. But hey, it’s up to **you.**

Give it some thought. I’ll wait!

 **Half and half:** &nbsp;these eyes are neatly assembled&nbsp;in 3D-printed enclosures while the rest of the circuit is a messy breadboard. Once everything’s tested and working, the breadboard side will be replaced with a more permanent solution and fitted inside a Halloween prop. Whatever works for your needs!

![light_half-and-half.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/588/medium640/light_half-and-half.jpg?1441419832)

# Connections

Many configurations of this project are possible, depending on the features you’re after. Rather than a single complex wiring diagram, a few subassemblies are illustrated here…pick and choose to match your needs.

What’s shown here&nbsp;are _schematic_ diagrams — they indicate&nbsp;_where_ to connect wires, but **not necessarily their exact actual layout&nbsp;or lengths** when you build the thing.&nbsp;You’ll need to think how everything fits in your own setting. Using color-coded wires helps a _lot_ here!

We’ll be referring to several&nbsp;pins by name or number, so here’s a&nbsp;pin map for the Teensy 3.1&nbsp;or&nbsp;3.2 microcontroller:

![](https://cdn-learn.adafruit.com/assets/assets/000/028/038/medium800/light_Teensy-Pins.jpg?1444545187)

This is a simplified pinout to clarify things specifically for this guide. If you plan to add your own&nbsp;advanced bells and whistles, [a more complete&nbsp;pinout map is available&nbsp;on the PJRC web site](https://www.pjrc.com/teensy/pinout.html).

Ground connections are vital for distributing power throughout the circuit. In addition to the two GND pins labeled here, there are two copper pads on the back of the board — one near the center, and a second large one near the USB port (next to the GND pin).

The **AGND** pin provides a cleaner ground reference specifically for **analog inputs** — this is _not_ a current-carrying pin for distributing power, do not connect&nbsp;the displays here.

Some of the pin numbers we’ll be referencing are negotiable…if you find that a different pin would make routing wires easier, there’s usually a setting in the code that can be made for it. **Anything related to power or SPI is not negotiable…those wires _must_ go to the pins stated.**

# Power

If you have an opportunity to power everything from the Teensy’s USB port (running a USB cable to a power bank or wall charger), that’s easiest and reduces parts and steps.

The most compact, portable installations may optionally want a built-in Lithium-Polymer (LiPoly) battery. If your project uses **one or two TFT LCDs** , a **150 mAh** battery may suffice (though a larger capacity will provide a longer run time). For **one or two OLEDs** , a **500 mAh** battery is the minimum size.

![](https://cdn-learn.adafruit.com/assets/assets/000/028/069/medium800thumb/light_eyeball-bowler-hat-09.jpg?1448322618)

To use the Teensy board with the Adafruit LiPoly Backpack (allowing USB charging), first **two copper traces need to be cut:** between the two pads next to the Teensy’s VUSB pin, and between the switch pads on the LiPoly Backpack (marked on back). Then add these **three wires** between the boards:

- LiPoly **BAT** to Teensy **VIN/BAT+&nbsp;** (unmarked pin at corner)
- LiPoly **G** to Teensy **GND**
- LiPoly **5V** to Teensy **USB+** pin&nbsp;

Add **power switch** to pins on LiPoly backpack. [These tactile on/off switches](https://www.adafruit.com/products/1092)&nbsp;are my favorite!

If battery capacity is **500 mAh or larger** , solder between the charge rate jumpers on the back of LiPoly backpack. **Do not&nbsp;do this with small batteries!**

![light_BatteryMod.jpg](https://cdn-learn.adafruit.com/assets/assets/000/028/039/medium640/light_BatteryMod.jpg?1444545515)

![light_eyeball-bowler-hat-02.jpg](https://cdn-learn.adafruit.com/assets/assets/000/028/068/medium640/light_eyeball-bowler-hat-02.jpg?1444771644)

![light_eyeball-bowler-hat-04.jpg](https://cdn-learn.adafruit.com/assets/assets/000/028/070/medium640/light_eyeball-bowler-hat-04.jpg?1444771754)

When you cut the trace on the Teensy board, it won’t run from USB power until the LiPoly backpack is connected and switched on. This is normal. If a sketch won’t upload on a half-built project, this may be the reason why.

![](https://cdn-learn.adafruit.com/assets/assets/000/028/061/medium800/light_eyeball-bowler-hat-01.jpg?1444762727)

**Power the display(s) from the BAT+ (corner) pin.** If you're not&nbsp;using the LiPoly backpack (powering off a USB cable instead), that’s okay — by default this pin also connects to USB+.

# Displays

You have a choice of using one or two displays, either OLED or LCD. But you can’t mix one of each — both must be the same type.

**OLED** displays have brighter&nbsp;colors and contrast. Downside&nbsp;is&nbsp;the price, and also that they flicker a little when captured on video. They also have a finite lifespan, albeit _many thousands_ of hours.

**TFT LCD** displays are more affordable. Not as&nbsp;bright, but still a good effect. And they’re rock-steady on video.

**If making two eyes, both displays need to connect to the same&nbsp;SPI&nbsp;MOSI and CLK&nbsp;pins** &nbsp;on the Teensy, plus a few&nbsp;other wires. The “OC” or “TCS” pins are unique to each display, left or right.

For **OLED** displays, make the following connections from the display breakout board to the Teensy:

- **SI** to **SPI MOSI**
- **CL** to **SPI CLK**
- **DC** to Digital **Pin 7**
- **R** to Digital **Pin&nbsp;8**
- **OC** to Digital **Pin 9** (left eye) or **10** (right eye)
- **+** to **BAT+** (if using LiPoly Backpack) or **USB+**
- **G** to **GND**

The remaining four pins are not connected.

![light_display-wiring-oled.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/582/medium640/light_display-wiring-oled.jpg?1441400206)

For **TFT LCD** displays, use these connections:

- **Vin** to **BAT+** (if LiPoly) or **USB+**
- **Gnd** to **GND**
- **SCK** to **SPI CLK**
- **SI** to **SPI MOSI**
- **TCS** to Digital **Pin 9** (left eye) or **10** (right)
- **RST** to Digital **Pin 8**
- **D/C** to Digital **Pin 7**

![light_display-wiring-tft.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/583/medium640/light_display-wiring-tft.jpg?1441400223)

“Left” and “right” eye in this case refer to the positions when looking _at_ the eyes, not from their point of view. This nomenclature is used throughout this guide and in the software.

If you’re using them, the 3D-printed enclosures have a small notch that’s _just_ wide enough for a 7-conductor ribbon cable to fit through. Space inside is _really_ tight (I wanted them to fit inside a mask), so it’s necessary to route these wires to their pins _very_ carefully so they lie as flat as possible&nbsp;on the back of the board, not all piled up. It’s delicate work that requires tweezers and patience.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/589/medium800/light_legend.jpg?1441420662)

If using a ribbon cable as shown above, **write down your own legend that maps wire colors (or wire _numbers_&nbsp;if single-colored cable) to pin functions.**

Because the cable&nbsp;colors are in a fixed&nbsp;order and there’s&nbsp;little space to reroute inside the case,&nbsp;certain wiring conventions used in electronics (such as using red wire for positive voltage and black for ground) no longer apply…you’re forced to take what you’re given. What’s more, with wires doubled back, the conductors along the ribbon don’t necessarily match the order along the display breakout header, it’s all jumbled now.

_Do not_ use our photos&nbsp;for reference. _Do not_ rely on&nbsp;the colors shown in any diagrams here. **Write down the _exact_ sequence for _your_&nbsp;cable and _your_ routing, and use _only_ that for reference, nothing else.**

Danger: 

The wiring for the TFT was even more “creative,” with some wires a straight shot and others doubled back. Again, notice the wiring legend. Do what works for you.

![light_tft-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/607/medium640/light_tft-wires.jpg?1441562656)

 **If you’re not using the 3D-printed enclosures, everything is much simpler.** You can just connect to the pins in-order, there’s no space constraint that must be met.

Wanting&nbsp;to test with a breadboard first, I made the ribbon cables extra long (about 8 inches) and soldered row pin headers on&nbsp;the end.

Later, for permanent installation, I'll cut the ribbon cables down to size and solder wires directly to the Teensy board.

This is totally optional…maybe you only&nbsp;want to build it once. Just try to **keep the wire lengths to a minimum** …high-speed SPI can be very finicky about this. Even 8 inches is pushing it.

![light_breadboard-plug.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/608/medium640/light_breadboard-plug.jpg?1441563029)

The displays arrive with a plastic sheet on them. Keep this in place when soldering, but remove it once you’re done. This isn’t&nbsp;like a phone screen protector, just for shipping and soldering protection.

The display breakout boards include microSD slots, but those are not&nbsp;wired up in this project and the code doesn’t reference them at all.&nbsp;Advanced users who want this capability can connect&nbsp;the SPI MISO&nbsp;and card select pins (you’ll need to modify the enclosure slightly to accommodate the extra wires) and make the required changes in the code.

# Analog Controls

Any **analog** controls that are used should include connections to the **3.3V** and **AGND** pins. Don’t use the other power pins or there will be…trouble.

 **XOUT** and **YOUT** from a joystick can connect to Analog Pins **A0** and **A1**.

**The eyes move autonomously by default** — settings in the code enable the joystick instead.

If you need to mount the joystick in a different orientation, there are also settings to invert each axis. Swap&nbsp;the X and Y pins in the code to use the joystick sideways.

![light_control-stick.png](https://cdn-learn.adafruit.com/assets/assets/000/027/584/medium640/light_control-stick.png?1441405698)

To have the pupils contract or expand in response to light, connect a photocell and 10K resistor in series. The midpoint connects to Analog Pin **A2**.

Analog input for the pupils (either photocell or the dial below) are enabled in the code by default. You can comment out IRIS\_PIN in the code to have this move autonomously.

![light_control-photocell.png](https://cdn-learn.adafruit.com/assets/assets/000/027/585/medium640/light_control-photocell.png?1441405727)

For manual control of pupil dilation (instead of responding to light) a 10K potentiometer can be used. The center leg connects to Analog Pin **A2** (same input as the photocell, just substituting&nbsp;a different analog control).

![light_control-pot.png](https://cdn-learn.adafruit.com/assets/assets/000/027/586/medium640/light_control-pot.png?1441405783)

# Buttons

The eyes normally blink autonomously, but you can also add one or more buttons to make them blink (or even wink individually) on command.

For all buttons, connect one leg of each to **GND** , and the opposite leg to a digital pin:

- Digital **Pin 0** is the **left** eye wink.
- Digital **Pin 1** blinks **both** eyes.
- Digital **Pin 2** winks the **right** eye.

If using our analog joystick breakout board, that stick includes&nbsp;a clicky button when you press down on it (on the SEL pin). This can optionally be used for manual blink control, or you can use a separate button for this (I find the joystick button a bit hamfisted).

![light_control-buttons.png](https://cdn-learn.adafruit.com/assets/assets/000/027/587/medium640/light_control-buttons.png?1441405812)

 **Pro tip:** &nbsp;a fully-equipped version of the circuit requires several ground connections, but there are only a few GND pins on the Teensy board. Two- or three-way splices are one&nbsp;option, but another way to provide extra ground connections&nbsp;is to repurpose unused I/O pins. Let’s suppose you want to make Digital Pin 4 a spare ground pin. Add the following code in the setup() function:

```
pinMode(4, OUTPUT);
digitalWrite(4, LOW);
```

OUTPUT LOW makes the pin function as an ersatz ground connection.&nbsp;This works perfectly&nbsp;for button connections like the blink controls, but don’t use it&nbsp;for heavy loads (like powering the displays) —&nbsp;it won’t work and might even damage the Teensy.

# Next Steps…

After wiring everything up, proceed to the next page and test out the software.

Once it’s all tested and working…if using the 3D-printed enclosures, return to that page to&nbsp;complete the assembly. Otherwise, you’re on your own now, to install the electronics in your own finished design.

# Electronic Animated Eyes for ARM Microcontrollers

## Software

Before diving too deep&nbsp;into the software, there are **some gotchas** to be aware of…

- **Do not** install the Adafruit\_GFX, Adafruit\_SSD1351 or Adafruit\_ST7735 libraries offered by the Teensyduino installer! **Use the Arduino Library Manager** or **install these manually** from Github code. The Teensyduino-installed libraries sometimes diverge from the latest Adafruit code and might&nbsp;prevent this project from compiling.
- When first building this project, please test initially with&nbsp;the canonical “Uncanny Eyes” sketch linked later in this guide, not anyone’s derivative code. This will help with any troubleshooting/support. Once the default code works, _then_ you can try out variants that may be out there.

Teensy uses the Arduino environment for programming, so it’s pretty familiar and simple to work with, but it does require a little extra setup first…

If you’re not using a recent version of the Arduino IDE (1.6.5 or newer), this would be a [good time to upgrade](https://www.arduino.cc/en/Main/Software). Once you have that software installed and working, download and run the [Teensyduino installer](https://www.pjrc.com/teensy/teensyduino.html), which adds support for the full line of Teensy microcontroller boards in the Arduino IDE (but remember, _don’t_ install the display/graphics libraries there…use the Arduino Library Manager instead).

From the **Tools** menu, select **Board→Teensy 3.2** and **CPU Speed→72 MHz** (and whatever optimization settings you’d like) **.** Confirm that you can compile and upload the classic “blink” sketch to the Teensy board. Don’t use the 96 MHz setting; the code actually performs a bit better at 72 MHz (due to SPI settings).

Danger: 

Using the Arduino Library Manager ( **Sketch→Include Library→Library Manager…** ) install **Adafruit\_GFX** , **Adafruit\_BusIO** &nbsp;and **Adafruit\_ZeroDMA** , plus the library compatible with your display: **Adafruit\_SSD1351** &nbsp;for the **OLED** display, **Adafruit\_ST7735** &nbsp;for **TFT LCD**.

(If you’re still using an oldschool version of the Arduino IDE, these libraries can be fetched from Github: [Adafruit\_GFX](https://github.com/adafruit/Adafruit-GFX-Library), [Adafruit\_BusIO](https://github.com/adafruit/Adafruit_BusIO),&nbsp;[Adafruit\_SSD1351](https://github.com/adafruit/Adafruit-SSD1351-library), [Adafruit\_ST7735](https://github.com/adafruit/Adafruit-ST7735-Library)and installed manually.)

Finally, there’s the sketch code itself:

[Download “Uncanny Eyes” Arduino code](https://github.com/adafruit/Uncanny_Eyes/archive/master.zip)
The sketch is utterly _ginormous._ In addition to several hundred lines of code in the main sketch, arrays containing graphics take up most of the space in the microcontroller’s flash program space.

Before uploading to the board, check&nbsp;lines 56 and 57 in the file **config.h** :

```
  #include &lt;Adafruit_SSD1351.h&gt;  // OLED display library -OR-
  //#include &lt;Adafruit_ST7735.h&gt; // TFT display library (enable one only)
```

One line is enabled, the other is commented out. By default, OLED is used. Comment out the opposite line&nbsp;if using TFTs.

If using all the same wiring as the previous page,&nbsp;it should be possible to compile and upload to the board and see some results…you should at least see an eye doing _something._ (If you changed the wiring, skip ahead to the next section below to make the code match, then return&nbsp;here.)

### 

Either Teensy support has not been correctly installed with the Teensyduino installer, or one or more of the libraries is not installed (Adafruit\_GFX, Adafruit\_SSD1351 or Adafruit\_ST7735). **Please see the notes at the top of this page regarding IDE & library compatibility.**

### 

Check the connections between the display and Teensy board.

- Did you enable the correct #include line&nbsp;for the display type (OLED vs TFT)?
- Are you following the correct order-of-wires&nbsp;for the display type (OLED vs TFT)?
- Are any wires off-by-one on the Teensy?
- Any cold solder joints, or solder bridges between pads?

### 

- Keep your wires as short and as tidy&nbsp;as possible,&nbsp;check solder connections for good form. High speed SPI is _really_ persnickety about connections.
- Is the right CPU speed selected?

Still having trouble? Start a new thread in the&nbsp;[Adafruit forums](http://forums.adafruit.com)&nbsp;describing the symptoms. It’s extremely helpful if you can provide in-focus and well-lit photos that clearly show all the connections between the display and Teensy.

Danger: 

# Changing Appearance, Wiring and Inputs

Basic customization — enabling or disabling certain features, or changing pins assigned to functions — is done by editing the file **config.h** (it’s the second tab when the code is open in the Arduino IDE).

First section of this file controls the appearance of things.

The software includes a few ready-made eyes that can be used by simply enabling the corresponding #include line — remove the comment (//) at the start of that line, and **make sure all the others are commented out**. The stock sketch has “defaultEye” enabled:

![](https://cdn-learn.adafruit.com/assets/assets/000/057/816/medium800/light_eye-selection.png?1532055916)

 **defaultEye.h** is human-ish in design. Okay, so the iris is anime-sized, but I’m so proud of that iris-scaling code I _had_ to show it off as much as possible.

![light_eye-default.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/592/medium640/light_eye-default.jpg?1441428039)

Some animals have such huge irises you rarely see the sclera (the white part of the eye). **noSclera.h** is an example eye for these situations.

![light_eye-nosclera.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/593/medium640/light_eye-nosclera.jpg?1441428053)

 **dragonEye.h** because _dragons._ It’s a _moral imperative._

![light_eye-dragon.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/594/medium640/light_eye-dragon.jpg?1441428070)

Goats (or is it [Krampus](https://blog.adafruit.com/2014/12/25/he-sees-you-when-youre-sleeping-and-gives-you-nightmares-krampus-nytimes/)?) have the _weirdest_ pupils. **goatEye.h** is an attempt at simulating this. I designed this one to _not_ move around, just&nbsp;to demonstrate how its done (the sclera image is the same size as the screen…no room to move…normally the sclera image is a bit larger).

![light_eye-krampus.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/595/medium640/light_eye-krampus.jpg?1441428087)

Just above the eye selection is this line, disabled by default:

```
  //#define SYMMETRICAL_EYELID
```

Normally the software renders the two eyes with distinct left and right shapes (there’s a _caruncle_ — that corner area near the tear duct). Some projects only use a single eye and this shape just seems odd. Enabling SYMMETRICAL\_EYELID uses a simpler “football shape” that’s neither left nor right…it’s a bit cartoonish but may look better on single-eyed creatures.

A little further down is a list indicating the pins used for each eye. The software can handle any number of eyes (it splits up time between them), but will usually be two (or, if compiling this for the [Hallowing](https://www.adafruit.com/product/3900) board, there’s just one):

```
eyeInfo_t eyeInfo[] = {
#ifdef ADAFRUIT_HALLOWING
  { 39, -1, 2 }, // SINGLE EYE display-select and wink pins, rotate 180
#else
  {  9, 0, 0 }, // LEFT EYE display-select and wink pins, no rotation
  { 10, 2, 0 }, // RIGHT EYE display-select and wink pins, no rotation
#endif
};
```

Each line contains **three items** : the pin that’s connected to the corresponding display’s OC (OLED chip select) or TCS (TFT chip select) pin, and another pin where a button (connected to ground) makes that eye independently wink. If you don’t want or need this wink control, the second pin value can be set to -1. Third item on each line is a **rotation** setting (0–3) for that screen:

- 0 is the default orientation, with the display’s connector at the top.
- 1 rotates the graphics 90 degrees clockwise (compensating for a display that’s installed 90° counterclockwise, with the connector at the left).
- 2 rotates the display 180° (as on the Hallowing board).
- 3 rotates 90 degrees counterclockwise (compensating for a display with the connector at right).

The stock code, as shown above, has two eyes. To work with just a single eye, comment out or delete one of the two lines. In the Hallowing case (if ADAFRUIT\_HALLOWING is defined), this is already done (notice also the rotation value of “2,” because the Hallowing screen is oriented upside-down).

As previously explained, the next section decides whether to use the library for OLED or TFT displays, by #including one or the other:

```
#include &lt;Adafruit_SSD1351.h&gt;  // OLED display library -OR-
//#include &lt;Adafruit_ST7735.h&gt; // TFT display library (enable one only)
```

After this, two lines indicate the pins used for the displays’ DC (data/command) and RESET signals:

```
#define DISPLAY_DC     7       // Data/command pin for ALL displays
#define DISPLAY_RESET  8       // Reset pin for ALL displays
```

If the project involves multiple eyes, these lines should fan out from the microcontroller to ALL displays; unlike the select pins above, which are unique to each display.

The Hallowing board has a different set of pins already defined, plus some extra items for backlight control.

The last section configures various controls:

```
//#define JOYSTICK_X_PIN A0 // Analog pin for eye horiz pos (else auto)
//#define JOYSTICK_Y_PIN A1 // Analog pin for eye vert position (")
//#define JOYSTICK_X_FLIP   // If defined, reverse stick X axis
//#define JOYSTICK_Y_FLIP   // If defined, reverse stick Y axis
#define TRACKING            // If defined, eyelid tracks pupil
#define BLINK_PIN         1 // Pin for manual blink button (BOTH eyes)
#define AUTOBLINK           // If defined, eyes also blink autonomously
#ifdef ADAFRUIT_HALLOWING
  #define LIGHT_PIN      A1 // Hallowing light sensor pin
  #define LIGHT_CURVE  0.33 // Light sensor adjustment curve
  #define LIGHT_MIN      30 // Minimum useful reading from light sensor
  #define LIGHT_MAX     980 // Maximum useful reading from sensor
#else
  #define LIGHT_PIN      A2 // Photocell or potentiometer (else auto iris)
//#define LIGHT_PIN_FLIP    // If defined, reverse reading from dial/photocell
  #define LIGHT_MIN       0 // Lower reading from sensor
  #define LIGHT_MAX    1023 // Upper reading from sensor
#endif
#define IRIS_SMOOTH         // If enabled, filter input from IRIS_PIN
#if !defined(IRIS_MIN)      // Each eye might have its own MIN/MAX
  #define IRIS_MIN      120 // Iris size (0-1023) in brightest light
#endif
#if !defined(IRIS_MAX)
  #define IRIS_MAX      720 // Iris size (0-1023) in darkest light
#endif
```

JOYSTICK\_X\_PIN and JOYSTICK\_Y\_PIN (here set to A0 and A1, respectively) state where the joystick inputs are connected. By default, these lines are commented out — the eye moves autonomously, without user input. If you have a joystick connected, enable these two lines. (X\_FLIP and Y\_FLIP reverse the input direction if needed)

TRACKING sets whether the upper eyelid follows the pupil (as actual eyes do, it’s a neat thing). You can turn this off by commenting out this line.

LIGHT\_PIN states where the photocell or dial is connected for adjusting the size of the pupil/iris. LIGHT\_PIN\_FLIP reverses the direction, like the joystick settings (lower values should be darker). LIGHT\_MIN and LIGHT\_MAX are the minimum and maximum reliable readings from the sensor (it might occasionally go below or above these, but it's rare, probably noise that can be disregarded), while IRIS\_MIN and IRIS\_MAX control the dilation of the pupil in response to the light reading (smaller numbers = smaller pupil, range is 0 to 1023).

IRIS\_SMOOTH filters the input from LIGHT\_PIN so it’s not twitchy. This slows the reaction time, but the movement&nbsp;is similar to real eyes, pretty nifty.

BLINK\_PIN specifies a pin where a button is connected for blinking both eyes simultaneously (distinct from the individual left/right wink pins previously discussed). If you don’t have a button connected for this, the line can be commented out or the value set to -1.

AUTOBLINK (enabled by default) makes the eyes automatically blink randomly every few seconds. You can comment this out to make the eyes only blink with the buttons…or you can use both in combination.

If the example eyes don’t deliver quite what you need, it’s possible to generate new header files with custom graphics…

# Electronic Animated Eyes for ARM Microcontrollers

## Customizing

As we’ve seen, the Arduino sketch uses massive tables of precomputed _stuff._ These tables are generated with a script written in Python, using image files as inputs.

To generate new tables, you need some familiarity with Python and command-line script usage. Your computer must have Python installed, plus the Python Imaging Library. That’s going to vary on different systems and is beyond the scope of this guide, but Googling will turn up some getting-started resources.

So we’re singing from the same page, let’s lay out some eye terminology…

The “white” of the eye is known as the _sclera._

The _iris_ is the muscle that contracts to adjust the size of the _pupil_ in response to light.

The _upper_ and _lower eyelids_ are involved in blinking.

![light_PartsOfEye.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/575/medium640/light_PartsOfEye.jpg?1441265294)

Eyes are weirder than&nbsp;you might think.&nbsp;They’re _not_&nbsp;simply football-shaped, they’ve got _two_ lids, and the pupil and eyelids&nbsp;_interact._&nbsp;The Arduino sketch takes a few shortcuts, but makes an effort at simulating these effects.

The Python script (located in the “convert” folder from the Github repository) — **tablegen.py** — takes six or seven images (corresponding to eye parts above) as inputs and generates a table&nbsp;for each. There’s also an&nbsp;array that it generates on its own — it precomputes and stores a bunch of trigonometry. The output can be redirected as a .h file and used with the Arduino sketch.

Let’s look at the defaultEye images (included in the convert/defaultEye directory):

The sclera image is 200x200 pixels, allowing the eye lots of room to pivot (the screens are 128x128 pixels). Aside from icky veins and stuff, this also determines the color of the pupil.&nbsp;The area in&nbsp;the center&nbsp;should match the desired iris size. In the default eye case, that’s 80 pixels across.

Since the other eye designs&nbsp;have no visible sclera, their sclera images are blank (but still need to be present). Dragon and noSclera are 160x160 pixels (they can pivot a little), while the goat eye is 128x128, same size as the screen, thus it’s prevented automatically from&nbsp;moving.

![light_convert-sclera.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/596/medium640/light_convert-sclera.jpg?1441430329)

This is interesting…the iris image is “unrolled,” kind of like a map of the earth. The pupil is at the bottom, outer edge of the iris at the top. The Arduino sketch morphs this back into the round shape…this is what makes the cool scaling effect possible when reacting to light.

The optimal iris image width can be computed by multiplying the round iris diameter (in pixels) by _pi_ — 3.14 — while the image height is the iris radius in pixels. Doesn’t have to be exact, just “ish.” The default iris is 80 pixels across, so&nbsp;the map image is 256x64 pixels.

Dragon and noSclera irises are 160 pixels in diameter, so their iris map images are 512x80. The goat, 128 pixels across, has a 402x64&nbsp;map.

![light_convert-iris.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/600/medium640/light_convert-iris.jpg?1441432650)

Upper and lower lids are grayscale images the same dimensions as the screen (128x128 pixels). For each frame of animation, a _threshold_ filter is applied —&nbsp;the eye is rendered only where the eyelid pixel values exceed some limit (which changes to create the blinking effect). Additionally, a point sample taken slightly above the pupil makes the eyelid tracking effect possible.

There are _two_ sets of eyelid images — one set is left/right symmetrical, the other is not.

![light_convert-lids.jpg](https://cdn-learn.adafruit.com/assets/assets/000/027/599/medium640/light_convert-lids.jpg?1441430520)

To recreate the defaultEye.h file, you’d go&nbsp;the “convert” directory and enter this command (as a single&nbsp;line):

```
python tablegen.py defaultEye/sclera.png defaultEye/iris.png defaultEye/lid-upper-symmetrical.png defaultEye/lid-lower-symmetrical.png defaultEye/lid-upper.png defaultEye/lid-lower.png 80 &gt; defaultEye.h
```

The eye images must be specified in the order: sclera, iris, symmetrical upper lid, symmetrical lower lid, asymmetrical upper lid, asymmetrical lower lid. The iris diameter (80 pixels in this example) is specified next. Then the output is redirected to the file “defaultEye.h” (you’ll want to give your own eyes different names). Check the contents of this file after running the script…any error messages will be at the end.

The resulting file can then be moved to the “graphics” folder within the “uncannyEyes” directory.

Add an #include line for whatever name you’ve assigned it. Compile and upload to the Teensy board and see what you get!

A couple of eye designs (dragon and goat) have strange pupil shapes. In this case, one more argument can be added, the filename of a “pupil map” image that assists this code in generating certain tables. Images for these are located in the corresponding directories. For example:

```
python tablegen.py dragonEye/sclera.png dragonEye/iris.png dragonEye/lid-upper-symmetrical.png dragonEye/lid-lower-symmetrical.png dragonEye/lid-upper.png dragonEye/lid-lower.png 160 dragonEye/pupilMap.png &gt; dragonEye.h
```

 **There are size limits to all these images.** Sclera and iris images require **two bytes per pixel.** Eyelid images are one **byte per pixel.** Additionally, a lookup table equal to the iris size (80x80 pixels in the defaultEye case) requires **two bytes per element.**

160x160x2 + 256x64x2 + 128x128 + 128x128 + 80x80x2 =&nbsp;129,536 bytes.

The code requires a little over 50K, so the resulting total compiled sketch size is about 182K, well within the **256K** flash space of the Teensy. The dragon eye, with its large iris, pushes much closer to the limit. Do a little math before investing a lot of time in a new set of images, to make sure it’ll fit in the available space.

# Electronic Animated Eyes for ARM Microcontrollers

## Bowler Hat Project

https://youtu.be/AQZBaTYm2Js

![](https://cdn-learn.adafruit.com/assets/assets/000/028/081/medium800thumb/light_eyeball-bowler-hat-22.jpg?1448322926)

Wear an eyeball on your hat! This is an intermediate-level wearables project built using the one Electronic Animated Eye built using Teensy 3.1/3.2 and an OLED or TFT display. The result is a compact bowler with electronics built into the ribbon band. This hat could be a spooky upgrade to a Clockwork Orange costume and much more!

![](https://cdn-learn.adafruit.com/assets/assets/000/028/058/medium800/light_eyeball-bowler-hat-00.jpg?1444762527)

This iteration does not use the 3D printing files provided earlier in this guide, but rather a more gasket-like shape 3D printed in SemiFlex flexible filament and sewn onto the hat (the cabs I found at the plastics store were 1.25" rather than the recommended 1.5"):

[1.25_inch_cab_OLED_gasket.stl](https://learn.adafruit.com/system/assets/assets//original/1.25_inch_cab_OLED_gasket.stl?1444788360)
As an alternative to 3D printing, you can&nbsp;cut a piece of rubber or leather to hold the cabochon in place.

![](https://cdn-learn.adafruit.com/assets/assets/000/028/059/medium800/light_eyeball-bowler-hat-03.jpg?1444762642)

In addition to the items listed in the overview, you will need:

- bowler hat
- scissors
- needles and thread
- tailor's chalk or marking pen

Solder a ribbon cable to your display (OLED shown) as directed on the wiring page, however you can be a bit more relaxed about the wire slack lengths and positioning than the hard plastic 3d enclosure calls for since these wires will be hidden and protected in the band&nbsp;of the hat.

![light_eyeball-bowler-hat-05.jpg](https://cdn-learn.adafruit.com/assets/assets/000/028/064/medium640/light_eyeball-bowler-hat-05.jpg?1444763035)

![light_eyeball-bowler-hat-06.jpg](https://cdn-learn.adafruit.com/assets/assets/000/028/065/medium640/light_eyeball-bowler-hat-06.jpg?1444763085)

Fold the ribbon cable at a right angle to send it out one side toward the hat's ribbon bow. Cut the ribbon cable to length to reach the approximate center of the bow.

![light_eyeball-bowler-hat-07.jpg](https://cdn-learn.adafruit.com/assets/assets/000/028/066/medium640/light_eyeball-bowler-hat-07.jpg?1444763676)

![](https://cdn-learn.adafruit.com/assets/assets/000/028/076/medium800thumb/light_eyeball-bowler-hat-17.jpg?1448322773)

Solder up the connections according to the wiring instructions and test out your circuit. Shown here is the flickering effect you'll get with an OLED **on video only&nbsp;** -- it looks fabulous to the naked eye. The flickering can be mitigated slightly by adjusting your camera shutter speed, but go with a TFT if your primary goal is to&nbsp;capture crystal video!

An optional small change in the code yields better&nbsp;animation. With only a single eye to render, screen updates can occur twice as fast and the animation is super buttery smooth. In the file config.h, look for these two lines of code and delete or comment out one, leaving the other enabled&nbsp;(depending on which 'select' pin you've wired up):

```
  {  9, 0, 0 }, // LEFT EYE display-select and wink pins, no rotation
  { 10, 2, 0 }, // RIGHT EYE display-select and wink pins, no rotation
```

Also, with no photocell in the circuit, you can comment out&nbsp;this line a bit further down in the file; the pupil will change size on its own rather than in response to light:

```
  #define LIGHT_PIN      A2 // Photocell or potentiometer (else auto iris)
```

Mark the center front of the hat with tailor's chalk or a pen, then trace your cabochon or gasket to transfer the circle outline to the ribbon.

&nbsp;

Carefully cut out the cab-sized circle from the ribbon with sharp scissors.

![light_eyeball-bowler-hat-08.jpg](https://cdn-learn.adafruit.com/assets/assets/000/028/071/medium640/light_eyeball-bowler-hat-08.jpg?1444771976)

![](https://cdn-learn.adafruit.com/assets/assets/000/028/072/medium800thumb/light_eyeball-bowler-hat-10.jpg?1448322648)

Slide the display into the ribbon band behind the round cutout, routing the ribbon cable off to the side.

![](https://cdn-learn.adafruit.com/assets/assets/000/028/075/medium800thumb/light_eyeball-bowler-hat-15.jpg?1448322744)

Stow&nbsp;the Teensy 3.1/3.2 and lipoly backpack into the ribbon bow and tuck in the ribbon cable slack behind the band.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/028/080/medium800thumb/light_eyeball-bowler-hat-20.jpg?1448322896)

The battery can be tucked into the ribbon band near the back of the head, with its wires headed into the bow area for plugging in.

![](https://cdn-learn.adafruit.com/assets/assets/000/028/073/medium800thumb/light_eyeball-bowler-hat-12.jpg?1448322693)

Position the cabochon on the display and sandwich it in place with the 3D printed (or leather or rubber) gasket.

![](https://cdn-learn.adafruit.com/assets/assets/000/028/074/medium800thumb/light_eyeball-bowler-hat-16.jpg?1448322703)

Stitch the gasket's four holes to the hat through the mounting holes of the display (OLED shown). It can be handy to use two needles pierced through the front with pliers, then pull them through to the inside of the hat and tie a knot.

![](https://cdn-learn.adafruit.com/assets/assets/000/028/077/medium800thumb/light_eyeball-bowler-hat-18.jpg?1448322827)

The feather accent serves to obscure the circuit from view-- feel free to glue it in place if you like!

This hat is not weatherproof!If it rains, power down and stow your hat. Use the original 3D enclosure and stitch it on for a more protected display, and consider shrinking large heatshrink tubing over the PCBs. &nbsp;Want to ruggedize this design? There are some tips in this video:

https://www.youtube.com/watch?v=kolq3eSu4ug

# Electronic Animated Eyes for ARM Microcontrollers

## Ready-Made UF2 Files

Among the appealing features of Adafruit’s ARM boards is the use of the _UF2 bootloader,_ which makes these boards show up as a small USB flash drive on your computer. Just double-tap the reset button and copy a pre-compiled binary file over to this drive…no need to install or compile anything special with the Arduino IDE! We have a few ready-made animated eyes for some of the Adafruit boards that have screens attached…

The hazel **Human** eye is used by default in our animated eyes code, with an&nbsp;_anime-_sized iris.

![express_human.jpg](https://cdn-learn.adafruit.com/assets/assets/000/084/700/medium640/express_human.jpg?1574285371)

The **Dragon** eye demonstrates use of a slit pupil.

![express_dragon.jpg](https://cdn-learn.adafruit.com/assets/assets/000/084/702/medium640/express_dragon.jpg?1574285386)

Some animals have such huge irises you rarely see the sclera (the white part of the eye). **No\_Sclera** &nbsp;is an example eye for these situations.

![express_nosclera.jpg](https://cdn-learn.adafruit.com/assets/assets/000/084/703/medium640/express_nosclera.jpg?1574285401)

The **Newt** eye originated from the [Eye of Newt pendant guide](https://learn.adafruit.com/eye-of-newt)…but this one’s trivial to install thanks to the UF2 bootloader.

![express_newt.jpg](https://cdn-learn.adafruit.com/assets/assets/000/084/704/medium640/express_newt.jpg?1574285424)

The **Terminator** eye design originated with the [Terminator Eyeball Upgrade guide](https://learn.adafruit.com/terminator-eyeball-upgrade/overview)…but again, so much easier to install now.

![express_terminator.jpg](https://cdn-learn.adafruit.com/assets/assets/000/084/705/medium640/express_terminator.jpg?1574285439)

# Circuit Playground Bluefruit with TFT Gizmo

These are compiled for the [**Circuit Playground Bluefruit**](https://www.adafruit.com/product/4333) board with [**TFT Gizmo**](https://www.adafruit.com/product/4367)&nbsp;and **will not work on other boards**.

_Currently, the pupil reacts to the light sensor…this is a bug, the pupil should have its own movements because the sensor is on the reverse side from the TFT display. These UF2s will be updated once it’s resolved._

[CPB_Eye_Human.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/709/original/CPB_Eye_Human.UF2?1574287996)
[CPB_Eye_Dragon.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/710/original/CPB_Eye_Dragon.UF2?1574288003)
[CPB_Eye_No_Sclera.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/711/original/CPB_Eye_No_Sclera.UF2?1574288014)
[CPB_Eye_Newt.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/712/original/CPB_Eye_Newt.UF2?1574288021)
[CPB_Eye_Terminator.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/713/original/CPB_Eye_Terminator.UF2?1574288030)
This is a highly specific Cybernetic Santa Claus version that includes both our Terminator eye graphics and the code to drive [a strand of 30 NeoPixels](https://www.adafruit.com/product/3919) plugged into the TFT Gizmo's A2 port.&nbsp;

[CPB_Eye_Terminator_Santa_Lights.UF2](https://cdn-learn.adafruit.com/assets/assets/000/085/488/original/CPB_Eye_Terminator_Santa_Lights.UF2?1575651840)
# Circuit Playground Express with TFT Gizmo

Similar to the above, these are compiled specifically for [**Circuit Playground Express**](https://www.adafruit.com/product/3333) with the [**TFT Gizmo**](https://www.adafruit.com/product/4367); they **will not work on other boards**. The light sensor is _not_ used here, since it’s on the opposite side from the display…instead the pupil dilates on its own. This can all be changed if you compile from the source code.

[CPX_Eye_Human.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/714/original/CPX_Eye_Human.UF2?1574288037)
[CPX_Eye_Dragon.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/715/original/CPX_Eye_Dragon.UF2?1574288045)
[CPX_Eye_No_Sclera.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/716/original/CPX_Eye_No_Sclera.UF2?1574288053)
[CPX_Eye_Newt.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/717/original/CPX_Eye_Newt.UF2?1574288060)
[CPX_Eye_Terminator.UF2](https://cdn-learn.adafruit.com/assets/assets/000/084/718/original/CPX_Eye_Terminator.UF2?1574288067)
# Other Boards, and Customizing the Look

Ready-made eyes for the **Adafruit HalloWing M0** board are available in the [HalloWing guide](https://learn.adafruit.com/adafruit-hallowing/spooky-eyes).

For the **HalloWing M4** and **MONSTER M4SK** , see the [MONSTER M4SK guide](https://learn.adafruit.com/adafruit-monster-m4sk-eyes/m-eyes-firmware). This one works a bit different…the code and graphics are separate pieces.

For everything else, including customizing the behavior and look of the eyes, you’ll need to compile from source code, explained in the original [“Uncanny Eyes” guide](https://learn.adafruit.com/animated-electronic-eyes).


## Featured Products

### Teensy 3.2 + header

[Teensy 3.2 + header](https://www.adafruit.com/product/2756)
[Teensy](http://www.pjrc.com/teensy/index.html) 3.2&nbsp;is a small, breadboard-friendly development board designed by Paul Stoffregen and PJRC. Teensy 3.2&nbsp;brings a low-cost 32 bit ARM Cortex-M4 platform to hobbyists, students and engineers, using an adapted version of the...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2756)
[Related Guides to the Product](https://learn.adafruit.com/products/2756/guides)
### Teensy 3.1 + header

[Teensy 3.1 + header](https://www.adafruit.com/product/1625)
[Teensy](http://www.pjrc.com/teensy/index.html) 3.1 is a small, breadboard-friendly development board designed by Paul Stoffregen and PJRC. Teensy 3.1 brings a low-cost 32 bit ARM Cortex-M4 platform to hobbyists, students and engineers, using an adapted version of the Arduino IDE...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1625)
[Related Guides to the Product](https://learn.adafruit.com/products/1625/guides)
### OLED Breakout Board - 16-bit Color 1.5" w/microSD holder

[OLED Breakout Board - 16-bit Color 1.5" w/microSD holder](https://www.adafruit.com/product/1431)
We love our black and white monochrome displays but we also like to dabble with some color now and then. Our big 1.5" color OLED displays are perfect when you need a small display with vivid, high-contrast 16-bit color. The visible portion of the OLED measures 1.5" diagonal and...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1431)
[Related Guides to the Product](https://learn.adafruit.com/products/1431/guides)
### Adafruit 1.44" Color TFT LCD Display with MicroSD Card breakout

[Adafruit 1.44" Color TFT LCD Display with MicroSD Card breakout](https://www.adafruit.com/product/2088)
This lovely little display breakout is the best way to add a small, colorful and bright display to any project. Since the display uses 4-wire SPI to communicate and has its own pixel-addressable frame buffer, it can be used with every kind of microcontroller. Even a very small one with low...

In Stock
[Buy Now](https://www.adafruit.com/product/2088)
[Related Guides to the Product](https://learn.adafruit.com/products/2088/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)
### Analog 2-axis Thumb Joystick with Select Button + Breakout Board

[Analog 2-axis Thumb Joystick with Select Button + Breakout Board](https://www.adafruit.com/product/512)
This mini-kit makes it easy to mount a PSP/Xbox-like thumb joystick to your project. The thumbstick is an analog joystick - more accurate and sensitive than just 'directional' joysticks - with a 'press in to select' button. Since it's analog, you'll need two analog...

In Stock
[Buy Now](https://www.adafruit.com/product/512)
[Related Guides to the Product](https://learn.adafruit.com/products/512/guides)
### PSP 2-Axis Analog Thumb Joystick

[PSP 2-Axis Analog Thumb Joystick](https://www.adafruit.com/product/444)
Add a tiny joystick to your project with this PSP thumbstick. This is a replacement component for PSP1000's, but we think they'd make for a great little joystick/thumbstick add-on for a wearable, or portable project.  
  
The joystick is a 'self-centering' analog-type....

In Stock
[Buy Now](https://www.adafruit.com/product/444)
[Related Guides to the Product](https://learn.adafruit.com/products/444/guides)
### Tactile Switch Buttons (12mm square, 6mm tall) x 10 pack

[Tactile Switch Buttons (12mm square, 6mm tall) x 10 pack](https://www.adafruit.com/product/1119)
Medium-sized clicky momentary switches are standard input "buttons" on electronic projects. These work best in a PCB but [can be used on a solderless breadboard as shown in this tutorial](https://learn.adafruit.com/adafruit-arduino-lesson-6-digital-inputs?view=all). The...

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

## Related Guides

- [Adafruit 1.44" Color TFT with Micro SD Socket](https://learn.adafruit.com/adafruit-1-44-color-tft-with-micro-sd-socket.md)
- [Color Balancing Video Camera Light feat. DotStars](https://learn.adafruit.com/color-balancing-light-box-with-dotstar-cool-warm-white-leds.md)
- [Galaxy Pendant](https://learn.adafruit.com/life-proof-led-necklace.md)
- [Animated Snake Eyes Bonnet for Raspberry Pi](https://learn.adafruit.com/animated-snake-eyes-bonnet-for-raspberry-pi.md)
- [Purple People Eater](https://learn.adafruit.com/purple-people-eater.md)
- [Adafriend the Virtual Pet Cube](https://learn.adafruit.com/adafriend.md)
- [Animated Flying Toaster OLED Jewelry](https://learn.adafruit.com/animated-flying-toaster-oled-jewelry.md)
- [Supernova Poi](https://learn.adafruit.com/supernova-poi.md)
- [Animated Scrolling "Mario Clouds" TFT Jewelry](https://learn.adafruit.com/scrolling-mario-clouds-tft-jewelry.md)
- [Adafruit AMG8833 8x8 Thermal Camera Sensor](https://learn.adafruit.com/adafruit-amg8833-8x8-thermal-camera-sensor.md)
- [Introducing Pro Trinket](https://learn.adafruit.com/introducing-pro-trinket.md)
- [Hallowing M0 Spirit Board](https://learn.adafruit.com/hallowing-spirit-board.md)
- [NeoPixel LED Necklace Insert with USB Charging](https://learn.adafruit.com/neopixel-led-necklace-insert-with-usb-charging.md)
- [Portable Trellis Sound Board](https://learn.adafruit.com/portable-trellis-sound-board.md)
- [Adafruit Arcade Bonnet for Raspberry Pi](https://learn.adafruit.com/adafruit-arcade-bonnet-for-raspberry-pi.md)
- [Unicorn Hat with Moving Ears](https://learn.adafruit.com/unicorn-hat-with-moving-ears.md)
