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.
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.