How to power a speaker on and off

Thread Starter

Raptorist

Joined Apr 6, 2021
6
Hello everyone, first post here. I am very much out of my element [I am a mathematician/computer scientist] so apologies if this thread doesn't belong under "Power control".

I would like to realise a home assistant similar to Alexa or Google home using a Raspberry pi as a host, Mycroft as software and a microphone and speakers for input-output.
After reading a bit, I learnt that regular speakers aren't meant to be powered 24/7 as this would quickly wear them out, but rather be powered on when needed and then turned off again.
I currently have a standard speaker with an on/off button [not a switch] that can be powered through USB.
My question is the following: is it possible to modify the speaker in a way that allows a raspberry pi to turn it on and off on demand? If so, how?

As far as my effort towards the issue is concerned, so far I read through the forum's online textbook and I kinda got a blurred picture of how it *might* work, namely that the speakers will have an amplifier inside that has a control pin which turns the speakers on and off, so I need to connect to that pin from my Raspberry pi and control it. I hope this isn't too much nonsense as I have barely any idea what I'm talking about :D

Thanks in advance for any help!
 

wayneh

Joined Sep 9, 2010
17,498
... is it possible to modify the speaker in a way that allows a raspberry pi to turn it on and off on demand? If so, how?
Yes, this could be accomplished fairly easily using a MOSFET, a type of transistor that can be used like a switch. Your Pi would supply a digital (on or off) signal to the gate of MOSFET and it would in turn switch the USB power to the speaker.
 

Ya’akov

Joined Jan 27, 2019
9,141
A little research into Mycroft raises some confusion. The default setup is an analog speaker connected to the RPi 3.5mm audio jack. This would not be a candidate to be "powered off", or on for that matter. What speaker are you using that you need to power on and off?
 

wayneh

Joined Sep 9, 2010
17,498
After reading a bit, I learnt that regular speakers aren't meant to be powered 24/7 as this would quickly wear them out, but rather be powered on when needed and then turned off again.
By the way, I'm not sure I buy that. Yes, things do wear out but I'd expect a USB speaker to become obsolete before it wears out. Did you see specific data or just rumors?
 

Ya’akov

Joined Jan 27, 2019
9,141
By the way, I'm not sure I buy that. Yes, things do wear out but I'd expect a USB speaker to become obsolete before it wears out. Did you see specific data or just rumors?
I also find this a bit dubious. I have powered speakers that are on 24/7/365 with no failures.
 

Thread Starter

Raptorist

Joined Apr 6, 2021
6
Wow, I've had barely time to look the other way and I got five replies already :D
Let's proceed orderly.
Welcome to AAC!
Thanks! Glad to be here :)

Which speaker are you working with?
It's this product here:

in which you can see four buttons: the rightmost one is the on-off button.

A little research into Mycroft raises some confusion. The default setup is an analog speaker connected to the RPi 3.5mm audio jack. This would not be a candidate to be "powered off", or on for that matter.
Are you, by any chance, referring to their "Mark" products? I am not using one of those, but I'd like to use simply a Raspberry Pi, a microphone and the speakers above.


Yes, this could be accomplished fairly easily using a MOSFET, a type of transistor that can be used like a switch. Your Pi would supply a digital (on or off) signal to the gate of MOSFET and it would in turn switch the USB power to the speaker.
Thanks, I'm happy to read "fairly easily" in your sentence :)
Does it matter at all that the speakers don't just need to be plugged in, but there is a button that needs to be pressed to power them on and off?

By the way, I'm not sure I buy that. Yes, things do wear out but I'd expect a USB speaker to become obsolete before it wears out. Did you see specific data or just rumors?
I also find this a bit dubious. I have powered speakers that are on 24/7/365 with no failures.
I mostly read this on the internet, in particular that speakers in general dissipate most of their power to stay on, not to actually produce sound, and that their mean time before failure is around 2500 hours, which is a little over 3 months of 24/7 operation. None of the sources is particularly reliable, but I found several agreeing on this. I can report some links if you'd like me to.
 
"standard" speakers are not powered through USB. A USB adapter is sometimes used to provide 5V to a powered speaker.

You probably have a powered speaker that say uses a 3 pin 3.5 mm stereo plug or maybe it plays the sound through the USB interface. We don't have a clue.

With no sound input, speakers are perfectly happy having nearly 0V across them.

if it uses the 3.5mm plug, it would be easy to provide a mute interface using a solid state relay.
 

Ya’akov

Joined Jan 27, 2019
9,141
Are you, by any chance, referring to their "Mark" products? I am not using one of those, but I'd like to use simply a Raspberry Pi, a microphone and the speakers above.
From https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/get-mycroft/picroft#tested-hardware the Picroft website:

As well as a Raspberry Pi, you will also need: ... An analog Speaker that can be plugged into the 3.5mm audio jack on the RPi or a USB Speaker
So you can use an analog speaker directly from the RPi. But in any case, while it might be right that cheap USB speakers die, it this were my project, given my experience, I would risk the few dollars for the speakers based on the fact that I don't believe the speakers will die because the remain powered on.
 

Ya’akov

Joined Jan 27, 2019
9,141
As an aside:

The term speaker is not specific enough for this discussion. When you say speaker people will think of the simple transducer which makes you question initially confusing. USB speaker or powered speaker is much clearer.
 

Thread Starter

Raptorist

Joined Apr 6, 2021
6
"standard" speakers are not powered through USB. A USB adapter is sometimes used to provide 5V to a powered speaker.

You probably have a powered speaker that say uses a 3 pin 3.5 mm stereo plug or maybe it plays the sound through the USB interface. We don't have a clue.
That is probably the correct wording: the speakers have a 3.5 mm jack for audio output, and a USB plug for power input. The USB interface is not used for audio transfer.
With no sound input, speakers are perfectly happy having nearly 0V across them.
This would be the "stand-by" state, right? Meaning that I would be setting the voltage to around 0V when not in use.
if it uses the 3.5mm plug, it would be easy to provide a mute interface using a solid state relay.
It does use a 3.5 mm plug.

As an aside:

The term speaker is not specific enough for this discussion. When you say speaker people will think of the simple transducer which makes you question initially confusing. USB speaker or powered speaker is much clearer.
Thanks for the clarification, I wasn't aware of the ambiguity. I will edit it now.

Edit: I didn't realise there's a 10 minute timeout to edit messages, so I can't edit my original post any more.
 

Thread Starter

Raptorist

Joined Apr 6, 2021
6
I understand, sorry for the confusion. I intend to use an analog speaker, meaning that audio goes through a 3.5 mm jack. Said powered speaker also just happens to be powered by a cable that has a USB plug, but that will carry power only.

So you can use an analog speaker directly from the RPi. But in any case, while it might be right that cheap USB speakers die, it this were my project, given my experience, I would risk the few dollars for the speakers based on the fact that I don't believe the speakers will die because the remain powered on.
I understand your point, but that would also be a missed learning opportunity :D
 

Ya’akov

Joined Jan 27, 2019
9,141
I understand, sorry for the confusion. I intend to use an analog speaker, meaning that audio goes through a 3.5 mm jack. Said powered speaker also just happens to be powered by a cable that has a USB plug, but that will carry power only.


I understand your point, but that would also be a missed learning opportunity :D
In my estimation you would be better off with other learning opportunities which will inevitably arise. Maybe you should make your own USB speaker that has an enable so it can be shutdown. Any way you try to do this is likely to have strange side effects most probably including latency when the speaker is turned on.
 

Thread Starter

Raptorist

Joined Apr 6, 2021
6
In my estimation you would be better off with other learning opportunities which will inevitably arise.
Those too!
Maybe you should make your own USB speaker that has an enable so it can be shutdown.
This sounds more complicated. How do I do that? Where do I start?
Any way you try to do this is likely to have strange side effects most probably including latency when the speaker is turned on.
This is what I also thought. How, in your opinion, do products like Alexa do it then? Do they keep their speakers always on?
 

MrChips

Joined Oct 2, 2009
30,795
After reading a bit, I learnt that regular speakers aren't meant to be powered 24/7 as this would quickly wear them out, but rather be powered on when needed and then turned off again.
Don't know where you heard this. I have never heard this one before.
In general, electronics will last longer if left powered on 24/7.

If you want to turn off electrical/electronic devices the usual methods are:
  1. turn off the power switch
  2. plug it into a power bar and turn off the switch on the power bar
  3. pull the AC plug
 

djsfantasi

Joined Apr 11, 2010
9,160
This would be the "stand-by" state, right? Meaning that I would be setting the voltage to around 0V when not in use.
I don’t think so. When there is no sound, the speaker - the sound producing transponder or component - has 0V across it. You don’t have to do anything. It just is 0V.

In a powered speaker, there are components to interface with the (3.5mm) audio and a small amplifier. But keeping power to those components won’t shorten their life. There is a chance that capacitors might age but that’s a common problem and would happen regardless of power applied. Plus, we’re talking decades of use. By then, the powered speaker would be obsolete. Or do you still have an 8-track?
 

Ya’akov

Joined Jan 27, 2019
9,141
Those too!

This sounds more complicated. How do I do that? Where do I start?

This is what I also thought. How, in your opinion, do products like Alexa do it then? Do they keep their speakers always on?
Well, here's a very quick and dirty version:

Get this:

https://www.amazon.com/dp/B01MYTZGYM/

It uses this chip:

https://www.digikey.com/htmldatasheets/production/1282043/0/0/1/PAM8403.pdf

Pin 12 on it is SHDN (shutdown), it is "active low" meaning you have to pull it to ground to shut down the chip.

You can use one of the RPi's GPIO pins to do this, and just have to modify the code for Mycroft, which is open source, to bring the pin high before it speaks.

Whatever value the exercise has, it will be a full stack learning experience.
 

Audioguru again

Joined Oct 21, 2019
6,688
A powered speaker that is not playing sounds is costing money by the electricity its idling amplifier is using.
A half-decent powered speaker will last for many years if it is powered all the time.
The small "salt and pepper shaker" speakers you have might be made very cheaply "over there" and not last long even if they are not powered all the time.
 

wayneh

Joined Sep 9, 2010
17,498
I mostly read this on the internet, in particular that speakers in general dissipate most of their power to stay on, not to actually produce sound, and that their mean time before failure is around 2500 hours, which is a little over 3 months of 24/7 operation. None of the sources is particularly reliable, but I found several agreeing on this. I can report some links if you'd like me to.
It would be a shockingly bad design for any appliance to die so quickly. I can't even think of a way to produce such a short life. Of course my lack of imagination doesn't mean it isn't possible.
 

Audioguru again

Joined Oct 21, 2019
6,688
Maybe cheap No-Namebrand junk fails after only 2500 hours but I don't know because I don't buy that cheap junk.
My stereo was made in 1964 and is still used every day. It is an American Name-Brand.
I have a cheap Japanese Name-Brand clock radio that is always powered for 35 years and it still works.
 
Top