I tried doing a very simple class D amplifier with the FETs today. The idea was very simple: I took the one-op-amp amplifier I had built before, and added a comparator comparing that value with a triangle wave from my FG-500 function generator (not an ideal generator for the purpose, since its DC offset varies with the amplitude—the triangle wave always hangs down from the upper voltage rail). The output of the comparator feeds into the gates of a pair of FETs arranged as a cMOS inverter. The idea is that the comparator output is either high or low most of the time, so that only one of the FETs is turned on. I connected the output and ground to the speaker (resulting in a DC bias to the speaker, but I was prepared to live with that to avoid needing a second power rail).
Of course, with the symmetric power supplies available in the lab, students could use ±3V and ground, while still staying within the 7.0V max limit of the MCP6004 op-amp chips. If they connect the the loud speaker to that ground rather than the low-voltage rail as I’ve been doing with my single power supply, they won’t have a DC bias.
A proper design would have a “choke” (a large inductor with low DC resistance) in series with the speaker, to smooth out the abrupt transitions, but I don’t have one. The only large inductor I have (other than loudspeakers) is the electromagnet I used for the speed of sound experiments, and that has a DC resistance of about 69Ω, much larger than the loudspeaker.
One big problem, though, is that the MCP6004 has a slew rate of only 0.6V/µs, so takes 10µs to go from rail to rail. This is far too slow for a comparator in a class D amplifier. I had to cut the triangle wave frequency down to a point where it was audible even to me (and I’m a bit deaf in the higher frequencies) before the amplifier started working.
I should probably use the old LM311 comparator chip that I have—it should be able to slew 50× faster (30V/µsec), allowing a much faster clock rate on the triangle wave and spending much less time in the power-hungry intermediate gate voltages. I didn’t include any comparator chips in the student parts kit, though, so if I want them to do the lab with a high-speed comparator, I’ll have to buy them some parts. With comparators running 40¢–60¢ each, it won’t break me to buy 20 for the class, if they are needed.
Tomorrow morning, if I have time, I’ll try redoing the class-D amplifier with the comparator chip. It it works well, I’ll probably restructure the lab around class D amplifiers rather than class AB, and select a comparator chip for the students to use. Maybe the LM2903, since it seems to be the cheapest through-hole comparator available from DigiKey—oops, maybe not as that has no current for a high output, just for a low output, and so would need a pullup resistor. Hmm, that seems to be true of most of the comparators—so I should probably plan on having a pullup resistor.