I'm trying to create a digital audio switch or relay using an Arduino nano.
It's a very simple circuit, it's just a gate (transistor) which is operated by a digital signal (computer) through a microprocessor (Arduino nano).
I have a NPN transistor working as a switch, which receives the audio signal (at the collector) and receives a 5v signal from the Arduino (at the base) to open the gate and then send (at the emitter) the audio signal to the speaker. It works fine, except for the noise ("click" or "pop") that is heard when the gate opens. I did some research and it seems that a capacitor could open the gate slowly (fading in) eliminating the noise.
I've tried some types of ceramic capacitors and I'm not sure if I'm doing something wrong or using the wrong capacitor, but so far I had no results.
I guess it would be just like fading in a LED from a 5V signal passing through a transistor. Could anyone help me?
Thanks a lot!
Ian
Below is an attempt of a schematic, my apologises if it's not very accurate (I'm a musician).
simulate this circuit – Schematic created using CircuitLab
Best Answer
I'm surprised that you don't hear a lot of distortion when you turn on this circuit. There are a few problems.
Usually it's best to mute the audio at 'line' level before it gets to the amplifier. Alternatively use a relay energised by your micro to connect and disconnect your speaker.
simulate this circuit – Schematic created using CircuitLab
Figure 1. Switching speaker with relay.
How it works:
Depending on your amplifier you may still hear a click or thump in the speaker. This is usually caused by the amplifier output capacitor discharging through the speaker. Putting 100 \$\Omega\$ or so between AMP+ and AMP- will discharge the capacitor before the relay contact closes and prevent the thump.