2
\$\begingroup\$

Recently I've been working on a project involving outputting audio from the DAC line on an ESP32. I'm using a breakout board for the PAM8403 amplifier chip that does not expose the shutdown pin on the chip. While the amplifier is powered, there is constant noise coming from the speaker, so I want to have a way to power down the amplifier board when it isn't needed. That should help preserve battery life as well.

Initially I tried to use a BC547 transistor, but it caused the amplifier board to constantly reset. I was told that the transistor can't pass enough current to sustain the amplifier.

I have a very small assortment of other transistor-like components that I ordered from AliExpress, and was advised that the IRF740 MOSFET would be the best bet out of what I have on hand. I believe it's sufficiently rated for my needs, but the amp board is still resetting repeatedly (evidenced by the speaker making a rapid pop pop pop noise).

The PAM8403 chip has a shutdown pin, but the breakout board has it permanently attached to the 5V rail. My backup plan is to detach that pin and run a bodge wire to an unused (i.e. cut trace) terminal on the breakout board, and then connect that to the ESP32. I want to understand why the amplifier board is not properly responding to the MOSFET, though, and ideally I still want to be able to switch the board's power off with the MOSFET so that I don't have to do the bodge.

I feel it's important to point out that I am an absolute beginner when it comes to electronics. I can solder, but I can't explain why a given component is where it is or what value it should be. Please keep that in mind when answering.

I put together a rough schematic in KiCad and placed a screenshot below. The schematic isn't ideal because it represents the chip pins rather than the breakout boards the chips are attached to. I did my best on it. Some caveats:

  • The ESP32 is on a LILYGO TTGO T7 board, but the one pictured here is an Adafruit model in the schematic library.
  • I do not recall exactly which GPIO pin I've connected to the gate pin on the MOSFET. I just picked one in the diagram. The problem persists even if I run straight +5V to the gete pin.
  • The 1M resistor on the MOSFET gate may be overkill; it's just what I have in place right now. The problem persists with lower values of resistor.
  • The VDD and GND wire positions on the PAM8403 board may be incorrect - I don't know exactly how the breakout board has these connected.
  • The breakout board has the audio input ground bonded with the main ground. I'm told this isn't great, but that's the way it was built.

Schematic

\$\endgroup\$
9
  • 1
    \$\begingroup\$ Why do you have a 1M resistor in series with your MOSFET's gate? \$\endgroup\$
    – brhans
    Commented Jun 18, 2023 at 16:30
  • 1
    \$\begingroup\$ And an IRF740 is the wrong MOSFET to be driven directly by an ESP32. Its Vgs(th) is between 2V and 4V - so with only 3.3V from the ESP32 you're lucky if it's just barely turning on. \$\endgroup\$
    – brhans
    Commented Jun 18, 2023 at 16:33
  • 1
    \$\begingroup\$ If your attempt with the BC547 also used a 1M resistor then that would explain why it failed ... \$\endgroup\$
    – brhans
    Commented Jun 18, 2023 at 16:33
  • \$\begingroup\$ There are a lot of connections missing on the PAM chip. It can't work. If you simplified the schematics, don't, put the exact schematics you have to point out all and any issues. \$\endgroup\$
    – Justme
    Commented Jun 18, 2023 at 19:12
  • 1
    \$\begingroup\$ You can try to desolder and bend up pin 12 (/SHDN) and solder a small wire to the pin. A small fixing pin or needle below pin 12 while desoldering will help. \$\endgroup\$
    – Jens
    Commented Jun 18, 2023 at 21:15

1 Answer 1

3
\$\begingroup\$

Do not switch ground!

All inputs and output of the PAM IC will no longer be ground referenced and float up towards Vcc to varying degrees of impedance. This isn’t good.

If your amplifier lacks mute or EN pin and you need it, change to a different one which has it.

If there is noise when it should be silent, fix that.

If you do need to having to switch off an IC, do it on the high side with a P-channel MOSFET and pay attention to any exposed inputs which may still receive voltage higher than ground which may need attention in order to not pump up local Vcc for the IC via its body/protection diodes.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks for your helpful answer! I was hoping I would be able to finish this part with parts I have on hand, but if I need to switch the high side I'll have to buy something. Are you able to recommend a part that would work well? Also, can you explain what an "EN" pin is? The breakout board I'm using only exposes 5V in, ground, left/right in, and left/right out. \$\endgroup\$
    – Brandon
    Commented Jun 18, 2023 at 20:28
  • 1
    \$\begingroup\$ EN is short for enable pin. Often inverted to EN! to facilitate things In implementation and allows you to turn off an IC to save consumption. Assuming you have 3.3 V Vcc, you need a PMOS of at least (-)5 V Vds, less than 3.3 V Vgsth and high enough current capacity/low enough RdsON to not cause excessive voltage drop and max current consumption. You should have hundreds to choose from at DigiKey, Mouser, Farnell and the like. \$\endgroup\$
    – winny
    Commented Jun 18, 2023 at 20:53
  • \$\begingroup\$ Thank you! I'll have a look around and accept your answer in the mean time. I appreciate that you took the time to explain what's needed. \$\endgroup\$
    – Brandon
    Commented Jun 20, 2023 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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