Electronic Animated Eyes using Teensy 3.1

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
VukRayet
 
Posts: 8
Joined: Wed Sep 14, 2016 2:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by VukRayet »

Alright! Thanks so much for your help! (: I shall post again if I run into issues! Thanks again :D

User avatar
VukRayet
 
Posts: 8
Joined: Wed Sep 14, 2016 2:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by VukRayet »

Hey i'm back, teacher wants me to show it on a tft first before purchasing the OLEDS. I think I solved the previous error but now this pops up: http://BANNED.com/BEC1bAxs its a huge error code, I dont know what went wrong! Please help ):

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

Re: Electronic Animated Eyes using Teensy 3.1

Post by pburgess »

You're trying to compile it for an Arduino Nano. The code will only work on a Teensy 3.2; it relies on hardware-specific features of that board, including the extremely large flash memory space.

User avatar
VukRayet
 
Posts: 8
Joined: Wed Sep 14, 2016 2:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by VukRayet »

Hey the code works now! I realised that I forgot to change the board type to teensy 3.2 and deleted some repeating libraries. However, on my tft it has ports for sd cs and lcd cs, are they necessary? If so where do I pin them to? Thanks!

User avatar
michaelmeissner
 
Posts: 1831
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by michaelmeissner »

Note, the Adafruit pinout is somewhat different, in that it lists TFT_CS (presumably LCD CS in your display) and CARD_CS (presumably SD CS in your display).

SD cs is used to select the micro SD card (ignore, or wire to ground). The LCD cs is used to select the screen for SPI commands. I haven't wired up my uncannyEyes yet, but from the source, you would hook LCD cs to pin 9 for the left eye (SELECT_L_PIN) or pin 10 for the right eye (SELECT_R_PIN). There should be a DC or D/C pin that you would wire to pin 7, and a RESET pin that you would wire to pin 8, using the defaults in the source.

User avatar
VukRayet
 
Posts: 8
Joined: Wed Sep 14, 2016 2:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by VukRayet »

Ah ok, tft doesnt power up though, gotta figure out the wiring. I did:

TFT - TEENSY
5V-USB+
MISO - SPI MISO
SCK - SPI CLK
MOSI - SPI MOSI
LCD CS - PIN 9
SD CS - ignored
D/C - PIN 7
RESET - PIN 8
BL - ignored
GND - GND

Attached the arduino TFT io ports for reference. Thank you, I really appreciate all the help!

EDIT: Rookie mistake, made one whole teensy row connect with each other, going to solder pins to the teensy instead and use jumper wires instead.
Attachments
2016-09-19 13_55_27-Arduino - TFTtoBoards.png
2016-09-19 13_55_27-Arduino - TFTtoBoards.png (319.01 KiB) Viewed 1121 times

User avatar
michaelmeissner
 
Posts: 1831
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by michaelmeissner »

If your display requires 5v, you likely will need to do level shifting on all of the data pins, so that it receives 5v values (it may/may not register the 3.3v that the Teensy sends as high). This level shift may convert the pins to 5v (https://www.adafruit.com/products/395).

If your display can actually accept 3.3v-5v input, then you would connect one of the 3.3v pins on the Teensy to the display.

User avatar
VukRayet
 
Posts: 8
Joined: Wed Sep 14, 2016 2:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by VukRayet »

Powered the board up from a arduino (because no batteries or powerbanks available with me right now) and got it to switch on but display is very glitchy (many different coloured lines running across). I'm using a new set of jumper wires and soldering should be fine. Will it display even though the screen im using is a 162x128? Because thats only the dimensions right? Thanks

User avatar
michaelmeissner
 
Posts: 1831
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by michaelmeissner »

The code is setup for a 128x128 display rather than the more common OLED/TFT sizes (160x128, 128x64, 128x32, etc.).

User avatar
michaelmeissner
 
Posts: 1831
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by michaelmeissner »

FWIW, the Electronic Animated Eyes sketch works on a Teensy 3.6 (I have a beta unit, but my kickstarter units should arrive next week). I was using a ST7733 display. As I mentioned previously, you need to replace the Teensy version of the ST7733 library with the Adafruit version, since the uncannyEyes sketch uses some new features in the library.

The ST7733 displays that I have seem to work up to overclocking at 240 Mhz, but at all speeds that I tested, there is some flicker. I suspect however, if you go with the OLED version, you might have to drop it to 48Mhz just like you do with the Teensy 3.1/3.2.

User avatar
msargent
 
Posts: 15
Joined: Thu Aug 21, 2014 3:13 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by msargent »

VukRayet wrote:Powered the board up from a arduino
Hello,

I am curious how you set this up.

I am working on a project that I want to use an Arduino to trigger the Teensy to turn on the eyes based on motion detected by a PIR attached to the Arduino.

I am working on a Halloween project that will have a box with the Teensy Eyes inside and when the PIR detects motion nearby it will open a box using a servo (or re-purposed CD drive tray mechanism) and when the box is opening the Eyes will turn on. Then after a random amount of time, the lid will close and I want the Eyes to turn off.

I have the Eyes working and the CD drive tray triggered by the PIR working independently.

I was trying to figure out a good way to turn the Eyes on and off. I had tried using a transistor as a switch to open/close the power line connection to the Teensy from the OLED. However, once it turns off the first time the connection is opened, the Eyes will not turn back on when the connection is restored.

I saw your comment and it appears that you have got that working.

Any help - circuit wise would be appreciated.

Thanks,
Mike

User avatar
michaelmeissner
 
Posts: 1831
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by michaelmeissner »

Msargent, you didn't mention which display you have. If you have the 1.44" TFT display there is a pin ("LITE" in the Adafruit board, perhaps something else on a third party board) that is the control for the LED backlight. Normally, you would set tie it to the power line to turn the display on full power, but I believe if you set it to ground, it will turn off the backlight. So, you could attach a microprocessor pin to the LITE pin, and do a digitalWrite HIGH to turn on the display, and digitalWrite LOW to turn it off. You could also attach it to a PWM pin and use it to control the brightness.

I suspect if you have the OLED display, you can turn it on/off via the writeCommand option:

Code: Select all

  // turn off display
  for (int i = 0; i < NUM_EYES; i++
    eye[i].writeCommand (SSD1351_CMD_DISPLAYOFF);

  // ...
  // turn on display
  for (int i = 0; i < NUM_EYES; i++)
    eye[i].writeCommand (SSD1351_CMD_DISPLAYON);
But note, this is a guess after a brief glance to the library code.

User avatar
msargent
 
Posts: 15
Joined: Thu Aug 21, 2014 3:13 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by msargent »

I'm using the Adafruit 1.5" OLED display.

I've pruned a few lines out of the original code and have a little more space in memory so I will work on tying one of the output pins from the Arduino to a pin on the Teensy to see if I can use that to turn the eyes on/off.

Thanks for the tip!


Mike

User avatar
msargent
 
Posts: 15
Joined: Thu Aug 21, 2014 3:13 am

Re: Electronic Animated Eyes using Teensy 3.1

Post by msargent »

Michael,

Thanks again for the tip. Just a slight modification, the command is actually:

Code: Select all

eye[i].display.writeCommand (SSD1351_CMD_DISPLAYON);
Other than that and the normal bit to set the input pin and to read it, it worked like a charm!

Attached is a photo showing my prototype setup with the eyes off and the servo in a lowered state and with the eyes up and the servo in a raised state.

Now just need to add the second eye, build a box, make nice and scary and all will be done.

Thanks again for the help.


Mike
eyes.jpg
eyes.jpg (393.37 KiB) Viewed 1025 times

User avatar
cammi
 
Posts: 14
Joined: Sun Sep 27, 2015 8:59 pm

Re: Electronic Animated Eyes using Teensy 3.1

Post by cammi »

Hello! I'm making a build based off of this that would use two eyes using OLEDs. The page says:
If making two eyes, both displays need to connect to the same SPI MOSI and CLK pins on the Trinket, plus a few other wires. The “OC” or “TCS” pins are unique to each display, left or right.
This is probably obvious, but by Trinket do you mean the Teensy board? Do the two eyes then share the same pins for the SPI, MOSI, CLK, DC, and R and split between Pin 9 for left and Pin 10 for right?

Also a newbie question: If they do share that many pins, what's the best way to solder this? Are solder sleeves the way to go for pig tailing wiring or are there more space-efficient methods?

Thanks!

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

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”