I have an audio amplifier that draws about 200-300mA max that I would like to switch on/off using either an I/O line or a the switch pin from the headphone connector. I was thinking about using an npn transistor or an N-type FET but I've never really done anything like that before so I was hoping for some tips.

The I/O is from an ATTINY85 and the amplifier I'm switching is an LM386

Very basic schematic enter image description here

  • \$\begingroup\$ What is the part# of the device with the I/O that will be driving the switch? What is it's supply voltage? \$\endgroup\$ – Tut Nov 11 '13 at 18:07
  • \$\begingroup\$ ATTINY85 (5V) - added some more info above too. Thanks \$\endgroup\$ – spizzak Nov 11 '13 at 18:43

My preference is to switch the high side.


simulate this circuit – Schematic created using CircuitLab

Look for a P channel MOSFET with a low \$V_{th}\$. The NPN transistor could be substituted with a logic level N channel FET if desired.

  • \$\begingroup\$ Thanks that makes sense, but why not drive M1 directly from the GPIO? \$\endgroup\$ – spizzak Nov 11 '13 at 17:48
  • \$\begingroup\$ @spizzak, in order to turn M1 off, the gate voltage (middle pin) must be near the source voltage (top pin), and the GPIO can only supply 3.3 or 5 V. Q1 allows us to switch the M1 gate voltage between 6V (off) and ~0.2V (on) from the GPIO pin. We still need M1 because R1, which we need to prevent shorting the supply when Q1 is on, limits the current available. \$\endgroup\$ – Theran Nov 11 '13 at 18:06
  • \$\begingroup\$ It's also worth noting that if you end up needing to supply your amplifier a higher voltage, this circuit scales with no changes until you get to significantly higher voltages. \$\endgroup\$ – Matt Young Nov 11 '13 at 18:08
  • \$\begingroup\$ I also have a physical switch from a 3.5mm audio jack that I could use instead of the I/O. Would that be easier? Something like this: i.imgur.com/7c3j6xE.jpg \$\endgroup\$ – spizzak Nov 11 '13 at 18:31
  • \$\begingroup\$ @spizzak I'm not sure I follow what you're thinking. \$\endgroup\$ – Matt Young Nov 11 '13 at 23:55

Just put the transistor between GND pin of the IC and the GND line. Connect your switch signal to its base/gate. Whenever you receive 6V in the base/gate pin, it will act as a closed switch.

Note that you should have a switch signal which varies from 6v to 0v instead of 6v and floating. This way you can make sure that when it has 0v, the switch is closed. If you choose a bjt instead of mosfet, make sure to calculate a reasonable value of resistor to put between the switch signal and the base pin, so the Ib current will be enough to induce the necessary current on Ic.


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.