Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Please Help! Custom UnCanny Eyes work request

  1. #1
    Junior Member
    Join Date
    Jan 2023
    Posts
    10

    Please Help! Custom UnCanny Eyes work request

    Hi All,
    I'm fairly new to this site and am trying to find help for an Uncanny Eyes project that I did years ago using the original setup. I created an escape room puzzle using Uncanny Eyes on a teensy 3.2 with two 128 displays for eye in a painting. A friend of mine at the time created an Arduino interface as I needed to be able to control the eyes from a remote location. The Arduino was controlled over a network and was controlled via simple http commands commands to the Arduino which in turn controlled the Teensy allowing me to do the following.
    - Eyes Closed
    - Eyes Open
    - Blink Once
    - Blink Twice
    - Look Up for 2 seconds
    - Look down for two seconds
    - Roll eyes twice
    - Complete a sequence of eye movements to spell out a word based on letters around the painting
    - Reset the eyes

    I have no idea how he did this as I am not great at coding, just building. I have lost touch with him now and can't get him to come look at it.
    Now this puzzle has been in place for approximately 3.5 years and always worked great until recently. One of the eyes stopped working complete and the other had some dead pixel lines in it. So I replaced both screens for new identical ones and it worked for a little while but now one eye is being temperamental and sometimes works and sometimes doesn't. I have narrowed the issue down to the teensy as when I reset the Arduino it makes not difference but if I reset the teensy the eye will work for a while.
    I had looked at just replacing the teensy but I have been unable to source a 3.2 to replace like for like and I also don't know if there were any changes made to the original code to allow the Arduino to control the teensy.

    What I would ideally like to do is to replace the control system with just a teensy that has an ethernet adaptor and have the code adapted to enable the teensy to respond to http commands and to control the eyes directly without the arduino in-between.

    Is this something that anyone here could help with? I am happy to pay for your time in adapting this code and advising on what teensy version I should use.

    Thanks all in advance for your help on this project.
    Nick

  2. #2
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    1,135
    You could use a Teensy 4.1 which has Ethernet hardware built in.
    You are going to get some proficiency in coding.
    Do you have the code (source) for the 3.2 and Arduino?

  3. #3
    Junior Member
    Join Date
    Jan 2023
    Posts
    10
    No I donít. The teensy code is just the original code I think from the original adafruit project. I donít have the arduino code. This is why Iím looking for someone to adapt the coding for me please.

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,384
    Quote Originally Posted by nascave View Post
    No I don’t. The teensy code is just the original code I think from the original adafruit project. I don’t have the arduino code. This is why I’m looking for someone to adapt the coding for me please.
    We have the original Adafruit code, but we don't have the mods done. The original code is very limited in what you could do the eye:

    • Blink both eyes, or wink just one;
    • Move the eyes horizontally and vertically (typically via joystick);
    • Grow/shrink the iris size (typically via a light sensor).


    The original code had 10 different eyes for 128x128 displays. When we moved to the 240x240 displays, only one eye pattern was converted. The new code from Chris.nz that uses the more recent Adafruit code (post Teensy), and you now can rotate between 19 different eyes on a Teensy 4.1. Chris.nz also added code to use the Person Sensor from Useful Sensors to track people and have the eyes follow them around the room.

    Chris.nz is the main person that has dived into the actual way the eyes have been done and he/they/she has been talking about ways to improve it in the future. I and others have mostly made changes around the edges, to adapt the eye code to different displays, add various other options (sound, neopixels).....

    So I imagine in your Teensy, there is a state machine on the mode to do the actions in a sequence, rather than just use sensors to control the eyes. The state machine would take the ethernet commands, and in the main loop, it would do those modifications in order. It is somewhat straightforward (note, I didn't say easy), since there don't appear to be new actions to the eyes, just a sequence to use the existing actions.

    Given you want to use ethernet, the Teensy 4.1 would be the natural board to use (assuming Teensy 4.1's are available with the ethernet PHY chip). Paul has been saying that unlike the Teensy 3.2, 3.5, or 3.6, he is getting chips on a regular basis, but there may be times when it is sold out. I know though at times, the ethernet PHY chips were hard to find. There are other ways to add ethernet to the Teensy, so that may not be a hard issue.
    Last edited by MichaelMeissner; 01-05-2023 at 06:01 PM.

  5. #5
    Junior Member
    Join Date
    Jan 2023
    Posts
    10
    Iím not sure but I think the arduino was pretending to be the joystick with a series of commands. I could try and locate the code if that would be of any help?

  6. #6
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,384
    Quote Originally Posted by nascave View Post
    I’m not sure but I think the arduino was pretending to be the joystick with a series of commands. I could try and locate the code if that would be of any help?
    If you have the Arduino as a secondary board, then it should be easier to plug it into a Teensy 4.0/4.1 without too much modifications using the new eyes (i.e. if you have the Arduino, it should be simple to modify one of the existing Uncanny Eyes to use the same pins that the Arduino is producing). I was thinking you wanted an all-in-one solution where the Teensy did the controls internally and also talked on ethernet. That can be done, it is just more programming.

    So yes, if you can find the source to the Arduino program, it would be helpful.

    Note, in terms of Teensy 4.0 vs. 4.1, to do two eyes, you really want Teensy 4.1 since all of the pins needed for the 2nd eye are easily to use. With a Teensy 4.0, you have to solder at least 2 pins under the Teensy to get access to the SCLK and MOSI for the 2nd SPI controller.

    Note, the 240x240 displays are somewhat slower than the 128x128 displays. This is due to more data that needs to be sent to the screen, and also the original Uncanny Eyes used some special optimizations available in Teensy 3.2/3.5/3.6's, but not as available in Teensy 4.0/4.1 (but the 4.0/4.1 have other optimizations).

    There are 2 main 240x240 displays. One uses a square board with the ST7789 controller, and the other uses a round board with the GC9A01A controller.

  7. #7
    Junior Member
    Join Date
    Jan 2023
    Posts
    10
    Ideally I wanted to create an all in one solution rather than having the arduino as well. Is this a big job to program?
    Would a teensy 4.1 not work with the original
    1.5 inch 128x128 OLED Screens that I have then? Would I have to upgrade them?

  8. #8
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,384

    Cool

    Quote Originally Posted by nascave View Post
    Ideally I wanted to create an all in one solution rather than having the arduino as well. Is this a big job to program?
    Would a teensy 4.1 not work with the original
    1.5 inch 128x128 OLED Screens that I have then? Would I have to upgrade them?
    There are several things to consider.

    Yes, the Teensy 4.1 can do it all in one program, but it is more complex to integrate to what your Arduino is doing and do it all in the Teensy. If you needed something immediately however, what I'm saying it is simpler just to use the Arduino to provide the same imputs (x, y, blink/wink, and light sensor). That way you just need to wire up a Teensy, change the pin wires for the display, enable the sensor inputs, and hook them up to the arduino.

    What is the exact Arduino that you are currently using? If it is one of the older ones, then it likely runs at 5 volts. The Teensy 3.2 could deal with inputs greater than 3.3v volts, but the Teensy 4.1 cannot. This adds an extra complication I hadn't thought about. There are ways to deal with this, but it will involve more wiring and such.

    Doing it combined means you have to add the stuff for reading from the ethernet, and modify the logic of the program replace reading the sensor. It is just more programming. Long term this is the way to go, but again, it just takes a bit longer to do, and you need somebody who is familiar with coding.

    Now in terms of display, the original Uncanny Eyes cannot be run on Teensy 4.x. There are ports of the code that runs on the Teensy 4.x. However, these ports will likely be slower on the Teensy 4.x, since Uncanny Eyes used some internal optimizations that are available on Teensy 3.x but are not on Teensy 4.x. It's been awhile since I ran the 128x128 displays on a Teensy 4.x, so I don't remember the numbers. Whether it is still usable even though it is slower, I don't know, only you would be able to say. If I have time tonight, I might do a test.

    And the 240x240 displays can't be run on the Teensy 3.x processors, since the display frame takes up so much space.

    So personally, I just have different Teensys set up. I have a Teensy 3.2 with 2 TFT displays, I have a Teensy 3.5 with 2 OLED displays, I have a Teensy 4.1 with 2 of the square 240x240 displays, and I have a Teensy 4.1 with 2 of the round 240x240 displays.

    The 128x128 TFT displays are now quite dim, and nearly hard to read (I think I've had those displays at least 5 years, maybe more). I keep meaning to replace them, but I always have other things to buy when I'm doing parts shopping.

    The 128x128 OLED displays look better, but I had to do some tuning to get to display properly without glitching (turning down the speed of the SPI bus).

    The 240x240 square displays are nice. The square displays come in 2 variations, one with a CS pin, and one without. 2-3 years ago, the market seemed flooded with the non-CS pin variants, but the last time I did an ebay search, there were a lot fewer displays.

    The 240x240 round displays don't have the edges and might be more ameniable to put in cosplay props. But the round displays are fragile. I've had to replace a few.

    It might be helpful to completely show us what your setup is, including the Arduino, etc. If you can post one or more pictures of the wiring between the Arduino and Teensy, and to the displays it would be helpful. As would posting a video to show the eyes in action.

    Again, if you can get the Arduino code, that would be helpful.
    Last edited by MichaelMeissner; 01-05-2023 at 11:28 PM.

  9. #9
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,384
    FWIW:

    • Using Chris.nz's latest code with the 240x240 square ST7789 displays on a Teensy 4.1, I get about 20 frames/second on the hazel eyes;
    • Using Chris.nz's latest code with the 240x240 round GCA01A displays on a Teensy 4.1, I get about 35-40 frames/second on the hazel eyes;
    • Using the original Uncanny Eyes with the 128x128 TFT display on a Teensy 3.2, I get about 60 frames/second on the standard eyes (hazel);
    • Using the original Uncanny Eyes with the 128x128 OLED display on a Teensy 3.5, I get about 37 frames/second on the standard eyes (hazel);
    • Using the modified version of the Uncanny Eyes with the 128x128 TFT display on a Teensy 4.1, I get about 9 frames/second.


    Note:

    • The original TFT/OLED driver essentially talks to the device directly, optimizing stuff for the Teensy 3.x architecture, while the Teensy 4.x versions use the general display driver to update the screen and probably in the case of the 128x128 displays is not optimized. As I said, one of the special optimizations used in the original Uncanny Eyes is not available on the Teensy 4.x (where the CS and D/C pins are from a select few pins, and the dma hardware can optimize the settings).
    • The 128x128 TFT screens run with a SPI bus speed of 20Hz, while for the OLED screens run at 11Hz. But there is still flickering going on. The OLED screens have to run at a slower bus speed than the TFT. The two 240x240 displays, I can run at 90 Hz.
    • As I said, the 128x128 TFT display are really dim with the Teensy 3.2. The display is brighter with the Teensy 4.1, but one eye has a blue color.
    • I suspect the way fps is calculated is different between the 128x128 and 240x240 screens.

  10. #10
    Junior Member
    Join Date
    Jan 2023
    Posts
    10
    I have managed to find the folder with the original Arudino code. How do I post it here?

  11. #11
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    1,135
    Copy the code, assuming you are using Windows, highlight the code, right click on the highlighted code and press copy.
    Press the # button at the top of the Teensy Reply Form.

    [ CODE][/CODE] will appear. Paste your code between the two ][ square brackets. It can be difficult to get between those ][
    so to ensure that you have got in between them simply press the space bar.

    If a space appears in the correct place then you can go ahead and paste the code.
    If the space did NOT appear in the correct place then remove it and try again.

    After you have pasted your code and finished your entry, press the "Go Advanced" button.

    This will show you how your reply will appear and also allow you to continue editing it until it is just right for you.
    Press the "Submit Reply" button to do just that.

  12. #12
    Junior Member
    Join Date
    Jan 2023
    Posts
    10
    The code has multiple pages though. Do I have to post all of them separately?

  13. #13
    Junior Member
    Join Date
    Jan 2023
    Posts
    10
    Is anyone prepared to work on writing all the required code into a teensy for a fee?

  14. #14
    Junior Member
    Join Date
    Jan 2023
    Posts
    10
    Guess not

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •