CLASS D AMP WITH AN H-BRIDGE
class D amps are basic – just take an input, as well as utilize that to modulate a square wave with PWM. send this PWM signal to a MOSFET or something, as well as you have the easiest class D amp in existence. They’re so simple, you can get a class D amp chip for $3, however [George] believed that would be as well easy. Instead, he developed his own with an ATTiny as well as an H-bridge motor driver. No surprise, it works, however what’s fascinating is what impact the code on the ATtiny can have on the high quality of the audio coming out of the speaker.
The microcontroller selected for this job was the ATtiny 461, a part we don’t see much, however still precisely what you’d expect from an ATtiny. The heavy lifting part of this develop is an L298 chip discovered on eBay for a few dollars. This double H-bridge is normally utilized for driving motors, however [George] discovered a house for it in the power section of an amplifier.
The ATtiny is clocked at 16 MHz, making the ADC clock run at 1 MHz. A 10-bit precision conversion takes place, as well as this value sets the PWM task cycle. Timer1 in the chip is set as much as run at 32 MHz, as well as by counting this timer as much as 1023 provides this amp its PWM cycle speed of 31.25 kHz. That’s ideal in the community of what a class D amp must run at, as well as the code is only about 30 lines. It can’t get easier than that.
[George] put up a video of this amp in operation, as well as in spite of not complying with the common style of a class D amp, it seems quite good. You can see that video below.