Electronic – How to build a timed audio switch


I want to build a simple device with 2 inputs and 1 output, all TRS 1/8" audio jacks. The device picks one of the inputs to pass through to the output depending on the time of day (at night, it chooses B, but for the rest of the day it chooses A).

How would I go about doing this?

For completeness, it's for a stereo that is inaccessible almost all the time. By default it plays (through speakers) from the radio. I want to attach this device between the stereo and the speakers, and plug in a simple FM receiver (configured to some unused frequency), so that at night I can transmit over FM to control the speakers. If there's an easier way, please do tell, but consider the stereo+speakers locked away after I install the device, so I need to be able to transmit audio wirelessly to the speakers while falling back on the stereo's output.

Best Answer

A set of relay switches hooked up to a real time clock and calendar (RTCC) on a MCU could do it: Set the date and time in the MCU's RTCC peripheral. Make sure it is hooked up to a relatively accurate e.g. 32kHz crystal (if you can't get at it, the clock will drift). Have it wake every 12 hours, switch off one channel's relays using a driver that can handle the current, and then switch on the relays for the other channel. Make sure not to have both relays connected at the same time; I'd use a 100ms delay between turning one off and turning one on, YMMV. A single relay that could do the whole trick, or two double pull single throw relays like in my schematic would work best, but I included the link to the Hamlin relay because I have used it and I am familiar with it.

RTCC's are cool because you can use real times and dates, so the programming is pretty intuitive, and you can get fancy and have it change switching times throughout the year (to match sunset times for example) and you can have it correct for daylight savings. Just make sure to mind your power usage if you are only using batteries, and you should have it hooked up to a backup battery if you are powering off the AC, or you will lose the time when the power goes out, which is a bummer.

Please note that the 1k resistors were picked to demonstrate that a limiting resistor will probably be needed, and not to say that is the correct value or resistor.


simulate this circuit – Schematic created using CircuitLab