70 watt amp uses an ATtiny

If you’re looking for a DIY amplifier project made with a minimum of parts, this is the build for you. [Rouslan] created a 70 watt class D amplifier using an ATtiny45 and just a few dollars worth of additional components.

A class D amplifier simply switches transistors of MOSFETs on and off very rapidly. By passing the signal produced by these MOSFETs through a low pass filter and connecting a speaker, a class D amp is able to amplify a signal very efficiently. Usually, these sort of amp builds use somewhat esoteric components, but [Rouslan] figured out how to use a simple ATtiny microcontroller to drive a set of MOSFETs.

In [Rouslan]’s circuit, the audio signal is passed into the analog input of an ATtiny45. Inside this microcontroller, these analog values are sent to the MOSFETs through a PWM output. [Rouslan] threw in a few software tricks (explained in revision 2 of his build) to improve the sound quality, but the circuit remains incredibly simple.

[Rouslan] posted a video going over the function of his ATtiny amp, and from the audio demo (available after the break), we’re thinking it sounds pretty good. Amazingly good, even, if you consider how minimalistic this 70 watt amp actually is.

Thanks [Alec] for sending this one in.

39 thoughts on “70 watt amp uses an ATtiny

  1. I’ve been wanting to build a class d amplifier for my wife to use… well, I would like one as well. This is a cool project, thanks for showing it here!

    1. A 10-bit A/D converter on the input isn’t going to make the audiophiles very happy, but it’s certainly a good demonstration that you can build a working Class D amp with simple parts. There may be a microcomputer simpler than an ARM Cortex that has a better A/D converter, or you could go with an external A/D converter chip (unfortunately, most of them seem to be surface-mount instead of DIP formats.)

      1. … for fidelity sake you could use the class D amp to drive the rails of a class A amp. The class A would have very low power dissipation while removing the distortion in the class D signal. Very small BJTs and a high quality op amp would do the trick.

        When I was a kid I used to do something similar with a pair of 741s by using one as a PWM and the other as an error correction amplifier for the PA section.

  2. I can’t see schematics or anything as the site is down but from how he describes it and the lack of any massive inductors this is how I assume it works:

    Input->ADC->ATMega->PWM->LC low pass->MOSFETs

    As the efficiency from a class D comes from keeping the transistors either on or off, isn’t this basically a class B(? mentions a H-bridge so push-pull?) amp with an ATMega as an input buffer?

    1. You’re a bit off… the video has a data flow diagram. Input->LC lowpass->ADC->ATTiny->PWM->MOSFETs->LC lowpass->speaker .

    2. The LC lowpass is connected between the mosfets and the speakers, not between the PWM output and the mosfets.

      The high efficiency comes from the inductor storing the energy when the mosfet is turned on and dumping it back into the speaker and the power supply rail when the mosfet is turned off.

      1. Oh! Didn’t spot it in the corner there, and he pointed to some tiny little component right next to the IC when mentioning it so I thought it was between the IC and MOSFETs, hence the confusion.

    3. 1.) Having LC low-pass before mosfets would convert PWM signal to analogue signal which would revert entire effort with attiny and also such amp would no longer be class D (MOSFETs will start producing heat).

      2.) inductor is not big enough to store any energy. It’s there only to filter high PWM frequency from audio passed to speakers. efficiency is achieved by switching rather than limiting current (which produces heat).

      Eg.: when you switch off bulb your switch does not produce any heat, but if you will try to just reduce light intensity using resistor it will surely get hot. That’s why transistors in class D are driven to act like switch (only ON or OFF) rather than like resistor (any resistance other than 0 or infinity).

      You can also imagine that you are holding rope with something heavy on it’s end. While you are holding it still it’s relatively comfortable. If you drop it completely, it’s still comfortable. But if you will try to let rope slowly slip trough your hand you will probably get hurt (without proper heatsink :-)

  3. Very nice. Site looks very tumbled. Two ideas came to mind rather quickly.

    – If another mcu is used can you monitor input/output and match them so distortion can be minimized ( feedback like the philips mfb ).

    – Other idea that comes to mind. play sound files ( from sd-card) directly to amp.

      1. V-USB is low speed only. Though it supports bulk endpoints it’s against USB 1.0 specification and that causes problems with some OS’s, and also I don’t think there is enough bandwidth or cpu cycles to do both jobs with even a 20mhz part. (USB interrupts cause headache if they are not serviced). Bandwidth of SPDIF is enormous. Maybe it’s possible using 2 AVRs, one for the V-USB and that linked via SPI (10mhz maximum unless you overclock the parts) to the second AVR to convert the data to PWM?

  4. From the video alone, it appears it has 10 bit ADC input, dithered 9 bit PWM output. No feedback loop. 12V into a single, standard 8 ohm speaker (rather than what appears to be a parallel array of them) is only 18W. Don’t expect high fidelity at high volume from this.

    It is a great demo of a class D amp though. Would make a satisfying weekend project, or starting point for something better. A better MCU would allow 12 bit sampling, feedback, and stereo. Hope this site comes back up soon, I’d like to see the schematic and the details of revision #2.

      1. Sure. There was a 555 class D amp on here a while back, and I’m sure the TL494 could be used as well.

        Then you don’t have to worry about how many bits resolution you have. Instead, you’ll have to worry about non-linearity, duty cycle limitations, and other stuff.

        Choose your poison. I’ve designed a class D amp in SPICE as an exercise, using nothing but cheap comparators and op-amps. It works very well in simulation. But if I was to build one for real, I’d probably use an MCU or a chip explicitly made for class D amps, since I’m far more comfortable in the digital domain.

    1. I just got done breadboarding it. I had to substitute IRFZ34 and IRF9Z34. Couldn’t find a reasonable price for the others. The MOSFETs are running hot using a 12vdc supply. I assume this is because the RDS is lower than the IRFZ14. Adjusting the 12v supply down to 10v allows it to run cool with no heat sinks.

      The only major snag I hit was programming the fuse bits on the attiny85. You have to make sure to switch the clock to PLL. Cost me a little time because I’m not an Atmel expert.

      For what its worth… sounds pretty good to my unrefined ears.

  5. Cool project! Nice choice of the attiny45… One downside I haven’t seen mentioned yet is the 10-bit resolution of the ADC. Not exactly CD quality. :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s