0

Electronic Animated Eyes using Teensy 3.1
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Electronic Animated Eyes using Teensy 3.1

by VukRayet on Thu Sep 15, 2016 3:07 am

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

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

Re: Electronic Animated Eyes using Teensy 3.1

by VukRayet on Fri Sep 16, 2016 4:35 am

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://pastebin.com/BEC1bAxs its a huge error code, I dont know what went wrong! Please help ):

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

Re: Electronic Animated Eyes using Teensy 3.1

by pburgess on Fri Sep 16, 2016 2:19 pm

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.

pburgess
 
Posts: 3782
Joined: Sun Oct 26, 2008 2:29 am

Re: Electronic Animated Eyes using Teensy 3.1

by VukRayet on Sun Sep 18, 2016 11:25 pm

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!

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

Re: Electronic Animated Eyes using Teensy 3.1

by michaelmeissner on Mon Sep 19, 2016 1:12 am

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.

michaelmeissner
 
Posts: 1311
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

by VukRayet on Mon Sep 19, 2016 1:56 am

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 313 times

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

Re: Electronic Animated Eyes using Teensy 3.1

by michaelmeissner on Mon Sep 19, 2016 10:12 am

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.

michaelmeissner
 
Posts: 1311
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

by VukRayet on Wed Sep 21, 2016 3:43 am

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

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

Re: Electronic Animated Eyes using Teensy 3.1

by michaelmeissner on Wed Sep 21, 2016 7:49 am

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

michaelmeissner
 
Posts: 1311
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

by michaelmeissner on Sat Oct 01, 2016 1:07 am

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.

michaelmeissner
 
Posts: 1311
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

by msargent on Mon Oct 03, 2016 3:24 pm

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

msargent
 
Posts: 9
Joined: Thu Aug 21, 2014 3:13 am

Re: Electronic Animated Eyes using Teensy 3.1

by michaelmeissner on Mon Oct 03, 2016 4:03 pm

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 | TOGGLE FULL SIZE
  // 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.

michaelmeissner
 
Posts: 1311
Joined: Wed Aug 29, 2012 12:40 am

Re: Electronic Animated Eyes using Teensy 3.1

by msargent on Tue Oct 04, 2016 5:27 am

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

msargent
 
Posts: 9
Joined: Thu Aug 21, 2014 3:13 am

Re: Electronic Animated Eyes using Teensy 3.1

by msargent on Wed Oct 05, 2016 12:56 pm

Michael,

Thanks again for the tip. Just a slight modification, the command is actually:
Code: Select all | TOGGLE FULL SIZE
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 217 times

msargent
 
Posts: 9
Joined: Thu Aug 21, 2014 3:13 am

Re: Electronic Animated Eyes using Teensy 3.1

by cammi on Tue Oct 11, 2016 11:54 am

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!

cammi
 
Posts: 13
Joined: Sun Sep 27, 2015 8:59 pm

Please be positive and constructive with your questions and comments.