NFG Forums => Audio Mods => Topic started by: micro on December 18, 2015, 03:06:41 AM

Title: automatic 8-to-1 Toslink Switch
Post by: micro on December 18, 2015, 03:06:41 AM
Here's another little project which I've finished recently. It's an automatic 8-to-1 Toslink switch. :)

( (

Key features:
( (

Gerber/HEX files:
Unfortunately I can't provide you with bare or assembled PCB's. But you can use the attached gerber files to order the PCB yourself. The PCB's dimensions are 70 mm x 50 mm.

The microcontroller on the PCB has to be flashed with the appropriate HEX file (also attached to this post), or the toslink switch won't work at all. The fuse bytes don't need to be altered. (Factory-set fuse bytes: Low Byte = 0x62; High Byte: 0xDF)

Please keep in mind that the gerber files and the hex file are intended for your personal, non-commercial use only!

Parts list:
You might have a hard time sourcing the needed parts, especially the Toslink receiver and transmitter sockets. Anyways, here's a list of the parts needed with german shopping links.

Qty Name in schematic Description Package Where to buy (in Germany)
1IC1Atmega48A microcontrollerTQFP32;ARTICLE=121828;GROUPID=2959;PROVID=2794&wt_mc=amc14291660253544&zanpid=2107875674806510592 (;ARTICLE=121828;GROUPID=2959;PROVID=2794&wt_mc=amc14291660253544&zanpid=2107875674806510592)
1:8 Mux
11C1 - C11100 nF ceramic capacitor0805 (
1C12100 uF electrolytic capacitorpitch: 2,5 mm
diameter: 6 mm (
9RL1 - RL9330 Ohm resistor0805 (
1RRST10 kOhm resistor0805 (
8LED1 - LED8red SMD LED0805 (
1LED9green SMD LED0805 (
8IN1 - IN8Sharp GP1FA551RZ
Toslink receiver
- (
1OUTSharp GP1FA551TZ


PL131 Toslink transmitter
- (

or (
1S1DIP switch- (
1S2tact switch6 mm x 6 mm (
1PWR_SWApem 5236WWA-7 toggle switch- (
1USB1SMD Mini USB socket- (
1-adhesive rubber feetdiameter: 8 mm (

More informations:
On the german circuit-board forums you can find another thread covering this Toslink switch:
Title: Re: automatic 8-to-1 Toslink Switch
Post by: NFG on December 20, 2015, 07:39:57 AM
That is really quite cool, thanks for sharing it. 
Title: Re: automatic 8-to-1 Toslink Switch
Post by: micro on December 30, 2015, 04:30:14 AM
Thanks!  :D

It's kinda strange that there aren't any cheap automatic Toslink switches available as detecting an active source is quite easy.

In case someone wants to know how the detection works:
When there's no active source connected to the Toslink receivers, then the output level of the receivers will be uncertain. It could be 0V or 5V. (Or even toggle at some point.) But IF there's an active source connected, the receiver's output will toggle all the time.

By using the microcontrollers pin change interrupt capability it's convenient to detect if the Toslink receiver's ouput has been toggled. Just wait a certain time (currently 200 us) and check the appropriate flag. If there really has been a change, a counter gets incremented. Repeat the procedure a number of times (currently 50 iterations). After that the counter is evaluated. If the counter is above a certain threshold (currently 70% => 0.7 * 50 iterations = 35), then this Toslink input is treated as active. :)
Title: Re: automatic 8-to-1 Toslink Switch
Post by: Slick on April 07, 2017, 04:07:41 AM
Wow, this is really great!

I haven't checked the forum post you've linked yet (my faith in online translators is small) - what device did you use to flash the hex file?