Keep watch with a creepy, compact, animated eyeball. Put it in a wide-mouth jar and add it to your potion shelf, or attach a leather thong to wear it like a pendant around your neck. This guide is based on the Uncanny Eyes project by Phil Burgess, with a Halloween-y twist.

Before you start soldering, get all your software running and uploaded to your Teensy microcontroller. Getting the code loaded up first will make it easier to troubleshoot any soldering or build issues later on.

Software setup is fully covered in the Uncanny Eyes project at Adafruit. And you’ll find the hardware build here.

YouTube player

CODE DOWNLOAD

Make sure you have installed everything listed below before moving on:

» Arduino IDE

» Teensyduino Installer

» Libraries (installed via the Arduino IDE and NOT the Teensyduino installer):

» Adafruit_GFX

» Adafruit_SSD1351

» Adafruit_ST7735

» Python PIL Library (only if you want to add your own custom images)

Now download the project code from github.com/adafruit/Teensy3.1_Eyes/archive/master.zip. Inside you’ll find a folder called convert that contains several different image folders and a Python script, and another folder called uncannyEyes that contains the Arduino sketch.

Open the sketch, uncannyEyes.ino, in the Arduino IDE and then make sure to select 72MHz as your CPU speed. (If your eye looks grainy, this could be your problem. It doesn’t work right at the default CPU “overclock” speed.)

Upload the sketch to the Teensy as-is for testing, and make sure that it works before making changes.

Now look at the uncannyEyes.ino sketch. At the top you’ll find several eye options. Uncomment the #include newtEye.h line to turn on the newt eye option, and comment out the #include defaultEye.h line. There can be only one!

This code defaults to rendering two eyes. Since we only have one eye, we can turn off the second one to make the code run faster. Just a few lines down, look for the eyepins[] array and comment out the second line within to turn off the right eye.

CUSTOMIZING THE GRAPHICS

I wanted an eyeball that looked as much like a real newt’s eye as possible. I did an image search and found one I liked.

Then I used Photoshop to “unroll” the eyeball so the software can draw it correctly. After some cropping, zooming, and judicious use of the Liquify filter, Figure   is what I ended up with.

The sclera (the white part of the eye) on a human looks really different from a reptilian eye.

I wanted a more newt-like look, so I inverted the colors in Photoshop, then added a black circle to the center to keep the pupil dark. It took me several tries to get it right, but I’m really happy with the end result.


These images are included with the code download, and the process is explained thoroughly over at the Uncanny Eyes guide. Go nuts and create your own unique look.

EYE ORIENTATION

There’s one more change we can make in the code to alter the orientation of the image. If your build comes out sideways or upside-down, and you want to rotate the eye to compensate, look for this line in the code, at the very end of the setup function.

To rotate the eye 90°, change (0x76) to (0x77) or (0x75). Or to rotate it 180°, use (0x66). I personally like this eye rotated 180° degrees to upside-down from the original image. I think It makes the eye look like it’s up to something crafty, which is really what I’m looking for in my Eye of Newt.

TROUBLESHOOTING

If you’re having trouble, head over to the Uncanny Eyes guide and take a look at some of the troubleshooting ideas. If you see an eye on your display but it looks snowy and pixelated, check to be sure you’ve selected 72MHz as your CPU speed as noted before.

WIRING DIAGRAM

There are a lot of connections that need to be made. Using a combination of solid core wire and stranded wire is the easiest way to get everything packed into as small a footprint as possible.

Color-coding is your friend here! Keep your power wires all red, and ground wires all black, and use a variety of colors for the other connections so you don’t get confused. Write down the colors you used and the corresponding pins they connect with so you have a reference for soldering.

Project Steps

1. PREP YOUR CHARGER

Bridge the charge pad on the back with a blob of solder, to make your battery charge faster.

Also cut the trace between the switch pads on the front to enable your on/off switch.

2. PREP YOUR SWITCH

Trim the switch legs to about half their length. Solder 4″ wires to the middle leg and one of the side legs, and cut off the other side leg. Secure the connections with heat-shrink tubing. Solder the two switch wires into the switch pads on the charger.

3. PREP YOUR PHOTOCELL SENSOR

Trim your photocell’s legs to about 1/3 of their length. Solder a stranded black wire to one leg, and two stranded colored wires to the other leg (the legs are interchangeable so it doesn’t matter which is which). Cover each connection with heat-shrink, then cover the whole photocell with larger heat-shrink, leaving only the top visible and uncovered.

4. PREP YOUR TEENSY AND DISPLAY

Cut the trace between the USB charging pads on the back of the Teensy.

Place a large piece of thick tape (gaffer’s tape or duct tape works great) over the back of the OLED display, carefully covering all the exposed components but leaving the solder hole labels visible.

5. SOLDER POWER WIRES AND CHARGER

Using silicone stranded wire, solder two red wires into VIN and two black wires into G on your Teensy. We’re using silicone stranded wire here because the solid core wires won’t fit two-to-a-hole.

Set the charger next to the Teensy and solder a red solid core wire from Teensy’s USB pin to the charger’s 5V pin. Solder one of the stranded red wires to BAT and one of the stranded black wires to G.

6. CONNECT PHOTOCELL AND DISPLAY

Solder various colors of solid core wires to the Teensy’s pins 7, 8, 9, 11, and 13. You’ll trim these to length later; for now just be sure they’re at least a couple inches long.

Trim one leg of your resistor down and solder it into the 3.3V pin on the Teensy. Solder the other leg to one of the colored wires coming from your photocell sensor. Cover the whole resistor with heat-shrink.

Solder the other colored wire from the photocell into Teensy’s pin 16, and solder the photocell’s black wire into the GND pin next to the Teensy’s reset button.

Place the Teensy and charger in line with the back of the OLED display. Carefully trim and solder all the remaining wires to the OLED display.

Plug your battery in and slide it between the OLED display and the rest of the components. Wind the wire around and bend the solid core wires until you have a tidy package. Secure everything in place with a few judicious blobs of hot glue.

Flip your switch on and watch your eye dance around. Cover the photocell to watch the pupil dilate!

7. MAKE THE CASE

Cut a small piece of fabric about 8″× 8″. Place your cabochon in the center and trace around it on the wrong side of the fabric. Cut a hole for the cabochon that’s a little smaller than your mark so the cabochon won’t fall through.

Fold your fabric in half around your electronic eye and mark where it meets itself. Sew the raw edges together with the right sides facing inward.

Flatten the fabric so the hole is on top and the seam is at the center back. Stitch a curved edge about 1″ below the hole. Make sure the electronics fit nicely inside.

Place your cabochon into the hole, face down (so you’re looking at the flat side). Run a bead of glue all around the edges to hold it securely in place.

Turn your case right side out and gently slide the electronics inside with the switch and photocell coming out the open top. With a utility knife, make a small slit above the USB port.

Make another hole for the photocell sensor to poke through.

Sew up the top of the case with a needle and thread, leaving the on/off switch accessible. I colored my on/off switch with a paint pen so it blends in better with my case.

Finish up by attaching a necklace cord,

or leave it as-is and keep it safe inside a potion jar.

Remember that the OLED screen is really delicate, so don’t try and squeeze it into a jar that’s a tight fit — you can break the screen if you squeeze it too hard.

TOIL AND TROUBLE!

Charge it up by plugging in a USB cable — the indicator light on the charger will turn green when it’s fully charged. Now you’re ready to cast your spells.