Skip to content

Commit 54dbfd2

Browse files
authored
Merge pull request #319 from jedgarpark/all-seeing-skull
first commit All Seeing Skull code
2 parents 2785e61 + 45a071c commit 54dbfd2

File tree

9 files changed

+74473
-0
lines changed

9 files changed

+74473
-0
lines changed

All_Seeing_Skull/All_Seeing_Skull.ino

Lines changed: 712 additions & 0 deletions
Large diffs are not rendered by default.

All_Seeing_Skull/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# All_Seeing_Skull
2+
3+
'Uncanny eyes' for Adafruit 1.5" OLED (product #1431) or 1.44" TFT LCD (#2088). Works on PJRC Teensy 3.x and on Adafruit M0 and M4 boards (Feather, Metro, etc.), and HalloWing M0 Express. This code uses features specific to these boards and WILL NOT work on normal Arduino or other boards!
4+
5+
This version is configured for the HalloWing. https://learn.adafruit.com/hallowing-all-seeing-skull/overview
6+
7+
Original project How-to guide with parts list and 3D models is here:
8+
https://learn.adafruit.com/animated-electronic-eyes-using-teensy-3-1/overview
9+
10+
Teensy 3.x w/OLED screens: use 72 MHz board speed -- 96 MHz requires throttling back SPI bitrate and actually runs slower!
11+
12+
Directory contains Arduino sketch for Adafruit HalloWing M0. 'graphics' subfolder has various eye designs, as #include-able header files.
13+
14+
Folder 'convert' contains Python sketch for generating graphics header files. Requires Python Imaging Library. Example images are also in this directory.

All_Seeing_Skull/config.h

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
// Pin selections here are based on the original Adafruit Learning System
2+
// guide for the Teensy 3.x project. Some of these pin numbers don't even
3+
// exist on the smaller SAMD M0 & M4 boards, so you may need to make other
4+
// selections:
5+
6+
// GRAPHICS SETTINGS (appearance of eye) -----------------------------------
7+
8+
// If using a SINGLE EYE, you might want this next line enabled, which
9+
// uses a simpler "football-shaped" eye that's left/right symmetrical.
10+
// Default shape includes the caruncle, creating distinct left/right eyes.
11+
#ifdef ADAFRUIT_HALLOWING // Hallowing, with one eye, does this by default
12+
//#define SYMMETRICAL_EYELID
13+
#else // Otherwise your choice, standard is asymmetrical
14+
//#define SYMMETRICAL_EYELID
15+
#endif
16+
17+
// Enable ONE of these #includes -- HUGE graphics tables for various eyes:
18+
#include "graphics/defaultEye.h" // Standard human-ish hazel eye -OR-
19+
//#include "graphics/dragonEye.h" // Slit pupil fiery dragon/demon eye -OR-
20+
//#include "graphics/noScleraEye.h" // Large iris, no sclera -OR-
21+
//#include "graphics/goatEye.h" // Horizontal pupil goat/Krampus eye -OR-
22+
//#include "graphics/newtEye.h" // Eye of newt
23+
24+
// Optional: enable this line for startup logo (screen test/orient):
25+
#if !defined ADAFRUIT_HALLOWING // Hallowing can't always fit logo+eye
26+
#include "graphics/logo.h" // Otherwise your choice, if it fits
27+
#endif
28+
29+
// EYE LIST ----------------------------------------------------------------
30+
31+
// This table contains ONE LINE PER EYE. The table MUST be present with
32+
// this name and contain ONE OR MORE lines. Each line contains THREE items:
33+
// a pin number for the corresponding TFT/OLED display's SELECT line, a pin
34+
// pin number for that eye's "wink" button (or -1 if not used), and a screen
35+
// rotation value (0-3) for that eye.
36+
37+
eyeInfo_t eyeInfo[] = {
38+
#ifdef ADAFRUIT_HALLOWING
39+
{ 39, -1, 2 }, // SINGLE EYE display-select and wink pins, rotate 180
40+
#else
41+
{ 9, 0, 0 }, // LEFT EYE display-select and wink pins, no rotation
42+
{ 10, 2, 0 }, // RIGHT EYE display-select and wink pins, no rotation
43+
#endif
44+
};
45+
46+
// DISPLAY HARDWARE SETTINGS (screen type & connections) -------------------
47+
48+
#ifdef ADAFRUIT_HALLOWING
49+
#include <Adafruit_ST7735.h> // TFT display library
50+
#define DISPLAY_DC 38 // Display data/command pin
51+
#define DISPLAY_RESET 37 // Display reset pin
52+
#define DISPLAY_BACKLIGHT 7
53+
#define BACKLIGHT_MAX 128 // def 128
54+
#else
55+
// Enable ONE of these #includes to specify the display type being used
56+
#include <Adafruit_SSD1351.h> // OLED display library -OR-
57+
//#include <Adafruit_ST7735.h> // TFT display library (enable one only)
58+
#define DISPLAY_DC 7 // Data/command pin for ALL displays
59+
#define DISPLAY_RESET 8 // Reset pin for ALL displays
60+
#endif
61+
62+
#if defined(_ADAFRUIT_ST7735H_) || defined(_ADAFRUIT_ST77XXH_)
63+
#define SPI_FREQ 24000000 // TFT: use max SPI (clips to 12 MHz on M0)
64+
#else // OLED
65+
#if !defined(ARDUINO_ARCH_SAMD) && (F_CPU <= 72000000)
66+
#define SPI_FREQ 24000000 // OLED: 24 MHz on 72 MHz Teensy only
67+
#else
68+
#define SPI_FREQ 12000000 // OLED: 12 MHz in all other cases
69+
#endif
70+
#endif
71+
72+
// INPUT SETTINGS (for controlling eye motion) -----------------------------
73+
74+
// JOYSTICK_X_PIN and JOYSTICK_Y_PIN specify analog input pins for manually
75+
// controlling the eye with an analog joystick. If set to -1 or if not
76+
// defined, the eye will move on its own.
77+
// IRIS_PIN speficies an analog input pin for a photocell to make pupils
78+
// react to light (or potentiometer for manual control). If set to -1 or
79+
// if not defined, the pupils will change on their own.
80+
// BLINK_PIN specifies an input pin for a button (to ground) that will
81+
// make any/all eyes blink. If set to -1 or if not defined, the eyes will
82+
// only blink if AUTOBLINK is defined, or if the eyeInfo[] table above
83+
// includes wink button settings for each eye.
84+
85+
//#define JOYSTICK_X_PIN A0 // Analog pin for eye horiz pos (else auto)
86+
//#define JOYSTICK_Y_PIN A1 // Analog pin for eye vert position (")
87+
//#define JOYSTICK_X_FLIP // If defined, reverse stick X axis
88+
//#define JOYSTICK_Y_FLIP // If defined, reverse stick Y axis
89+
//#define TRACKING // If defined, eyelid tracks pupil
90+
#define BLINK_PIN 1 // Pin for manual blink button (BOTH eyes)
91+
//#define AUTOBLINK // If defined, eyes also blink autonomously
92+
#ifdef ADAFRUIT_HALLOWING //adjust min/max if inside a skull
93+
#define LIGHT_PIN A1 // Hallowing light sensor pin
94+
#define LIGHT_CURVE 0.33 // Light sensor adjustment curve
95+
#define LIGHT_MIN 30 // Minimum useful reading from light sensor def 30
96+
#define LIGHT_MAX 80 // Maximum useful reading from sensor def 980
97+
#else
98+
#define LIGHT_PIN A2 // Photocell or potentiometer (else auto iris)
99+
//#define LIGHT_PIN_FLIP // If defined, reverse reading from dial/photocell
100+
#define LIGHT_MIN 0 // Lower reading from sensor
101+
#define LIGHT_MAX 1023 // Upper reading from sensor
102+
#endif
103+
#define IRIS_SMOOTH // If enabled, filter input from IRIS_PIN
104+
#if !defined(IRIS_MIN) // Each eye might have its own MIN/MAX
105+
#define IRIS_MIN 120 // Iris size (0-1023) in brightest light
106+
#endif
107+
#if !defined(IRIS_MAX)
108+
#define IRIS_MAX 720 // Iris size (0-1023) in darkest light
109+
#endif
110+
//Adjust these offsets and ranges if inside a mask or skull eye socket
111+
#define eyeXOffset -150 // aim offset on x for autonomous move, default 0
112+
#define eyeYOffset 300 // aim offset on y, default 0
113+
#define eyeXRange 300 // Range of motion on x, full range is 1023
114+
#define eyeYRange 300 // Range of motion on y, full range is 1023

0 commit comments

Comments
 (0)