Electronic – arduino – How to fade or delay a DC Signal to remove speaker “thump”/“click”/“pop” from transistor switch

arduinocapacitordcswitchestransistors

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).

schematic

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.

  • You are now feeding DC to your speaker. If you turn off the audio and turn on the transistor you will see the speaker coil move in or out and stay there until you turn the transistor off.
  • The DC is flowing from the battery through the base of the transistor and out the emitter to your speaker.

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.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. Switching speaker with relay.

How it works:

  • The GPIO goes high and a current of a few mA flows into Q1 base.
  • Q1 turns on and RLY1 is energised. The contact closes and the speaker is connected to the amplifier.
  • On switch-off D1 absorbs the inductive kick from the relay and prevents damage to Q1.

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.