In this instructable I will layout the basic components of a Class D amplifier built from common ICs. Class D amps are switching amplifiers, meaning the output transistors act as a switch; either on or off. Doing this keeps the impedance of the transistors low, which correlates to less power loss. This is the most prominent advantage of the class D amp over a linear amplifier, where linear amplifiers waste a lot of power keeping the active components linear. With that being said, each amplifier has it's respective pros and cons; however this discussion is outside the scope of this instructable.
As you may have inferred from the above paragraph, the output of the class D amplifier will be a square wave. Square waves can be used to drive many things. This instructable will focus on using the output to drive an audio driver (ideally a sub-woofer); however it can be used for DC-DC conversions as well as to drive various types of motors.
Most class D amps are built from dedicated IC's. These are generally more expensive, but are good quality. As stated earlier, this instructable will layout a class D amplifier built from standard IC's. Depending on the quality of your build can result in a good sounding amplifier for common listeners considering it's simplicity and ease of construction.
This instructable will be broken into 4 parts. 1) Saw-tooh Generator 4) Modulator 3) Amplifier/ Low-Pass and 4) Additional Recommendations.
Step 1: Saw-Tooth Generator
The saw-tooth generator I decided to use is a simple astable 555 timer. Rather than using the square wave output of the 555, we're going to use the voltage across C1. Aside from this, it is the same astable 555 circuit found everywhere. The duty cycle and frequency equations are the same and can be found in other instructables.
When designing this portion of the circuit, I recommend a duty cycle of 75%-90% and a frequency well above 20kHz. The components listed in the attached schematic will yield a duty cycle of about 80% and a frequency ~30kHz.
There are other ways to generate saw-tooth waveforms with more accuracy, however this is quick and dirty. Also, I believe it is more common for the wave for to be a triangle wave, but this works equally as well.
Step 2: Square Wave Modulator
The purpose of this component is to make PWM signal whose duty cycle is modulated by an audio signal. It's almost as easy as it sounds. When you compare a saw-tooth wave with a constant DC signal, the out put is a square wave with a constant duty cycle. If you superimposed an AC signal on said constant DC voltage, you get a square wave in which the duty cycle changes with the AC signal. Thus the square wave is being modulated by the AC signal.
The circuit is pretty simple, take an LM311 comparator and feed it the saw-tooth wave at one input, and the AC signal with the DC offset. The DC offset is set by the potentiometer in the modulator circuit attached. You can play around with this but 6V is about where you should be (assuming your rail supply is 12V). The 1uF AC coupling cap is absolutely necessary. The value isn't critical, although I would recommend above .1uF. It should also be non-polarized.
If your audio source is an MP3 player, cell phone, or the like; the second circuit, voltage input with gain, should be used. The both will work, but the voltage out of these devices are usually small. This circuit gives volume control with the potentiometer and insures that the device always sees at least 10k as to not load the device. The circuit shown has a gain of 11, but I recommend playing around with this value based on your liking. RB1=RB2 so that the DC biasing is centered. You can use a potentiometer for this in order to balance the voltages if you'd like. Use relatively large resistances for these. If you do decide to use this circuit, the AC coupling capacitor as well as the 10k pot should be eliminated so that the output of the op-amp feeds directly into the comparator. The reasoning is that the output of the op-amp should already be offset by a the DC value at the non-inverting input of the op-amp. I forgot to write op-amp IC i used in the picture. I recommend an LF356 however an LM741 would work equally as well. There are other ways of going about this but this is simple and effective.
Step 3: Amplifier and LC Low-Pass Filter
I am leaving this component somewhat ambiguous because of the many directions that can be taken. Essentially what needs to happen is for the modulated square wave generated in the previous step needs to toggle some transistors. The best way to do this is to use either a half-bridge or an H-bridge. Since I said it was a simple class D, I will show the schematic for the half-bridge, or totem pole circuit. The simplest way of doing this is to use a pair of complimentary P and N channel MOSFET in the configuration shown in the attached photo. It is possible to use two N-channel MOSFETs so long as you have the appropriate gate drivers and take into account the need for a delay line with dead time (This is what I used for the circuit in the next step). You get the same results (sort of) either way. H-bridge circuits can be found online.
Once you've determined the MOSFETs and driver configuration, the last step is the low-pass filter. This filter takes out the carrier signal that the wanted AC signal lies on. In my case, it's the 30kHz signal generated by the saw-tooth generator. The cut-off frequency of an LC low-pass filter follows the equation f=(2*pi*L*C)^-1. You can set this at 20kHz for full audio range or cut it off much lower for use as a sub-woofer amp. It's absolutely up to you. The capacitor before the LC filter Cblk is critical. You could destroy your speaker without this capacitor. It should be electrolytic and it should also be rather large.
With that being said, grab a crappy speaker and test away. Good luck!
Step 4: Final Recomendations
Hopefully by now you should have something similar to the circuit attached (probably with much better layout/ construction; my neatness side was on vacation). It's surprising mine works, but it does. Obviously this is only one channel. For stereo, you'll need two of these. One for the left channel, and one for the right. I'll leave you with a few comments that I feel may have been left out. Good luck and happy circuit building!
Implement star grounding so that the current draw from the FETs doesn't freak out the op-amp and other ICs.(I didn't in the circuit attached, oh well)
Separate the FETs from the ICs.
Use a scrap speaker for testing so that you don't destroy good speakers in case you've made a mistake.
Build each component separately, test, and then move on once it works.
I know I'm overlooking a few things but use your imagination and google and things will come together.
Thanks for taking your time to read my instructable. I hope you enjoyed the read. Also I hope you enjoy your freshly built class D amp.