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 here. 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_BusIO
- Adafruit_SSD1351
- Adafruit_ST7735
- Python PIL Library (only if you want to add your own custom images)
Once all that is installed, download and open the sketch.
Select 72 MHz as your CPU speed…it’s actually smoother than 96 KHz for this particular code.
Code Download
The code will download as a .zip file. 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. Start by uploading the code as-is, for testing purposes. Make sure it works before making changes.
Look at the config.h file. Right at the top you'll find several different 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!
// Enable ONE of these #includes -- HUGE graphics tables for various eyes: //#include "graphics/defaultEye.h" // Standard human-ish hazel eye -OR- //#include "graphics/dragonEye.h" // Slit pupil fiery dragon/demon eye -OR- //#include "graphics/noScleraEye.h" // Large iris, no sclera -OR- //#include "graphics/goatEye.h" // Horizontal pupil goat/Krampus eye -OR- #include "graphics/newtEye.h" // Eye of newt
This code defaults to rendering to 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 eyeInfo[] array and comment out the last item within:
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 };
I wanted to make an eyeball that looked as much like a real newt's eye as possible. I did an image search and found one I liked.
I used photoshop to "unroll" the eyeball so the software can draw it correctly. After some cropping, zooming, and judicious use of the "Liquify" tool, here's 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 change 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, in the eyeInfo[] array:
{ 9, 0, 0 }, // LEFT EYE display-select and wink pins, no rotation
To rotate the eye 90 degrees clockwise, change the last “0” to a “1.” To rotate 180 degrees, use “2,” and for 90 degrees counterclockwise use “3.”
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.
Text editor powered by tinymce.