Mute PAM8302 amp with Raspberry Pi












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!










share|improve this question













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















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!










share|improve this question













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












0








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!










share|improve this question














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!







python






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 2 at 18:52









Nik I.Nik I.

31




31




migrated from superuser.com Feb 2 at 20:41


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









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



















  • 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

















GPIO pin that starts low .... are you sure that it starts low?

– jsotola
Feb 2 at 21:41





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





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





that measurement is taken with the PAM8302 connected?

– jsotola
Feb 3 at 19:04










1 Answer
1






active

oldest

votes


















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.






share|improve this answer
























  • 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






StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "447"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f93788%2fmute-pam8302-amp-with-raspberry-pi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









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.






share|improve this answer
























  • 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
















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.






share|improve this answer
























  • 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














0












0








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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 2 at 22:27









MilliwaysMilliways

29.8k1355116




29.8k1355116













  • 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



















  • 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

















Thank you!! I'll give it a go and report the result.

– Nik I.
Feb 3 at 17:54





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





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


















draft saved

draft discarded




















































Thanks for contributing an answer to Raspberry Pi Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f93788%2fmute-pam8302-amp-with-raspberry-pi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido