Eek! Definitely meant Teensy. Fixed in the guide now, thanks for spotting that!
That's correct, both eyes share those 4 pins, while the 'select' wire is unique to each display. How you split those four connections can be a matter of personal preference...with thin wire, you can fit two through each via on the Teensy board before soldering. Or a two-way splice with some heat-shrink is pretty compact (image attached is a three-way splice, but same idea). Or you can cut out a small piece of a Perma-Proto board and make use of the connected pads.
Electronic Animated Eyes using Teensy 3.1
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
- cammi
- Posts: 14
- Joined: Sun Sep 27, 2015 8:59 pm
Re: Electronic Animated Eyes using Teensy 3.1
Thank you @pburgess! Those pictures are also very helpful! :)
- woodcmiami
- Posts: 9
- Joined: Sat Nov 22, 2014 10:32 am
Re: Electronic Animated Eyes using Teensy 3.1
I constructed this several months ago and it worked so well I bought another teensy 3.2 and a couple of OLED's to make another. I am using the same code as before but now when I try to compile I get this error;
I tried downloading the code again and get the same errors. Any ideas on how to get this to compile like it did before?
Code: Select all
Documents/Arduino/Teensy3.1_Eyes-master/uncannyEyes/uncannyEyes.ino:460:17: warning: extra tokens at end of #ifdef directive [enabled by default]
#ifdef IRIS_PIN && (IRIS_PIN >= 0) // Interactive iris
^
uncannyEyes: In function 'void frame(uint16_t)':
uncannyEyes:327: warning: comparison between signed and unsigned integer expressions
if((t - eye[eyeIndex].blink.startTime) >= eye[eyeIndex].blink.duration) {
^
uncannyEyes:404: warning: comparison between signed and unsigned integer expressions
if(s >= eye[eyeIndex].blink.duration) s = 255; // At or past blink end
- michaelmeissner
- Posts: 1821
- Joined: Wed Aug 29, 2012 12:40 am
Re: Electronic Animated Eyes using Teensy 3.1
You probably used an older Teensydunio, which used an older compiler. Recent versions of teensydunio also now enable more warnings.
BTW, the code is incorrect. The compiler is correct in flagging it.
Change:
to:
BTW, the code is incorrect. The compiler is correct in flagging it.
Change:
Code: Select all
#ifdef IRIS_PIN && (IRIS_PIN >= 0) // Interactive iris
Code: Select all
#if defined(IRIS_PIN) && (IRIS_PIN >= 0) // Interactive iris
- michaelmeissner
- Posts: 1821
- Joined: Wed Aug 29, 2012 12:40 am
Re: Electronic Animated Eyes using Teensy 3.1
BTW, with the 1.44" TFT screens, I have found that the 12 LED neopixel ring is just the perfect size to be around the eye, and you can use a 22mm cabochons for inside of the ring. You would need to put the neopixel update code in the frame function, rather than in loop.
I have my Teensy 3.6 running with 2 third party TFT screens and 2 12-LED neopixels running my normal random patterns. I need to clean it up, because my current incarnation is somewhat glitchy.
Ultimately, I hope to marry the prop shield's motion sensors with the eyes.
I have my Teensy 3.6 running with 2 third party TFT screens and 2 12-LED neopixels running my normal random patterns. I need to clean it up, because my current incarnation is somewhat glitchy.
Ultimately, I hope to marry the prop shield's motion sensors with the eyes.
- cammi
- Posts: 14
- Joined: Sun Sep 27, 2015 8:59 pm
Re: Electronic Animated Eyes using Teensy 3.1
I'm looking to modify uncannyEyes so that the eyes can also express the emotion where the eyes would go from being "O_O" and pull up to be "^_^" (If my emoticon analogy makes sense.) I'd like this to do it on its own autonomously and would still like it support autoblinking as the code already does. So, my target behavior is it being able to randomly animate between eyes open "O_O", eyes closed "-_-", and smiling eyes "^_^"
I was looking at the uncannyEyes.ino and I was thinking of creating another data struct similar to eyeBlink and implement it similar to how eyeBlink is. I.e.,
But would just modifying the upper and lower lid threshold enough such that it could pull up make it look like "^_^"?
Am I going down an appropriate line of thought and/or does anyone have any other suggestions?
I was looking at the uncannyEyes.ino and I was thinking of creating another data struct similar to eyeBlink and implement it similar to how eyeBlink is. I.e.,
Code: Select all
typedef struct {
int8_t pin; // Optional button here for indiv. wink
uint8_t state; // NOSMILEBLINK/ENSMILEBLINK/DESMILEBLINK
int32_t duration; // Duration of blink state (micros)
uint32_t startTime; // Time (micros) of last state change
} eyeSmile;
Am I going down an appropriate line of thought and/or does anyone have any other suggestions?
- cmv
- Posts: 2
- Joined: Mon Oct 03, 2016 12:18 pm
Re: Electronic Animated Eyes using Teensy 3.1
I've configured the eyes and they look great in the default automatic mode. When the analog joystick control is added, however, the eyes appear very shakey. I'm assuming this is happening because of noise from the joystick or the framestack updating from analog input. Is there a filter or other method that could be applied to lessen this shake?
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Electronic Animated Eyes using Teensy 3.1
Ideas for reducing joystick noise are covered in this prior post:
viewtopic.php?f=47&t=80947&p=457494&hil ... ck#p457494
viewtopic.php?f=47&t=80947&p=457494&hil ... ck#p457494
- cmv
- Posts: 2
- Joined: Mon Oct 03, 2016 12:18 pm
Re: Electronic Animated Eyes using Teensy 3.1
Thanks for the help!
As a follow-up, is there a way to configure the code to accept input from a USB joystick connected to the computer rather than wired to the board?
As a follow-up, is there a way to configure the code to accept input from a USB joystick connected to the computer rather than wired to the board?
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Electronic Animated Eyes using Teensy 3.1
As written, no. There's an option to interface an analog joystick directly to the Teensy, but otherwise you'd need to implement something yourself, perhaps reading positions from a serial connection.
- michaelmeissner
- Posts: 1821
- Joined: Wed Aug 29, 2012 12:40 am
Re: Electronic Animated Eyes using Teensy 3.1
Well the new Teensy 3.6 does have pins for USB host support, but I suspect we are several months away from it being usable for things like USB joysticks.
Of course, if you were to roll up your sleeves, dive in and do the necessary work (learning about USB protocols in the process), it will get done sooner. Otherwise, you will need to wait until somebody else does it.
Of course, if you were to roll up your sleeves, dive in and do the necessary work (learning about USB protocols in the process), it will get done sooner. Otherwise, you will need to wait until somebody else does it.
- _Wosky_
- Posts: 6
- Joined: Sat Jun 03, 2017 1:14 am
Re: Electronic Animated Eyes using Teensy 3.1
Hi, I was trying to replicate the project, but as you can see in the picture, the screen doesn't work as intended. The cables are short, soldering is good, I don't know what else it could be.
I'm using a Teensy 3.2, and the latest Arduino IDE (1.8.2)
I'm using a Teensy 3.2, and the latest Arduino IDE (1.8.2)
- Attachments
-
- photo_2017-06-03_01-16-18.jpg (99.57 KiB) Viewed 1210 times
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Electronic Animated Eyes using Teensy 3.1
Make sure you've enabled the right code for OLED vs TFT. Looks like it might be turning the screen on but then sending the wrong init sequence for the display.
If that's not it, some clear photos of all the wiring maybe helpful.
If that's not it, some clear photos of all the wiring maybe helpful.
- _Wosky_
- Posts: 6
- Joined: Sat Jun 03, 2017 1:14 am
Re: Electronic Animated Eyes using Teensy 3.1
OLED is selected on the code (yes, I downloaded the library)
Here is the pin connection
SI/MOSI (Green) ===> Pin 11
CL/SCLK (Yellow) ===> Pin 13
RST (White) ===> Pin 8
DC (Blue) ===> Pin 7
OC (Red & Brown) ===> Pins 6/5 (I changed them in the code)
And some images, not the of best quality tho.
http://imgur.com/a/txTOd
Here is the pin connection
SI/MOSI (Green) ===> Pin 11
CL/SCLK (Yellow) ===> Pin 13
RST (White) ===> Pin 8
DC (Blue) ===> Pin 7
OC (Red & Brown) ===> Pins 6/5 (I changed them in the code)
And some images, not the of best quality tho.
http://imgur.com/a/txTOd
- michaelmeissner
- Posts: 1821
- Joined: Wed Aug 29, 2012 12:40 am
Re: Electronic Animated Eyes using Teensy 3.1
I've been busy, and I haven't been doing much in terms of Teensy.
IIRC, the animated eyes program runs too fast for the OLED displays. Back a few months ago, I was running it on the Teensy 3.2/3.5/3.6. I discovered that I had to reduce the Teensy speed to 24Mhz in order to run the displays with the Adafruit OLED display. With another OLED display that I got from Newhaven, I could usually run it at 48Mhz. Even at 24Mhz, it would glitch some times.
To change the speed, goto the Tools menu in the IDE title bar, select CPU speed, and then select 24Mhz.
The 2 different TFT displays I tried (Adafruit and a no-name display from ebay), I could run the Teensy 3.6 at 240 Mhz (the fastest overclock speed). Note, with the TFT displays, there are two gotchas:
IIRC, the animated eyes program runs too fast for the OLED displays. Back a few months ago, I was running it on the Teensy 3.2/3.5/3.6. I discovered that I had to reduce the Teensy speed to 24Mhz in order to run the displays with the Adafruit OLED display. With another OLED display that I got from Newhaven, I could usually run it at 48Mhz. Even at 24Mhz, it would glitch some times.
To change the speed, goto the Tools menu in the IDE title bar, select CPU speed, and then select 24Mhz.
The 2 different TFT displays I tried (Adafruit and a no-name display from ebay), I could run the Teensy 3.6 at 240 Mhz (the fastest overclock speed). Note, with the TFT displays, there are two gotchas:
- Teensy hasn't picked up the lastest Adafruit_ST7735 that has the support for the 128x128 displays. You need to not load the PJRC version, and instead load the version from Adafruit.
- You really want to use the 5 special SPI CS (9, 10, 15/A1, 20/A6, and 21/A7) pins for the maximum speed. I use 15/A1 for DC, 9 for the left eye, 10 for the right eye, and 8 for reset.
Please be positive and constructive with your questions and comments.