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

Thread: Teensy 4.0 - Toslink optical output

  1. #1
    Junior Member
    Join Date
    Jan 2020
    Posts
    3

    Teensy 4.0 - Toslink optical output

    A 2015 forum thread discussed S/PDIF Toslink output with the Teensy 3.1. One of the options discussed was simply adding a red LED, connected to pin on the Teensy, with a resistor to limit brightness, and point it at the end of the fiber optic connector. I would like to try this with a Teensy 4.0 and the current audio library.

    With Teensy 4.0 what is the correct pin to use?

    My goal is to extend the Teensy 4 Audio board's 3.5mm stereo output jack into a dual analog / digital jack using a mini Toslink format plug that is also 3.5mm. (Google did this in their Chromecast Audio device).

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,535
    output_spdif (I2S used as SPDIF) : Pin 7
    - and/or -
    output_spdif2 (I2S used as SPDIF): Pin 2
    - and/or -
    output_spdif3 (SPDIF hardware): Pin 14

    Attention I have not used them for a log time and some Teensyduino versions. I hope it still works.

    The LED has to be really bright - I used a LED from a old optical mouse. It is not very reliable: You must have a mechanically stable connection, and the LED must shine straight (0 angle) into the optical cable.
    Much better is a toslink.

  3. #3
    Junior Member
    Join Date
    Jan 2020
    Posts
    3
    Thanks for the reply but no luck so far. This is what I have done.
    1) Using a Teensy 4.0 board (not 3.1) and the Teensy 4 audio board (Rev D)
    2) running Teensyduino 1.49 (Arduino 1.8.10)
    3) using software "Example > Audio > WavFilePlayer" (ran with no change and verified that song played from 3.5mm analog jack.)
    4) modified the WavFilePlayer.ino to comment out line 36 AudioOutputI2S... and uncomment line 37 AudioOutputSPDIF...
    5) tried hooking up both a regular LED and also purchased an Everlight PLT133/T8 (https://www.mouser.com/ProductDetail/638-PLT133T8) toslink transmitter. I have hooked this up with wires to the GND, 3.3V VCC, VIN to the various pins mentioned and no luck getting anything to light up.

    Given the software and hardware I'm using, should this work, and if so what pins should I use?

    Thanks.

  4. #4
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,535
    Quote Originally Posted by etan22 View Post
    Thanks for the reply but no luck so far. This is what I have done.
    1) Using a Teensy 4.0 board (not 3.1) and the Teensy 4 audio board (Rev D)
    2) running Teensyduino 1.49 (Arduino 1.8.10)
    3) using software "Example > Audio > WavFilePlayer" (ran with no change and verified that song played from 3.5mm analog jack.)
    4) modified the WavFilePlayer.ino to comment out line 36 AudioOutputI2S... and uncomment line 37 AudioOutputSPDIF...
    5) tried hooking up both a regular LED and also purchased an Everlight PLT133/T8 (https://www.mouser.com/ProductDetail/638-PLT133T8) toslink transmitter. I have hooked this up with wires to the GND, 3.3V VCC, VIN to the various pins mentioned and no luck getting anything to light up.

    Given the software and hardware I'm using, should this work, and if so what pins should I use?

    Thanks.
    Why the audioboard ? Pins, see post before.. is the SPDIF-LED lit?
    On the PLT133, you must connect GND to GND, PLT133-VCC to 5V and PLT133-VIN to the Spdif-pin.
    Do NOT use any pin that is used by the mounted audioshield.
    You can NOT use I2s AND a Spdif that uses the same pins of I2S, of course.

  5. #5
    Senior Member
    Join Date
    Feb 2017
    Posts
    365
    I've used this board for TOSLINK in and out. It does TOSLINK <--> I2S conversion for you. So, it interfaces to the Teensy using I2S.
    https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1

  6. #6
    Junior Member
    Join Date
    Jan 2020
    Posts
    3
    First of all, thank you Frank B for your help. (also gfvalvo for your alternate hardware suggestion)

    It is working now. Using both Everlight PLT133/T8 connector and a simple 3mm red diffused LED with the Teensy 4.0 and Rev D audio board.

    I was overly focused on Pin 14 which is listed as S/PDIF out on the Teensy 4.0 pin diagram and not really understanding your comment "You can NOT use I2s AND a Spdif that uses the same pins of I2S, of course". But the correct pin to use with this hardware / software was pin 7.

    For the LED just connecting anode to pin 7 and the other leg to ground worked.

    For the PLT133/T8, VCC to either 5 or 3 volts, VIN to Pin 7, and GND to GND worked. (I had the outside legs reversed on my first round of tests, this caused the follow up question)

    What I was curious about was if I could put a red LED into the back end of the 3.5 mm stereo jack on the audio board and then use a MINI TOSLINK* connector as an alternate plug into the same jack to get digital or analog output. In my initial testing this seems to work fine. The 3mm LED slides 2-3 MM into the open back end of the audio jack and is held in place by the opening (a 5mm LED might fit better).

    While this "hack" seems to work fine, it may be as Frank B. said "Much better is a toslink [connector]".
    Click image for larger version. 

Name:	minitoslink.png 
Views:	8 
Size:	777.7 KB 
ID:	18815

    * Mini TOSLINK is a smaller 3.5 mm alternative connector (https://www.amazon.com/dp/B07SL5DM5X)

Posting Permissions

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