Auto AMP


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.

Be Sociable, Share!
9,366 views since Nov 2016

23 comments to Auto AMP

  • Michael

    Thank you for this project Auto Amp.
    I have installed Atmel Studio 7. I get an warning message, when I change the code.
    The warning message is “return type of main is not int -wmain”
    When I loaded your auto_amp.atsln in Atmel Studio, I got a message “Migrate the current project to component infrastructure” I accepted.
    Have you a solution for this problem?

    I have the code flashed without modification.
    The attiny13 turns on a led approx. after 15 seconds when I play music, I have not yet connected a relay. But it turn off the led, after aprox. 8 minutes when there is no signal on the speaker

  • Instances where this can be put to good use is when there is one HD source in an isolated
    location and a TV set in a different room that requiires some manual wiring to get to.
    Grand Theft Auto V was released for PS3 and Xbox
    360 inn Sept. The model that I purchased ($329) was not, which I rectified wih a $19 Blue Topth USB adapter ( I’ve
    seen them as low as $3. The debate about the true degree
    has been continued for years and does not stop, every time fans all will debate.
    New ‘GTA Online’ DLC details, including the cooperative heists, are expected to
    be aannounced soon for Rockstar Games.

  • Marcin

    Hi, I cannot locate any PCB Schema… Is there any?
    It would be nice to get one 🙂 Please 🙂

    • Marcin

      Can I also ask fo small change in code… I dont have such a knowledge in programming in AVRStudio or Bascom.. Can I ask to compile program with #define Amp_time_off 10
      I was able to open source code in Bascom software but I dont know how to recompile it in HEX>.. PLEase help…

      • Hey Marcin,
        There’s no PCB design, i’ve built it on a small proto board.
        I cannot help you with the code now, i don’t have any computer accessible with AVR studio. To do the modifications yourself all you have to do is: download AVR studio from atmel’s website, open the project in the archive, make your change and rebuild.

        • Marcin

          HI Bogdan,
          Thanks for your quick response..
          so do I need to open cproj file and make changes in auto-amp.c file inline where it says
          #define AMP_TIME_OFF 180
          can I change it to
          #define AMP_TIME_OFF 15 (sek)?

          then F7 to begin build process … ?
          Sorry for lame questions but I did not use any of AVR cpu software editors..

          Output hex file placed inside original location directory>>?


          • Yes, that should be the procedure.
            Though, I say 15 seconds is quite little, it may harm your amplifier if it will come to situations where it cycles ON-OFF very fast.

            Also, it might be that your new hex is put inside a Debug directory, just use whatever hex corresponds to build time and date.

  • Quentin

    Hello Bobdan,

    congrat’s for this awesome project. I’d like to use it. I’m actually working on some sort of usb speaker. Therefore I’m using 5v battery. I’d need this “auto amp” to shut down twoo different circuits (that have no switch on them yet).
    First (and I’m a noob) I don’t really understand wich component on the diagram is connected to the switch. I see the K1 G2R thing but I don’t see how I plug it on the wire I need to shut down.
    Secondly I just need to shut down those twoo circuits for like 20-30sec as the power supply automaticly shuts down when no or barely no current is supplied. But for this I guess I can play around with the code.

    Thanks in advance.

    • Hey, i have updated the schematic to show the relay(K1) and the modified power switch of the amplifier(S1).
      For turning on the usb speakers you could use a PMOS transistor in place of the relay. Connect the source to the 5V supply, the Gate to one of the pins that drove the relay and the Drain to your usb speakers +5V. Something like IRFL9014, just one example.

  • peter_s

    as I understand your solution is depending on a 5V source for the controler resp. relais. This source is used to hold the relais switched to ON the whole time the amplifier is on.
    I’d like to eleminate additional powersupplies and do not like to manipulate the expensive audio equipment.
    A external box for the whole controler without the need for a transformator is ok. You know powersource with X-cap?

    • Ii you are switching the mains of the amplifier, then it should be easy to create a power supply for the 5V inside your box: your box will have audio in, audio out, mains in and mains out.
      I don’t think supercaps are an option unless you use really large and expensive ones. Maybe rechargeable batteries are better…

  • juan perona

    can be powered with 3.7v, without changes???

  • […] [Bogdan] thought he could create a circuit to cut down on that wasted electricity. The result is a very tiny auto-on circuit able fit inside a pair of […]

  • […] [Bogdan] thought he could create a circuit to cut down on that wasted electricity. The result is a very tiny auto-on circuit able fit inside a pair of […]

  • Marc

    Hello Bogdan,
    I think this is a very good idea, trying to cut off
    wasted energy!
    Have you measured or estimate the current consumption
    of the relay, the LED and the AVR?
    No power saving techniques of the AVR are used in the source
    code so I wonder what the idle current consumption of the circuit
    plus the ON one is. Certainly around 0.4W so definitely lower
    than the 15W of your amp. But this current needed to power the
    circuit and the relay has to be taken into account while estimating
    the time the circuit starts saving money.
    keep up the good work!

    • You are absolutely right, the power of the circuit needs to be taken into account. But since the circuit itself consumes indeed about 0.4W to keep the amp on(70mA relay) and less than 0.1W to measure, i would say the error in the offset calculation is small enough to neglect.
      Indeed i did not bother to include any energy saving in the code, but the micro consumption is small enough(compared to the amp in idle it’s 150 times smaller).

  • peter_s

    Did you do consider a selfholding circuit like pictured here:

    Dynamicaly generated short pulses would set / reset the relais. This would eleminate the need to permanently power the relais via the 2013 circuitry.
    Could one then develop a controlunit that is powered by harvesting energy from the signal from audioinput?

    No need for a separate 5V source?

    • I’m not sure i understand how you are suggesting to use the self holding circuit.. could you explain more?
      There is no problem in powering the relay directly from the microcontroller. It just takes two pins because one cannot provide enough power.
      I don’t think that you should harvest energy directly from the signal to power the control unit. There are ICs designed to harvest energy from voltages as low as the detection threshold(15mV) but i don’t think you can make them work with AC, they are designed for a steady DC.
      On the other hand, the circuit can be made to work with very low current if you turn down the uC clock, i think 0.1mA is achievable.

  • Super tare, felicitari !
    Patenteaza ideea pana nu o reinventeaza Apple 🙂

  • […] [Bogdan] thought he could create a circuit to cut down on that wasted electricity. The result is a very tiny auto-on circuit able fit inside a pair of […]

Leave a Reply to Belgaum news | About Belgaum | Belgaum information | Belgaum district | Belgaum city | Belgaum Hotels | Belgaum People | Belgaum tourism | Belgaum entertainment | Belgaum students | Inside facebook | Hack | make use of | technical news | | Turning on PC s Cancel reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>