0

I'm using a PAM8302 amplifier with a Raspberry Pi Zero W and it's working great. However, I'd like to start the amp muted and then unmute it from a Python script. Per documentation, PAM8302 goes into shutdown when the shutdown pin is connected to ground and I verified that by connecting it to RPi's ground. I tried connecting the shutdown pin to a GPIO pin that starts low and one that starts high (measured ~0V and 3.3V respectively), and neither mutes the amp. If I hook it up to ground it mutes, but I can't unmute it, since ground pins aren't controllable. Is there a way I can have programmatic control over the mute function? The only way I can think of is using a relay, but I'd rather avoid it if at all possible.

Thanks!

migrated from superuser.com Feb 2 at 20:41

This question came from our site for computer enthusiasts and power users.

  • GPIO pin that starts low .... are you sure that it starts low? – jsotola Feb 2 at 21:41
  • I measured the voltage between the pin and ground and it was hovering around 0.3mv – Nik I. Feb 3 at 17:54
  • that measurement is taken with the PAM8302 connected? – jsotola Feb 3 at 19:04
0

All GPIO pins start as inputs by default. This is normal for most similar devices.

NONE start as outputs, low or high, although the input pins may have a pull-up or pull-down.

The Device Tree can be used to change pin assignments shortly after boot. This is often used to enable the serial interface etc.

To configure a pin as output you need an appropriate Device Tree overlay.

The gpio config can be used to set the configuring pins at "boot" time - actually some short time after boot.

  • Thank you!! I'll give it a go and report the result. – Nik I. Feb 3 at 17:54
  • It worked!! I edited /boot/config.txt and added gpio=26=op,dl where 26 is the GPIO pin connected to the amp's shutdown pin. It mutes it in less than a second after power is supplied to the board. Thank you for your help! – Nik I. Feb 5 at 1:41

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.