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.