5
\$\begingroup\$

I'm planning to build an automatic switch box for line inputs to my speakers. The switching itself seems fairly straightforward (a pair of de/multiplexers), but I don't know how to detect the audio signal, it should also not interfere with the signal itself.

The switch box will be controlled by an Arduino or something similar, as it needs to have some kind of timer so that it wont switch back and forth randomly if there are multiple inputs active.

So, how do I detect an active audio signal using an Arduino? (or similar) Will it interfere with the signal itself? How? How do I avoid that?

\$\endgroup\$
  • \$\begingroup\$ What is the source of the audio? \$\endgroup\$ – jippie Apr 2 '13 at 20:50
2
\$\begingroup\$

Detecting the signal - do you want to do it the hard way or the easy way - if the signal amplitude is in the order of 3 or 4 V peak-to-peak then it can be done the easy way using a couple of signal diodes, a couple of capacitors and a resistor. This would be fed via a Schmidtt trigger into an IO line. At a push the Schmidtt may be avoided if the logic levels are 3.3V.

The hard way means that the signals levels are lower than 3 or 4 volts peak-to-peak and an input amplifier needs to be inserted to boost the signal up to these sort of levels.

There are simpler audio detectors based around a couple of transistors and these might be suitable too but, due to their simplicity they may trigger on noise or crosstalk. These might be good enough though.

There are a few ICs that can apply large amounts of gain and then large amounts of compression to boost small signals to the same amplitude as larger signals and these could play a role.

None of the circuits described above will cause any appreciable deterioration of the original analogue signal but care would need to be taken when connections are made to audio lines.

The answers are all here (above) and to move further you need to do a little work on measuring the signal levels or opt for the more sophisticated system with gain so that small-ish signals can be detected and acted upon.

\$\endgroup\$
2
\$\begingroup\$

For anyone finding this:

Chinese shops like Aliexpress offer ready-made video and audio signal detection circuits for about 3 dollars. They have 4 ports (positive, ground, signal in, answer out as a high-low signal).

It even has built-in time delay that you can adjust with a small screwdriver.

I'll try using it to automatically switch on my music amplifier which, unfortunately, can only be turned on through the remote control or a modern push button that I can't hack so easily. Luckily, the infrared remote has dedicated on and off buttons, each with their own code.

\$\endgroup\$
1
\$\begingroup\$

If you've got ADC channels available, then you could use those. I'm assuming that these really are line level 1V signals.

Take the left hand of this circuit: http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/ : 10uF capacitor, voltage divider to bias input. Take audio samples at intervals. If there's no audio, the samples should be around a very small range of the middle (it won't be exactly constant due to noise). If there is audio, there will be more variation in samples. You can then experiment with where you want the cutoff to be between "very quiet audio" and "background hiss only, turn it off".

\$\endgroup\$
1
\$\begingroup\$

Here's a description of a circuit that doesn't require an Arduino. Instead, it has a pair of opamps in series, with the output energising a capacitor and powering a relay via a MOSFET when it has reaches a threshold voltage. Refer to circuit 1.

You could use the same circuit but ditch the MOSFET (Q1) and relay, and link the D5/C4/R11 connection to an Arduino digital input.

\$\endgroup\$
  • 2
    \$\begingroup\$ Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. \$\endgroup\$ – user17592 Oct 28 '14 at 11:36
  • 2
    \$\begingroup\$ 'Answer is not useful'? Really?? I agree it would be preferable, and if you look at some of my StackOverflow comments, I frequently point this out as well. But can you suggest what 'essential parts' I could include here? I could describe the circuit in words, but that would hardly be a complete answer. Unfortunately, reproducing any part of the diagram would violate copyright law, which, contrary to the 'no excuse' rhetoric in the SX answer you linked to, is a valid reason not to include it. And really, your link goes to one user's opinion, not SX policy. I look forward to your advice. \$\endgroup\$ – Michael Scheper Oct 28 '14 at 23:38
  • \$\begingroup\$ Essential parts for me could be for example a basic description of the idea behind the circuit. And in any case, if you don't think that you can make it essential without violating the copyright, you should make this a comment and not an answer. \$\endgroup\$ – user17592 Oct 28 '14 at 23:41
  • \$\begingroup\$ Sure—I can make it a comment instead, if that really would make it more useful. But in years of answering SX questions, I haven't come across this attitude before. Again, in the interest of me contributing effectively to this community, can you link to policy stating that links 'should' be in comments, and not answers? I want to ensure I haven't missed anything. Or is this just your opinion? \$\endgroup\$ – Michael Scheper Oct 28 '14 at 23:52
  • \$\begingroup\$ It's in the help center, over here: electronics.stackexchange.com/help/how-to-answer, (mainly) under 'context for links'. But this is network-wide, if you're unsure I'd take it to meta-SE or ask a moderator in chat. \$\endgroup\$ – user17592 Oct 28 '14 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.