I have realized that amplifiers used around PCs (even if they are just found in active speakers) will be turned on a lot of time without actually being used, thus burning a lot of power for nothing. So, I wanted to build a circuit that will turn on an amplifier only when there is signal present.
Is it worth it?
The circuit below costs about $3 in parts and is placed inside a LM1876 amplifier which consumes about 15W when it’s idle. If it saves 10 hours per day worth of idle time, its cost will be made up in electricity savings in just half a year, based on my local electricity prices.
Since the amplifier is used for a PC, I decided that a good way is to power the circuit from a free USB port. I wanted to make it as simple and elegant as possible and my thoughts stopped at using a microcontroller. A quick oscilloscope plot showed me that 10-20mVpp applied to an amplifier with the volume knob halfway will produce an output which is borderline low for listening, therefore I had an idea of what magnitude of signal I should detect.
At first I thought that running my microcontroller at 3.3V (which would produce a 3.3mV step with a 10bit ADC) would be better suited. But practice showed that 5V is still ok, with about 5mV in ADC step. I experimented a little and found that a 15mVpp threshold (3 ADC counts) is sensitive enough to detect even low level music. On a desktop computer that I have tried, turning the volume up to the last 20% or so produces enough hisses from the onboard sound card that will continuously trigger it, but this is not a problem in real life for me, nor was it with other sound cards.
The circuit is built around an ATTINY13 which is what small micro with ADC I had around. Both left and right channels are measured, though one should be sufficient. The AC audio signal is shifted to about half the 5V supply. For each channel, the microcontroller will take a number of samples while retaining the minimum and maximum values. This gives the Vpp measurement of the audio signal which is compared to a threshold (in this case 3 counts). If the signal is high for enough time the amplifier is turned on, and each time signal is detected a turn off counter is reset. Should the counter reach a certain value, the amplifier is turned off.
I decided to make each measurement 1 second long, with a sampling frequency of 1 KHz for each channel, which is not that relevant. To turn on the amplifier I require that 3 consecutive measurements show there is signal, which should make sure that short sounds from the computer are ignored. For turn off, I chose e 3 minute timer. Of course, all timings along with the threshold are configurable from the software.
A 5V relay powered from two microcontroller pins is used to power up the amplifier. I have built a prototype of the circuit and installed it in my old LM1876 amplifier. It can put out 2x20W while consuming 15W of idle. The power switch was replaced with a three position siwtch functioning as ON-OFF-AUTO (S1 on the schematic) allowing the amplifier to function either in an auto or in an always on mode, apart from the required OFF. A couple of days of testing showed that the circuit behaved exactly as desired. It’s built on a 4 x 5 cm protoboard, but could easily be made smaller.
Below: the interior of the DIY LM1876 amplifier. The amplifier board is on the top left, while the auto amplifier is in the center of the picture. The relay(in white) is used to switch on the mains power, before the transformer, thus the amplifier itself will consume zero when it is off. The 5V is provided from a USB port of the computer it is used for, making everything off when the computer is off.
The source code is available for personal use here.