uncanny eyes with Teensy 3.1

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: uncanny eyes with Teensy 3.1

Post by pburgess »

Yeah, good thing about PIRs is that they're easy to work with and there's lots of existing examples to work off of. Just be mindful that the Teensy is a 3.3V device (if the PIR can run at 3.3V, great, but otherwise you might need a logic level converter or something).

'Fraid I've got a lot on my plate and can't get deep into custom code at the moment, but if you want to try tackling it yourself (the uncannyEyes sketch is a huge ratsnest), I think doing things in the drawEye() function would be least problematic. I'll just give hacky pseudocode here that hopefully explains well enough...

Have a *global* variable (an unsigned long) that keeps track of the last time the PIR was triggered, initialize it to zero. e.g.:

Code: Select all

unsigned long lastTriggerTime = 0L;
Early in the drawEye() function, poll the PIR using whatever method, and if triggered, set lastTriggerTime to the current millis() time, e.g.:

Code: Select all

if(digitalRead(PIRpin) ) { // PIR triggered
  lastTriggerTime = millis(); // Save last trigger time
}
A little later, in the gap between the SPI transaction start and the Y/X loops that issue data to the screens, check the current time against the saved trigger time, and if it's less than some threshold (let's say 5 seconds), draw the eyes, otherwise issue a bunch of 0 bytes to keep the screens empty, a la:

Code: Select all

if((millis() - lastTriggerTime) <= 5000) { // 5000 ms = 5 seconds
  ... existing Y/X drawing loops go here ...
} else {
  ... make a copy of the Y/X loops but just rig it so 'p' is ALWAYS zero ...
}
This is kinda hacky-kludgey-not-efficient but probably the least troublesome way to get it implemented in a hurry. The screens do have on/off commands (and if I recall correctly the TFT's have backlight a backlight control line), but this involves some deeper digging.

User avatar
mrhume
 
Posts: 18
Joined: Mon Dec 08, 2014 4:15 pm

Re: uncanny eyes with Teensy 3.1

Post by mrhume »

Wow, this is so much more than I was expecting. Thank you very much, once again!

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: uncanny eyes with Teensy 3.1

Post by pburgess »

Alternately...in the frame() function, you could use the last-triggered time to hold the eyes in a blinked shut state (like around line 332-ish, add one more condition to test if it's been >5 sec since last triggered). That might actually look a little better, since the eyes will now open when triggered rather than just appearing in open state. And it doesn't require messing with the eye-drawing code at all.

User avatar
chuckvideo
 
Posts: 22
Joined: Wed Mar 03, 2010 8:25 pm

Re: uncanny eyes with Teensy 3.1

Post by chuckvideo »

I've built a few Uncanny Eyes (both TFT and OLED) and I've put them into various masks I've found on sale at various Halloween stores over the past couple of years and the results are truly amazing. I've also built one with the joystick mod which allows me to manually "steer" the eyes in certain directions, and that brings up a question about a modification that I don't have the knowledge to pull off but I wanted to ask about to see if it's even possible. I'm curious if it would be easy enough to build a little circuit, maybe some sort of comparator, that would use a small handful of photocells placed around the skull and would allow the eyes to follow changes in light intensity, and thus make the eyes track someone as they cross in front of the eyes. That would increase the "creepy" factor immensely!

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: uncanny eyes with Teensy 3.1

Post by pburgess »

There's still lots of unused analog inputs on the Teensy board! Wouldn't require any sort of comparator circuit, but would need code to make sense of all the numbers from the photocells.

User avatar
flightrisk
 
Posts: 36
Joined: Wed Jan 19, 2011 2:54 pm

Re: uncanny eyes with Teensy 3.1

Post by flightrisk »

The instructions for the project say, Don't install "Adafruit_GFX, Adafruit_SSD1351 or Adafruit_ST7735" from the Teensy Installer. Is this still true If I install a Teensy today? I looked at the checked options and GFX and 7735 exist there, but Adafruit_SSD1351 isn't even in the list. There is one without "Adafruit_" in front of it, but there is no description when you click on it. And if I do have to leave them unchecked, what are the steps to install them using the library manager? You have to have specific URL's for each file, don't you?

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: uncanny eyes with Teensy 3.1

Post by pburgess »

Still true, yes.

Use the search field in the Library Manager, you can enter just 'GFX' or '7735' and it should turn up the right thing (or a very short list where the right item can be found).

User avatar
flightrisk
 
Posts: 36
Joined: Wed Jan 19, 2011 2:54 pm

Re: uncanny eyes with Teensy 3.1

Post by flightrisk »

Thanks. I think I have it all. There is also the teensy_ssd1351 library that says it is optimized for the Teensy 3.x. But I assume your eyes sketch doesn't use that, correct?

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: uncanny eyes with Teensy 3.1

Post by pburgess »

Correct, not used.

Issue is that Adafruit_GFX and Paul's optimized libraries have kind of diverged, so if you're not using a "matched set" of all one or the other, code might refuse to compile. Hopefully we'll get things synced up again in the future and this won't be a thing.

User avatar
flightrisk
 
Posts: 36
Joined: Wed Jan 19, 2011 2:54 pm

Re: uncanny eyes with Teensy 3.1

Post by flightrisk »

Are there any pictures of wiring to the Teensy? Have any of you used the male header and just cut off male to male ribbon cable jumpers on the OLED end so the displays will fit in a case? I know you mentioned using jumpers with a Pi. And all but one connection has to be doubled up, correct? So I guess that leaves having to solder directly to the board unless you jam 2 male jumper pins into each hole on the Teensy which I wouldn't necessarily mind doing if it works.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: uncanny eyes with Teensy 3.1

Post by pburgess »

Header pins are OK for breadboard use. If making something more permanent, I’d suggest wiring straight between Teensy and display(s). With 28 gauge ribbon cable it’s no problem fitting 2 wires in some of the holes.

Alternately, can use something like Perma Proto board to split out these connections.

User avatar
flightrisk
 
Posts: 36
Joined: Wed Jan 19, 2011 2:54 pm

Re: uncanny eyes with Teensy 3.1

Post by flightrisk »

Well, It would have been a helluva lot easier with SOLID core ribbon cable instead of stranded ;) But I LOVE it when something actually works out of the box the first time! The eyes in the OLDED's are stunning. Has anyone else said they prefer it WITHOUT the lenses? I will give it a try, but from close up anyway, it just seems distorted. Also, the field of view is cut in half. I would say any direction more than 45-50 degrees, the eyes just disappear due to the focusing effect of the glass/plastic. Without the lenses, you can see much further to the side.

This will be either in a tombstone as part of the front carving of a skull, or be in a skull a pirate skeleton will be holding. I have smaller glass lenses and the big 1.5 Acrylics. I guess I will experiment some more. Thanks so much Phil and everybody!

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: uncanny eyes with Teensy 3.1

Post by pburgess »

Pirate skeleton! Yarrrr! Glad to hear it's all working. :)

User avatar
Alex_Unknown
 
Posts: 4
Joined: Sun Oct 29, 2017 10:44 pm

Re: uncanny eyes with Teensy 3.1

Post by Alex_Unknown »

Telling me its too big? The Teensy 3.2 Board won't light up when it's plugged in as well as the button won't work . Please respond soon as this is my halloween costume!
Attachments
error message
error message
Screenshot 2017-10-29 19.52.22.png (217.89 KiB) Viewed 1262 times

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: uncanny eyes with Teensy 3.1

Post by pburgess »

Are you able to upload the Arduino 'blink' sketch to the board?

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”