Class D amplifier usage with PWM driven audio signal

dendad

Joined Feb 20, 2016
4,642
If you have an oscilloscope you can add a RC network from the PWM to ground and see what the signal looks like. Then compare it to the signal on the speaker.
Without calculating anything, and I should be asleep, try a 10K resistor from the PWM to a 100nF cap to ground. Look across the cap and see what the signal is .
Then fiddle with the cap value.
Oh, and if you want the volume control to work, you will have to go to the audio signal, not the PWM, otherwise you need to modify the code to alter the PWM to control the audio. You cannot control the volume by changing the PWM amplitude.
As it is, as soon as you get the volume pot a bit off the min end, the amp is driven into saturation, as it should be for class D.
And to make it a bit better, an LC trap filter at the PWM frequency needs to be placed at the amp output before the speaker.
 
Last edited:
Top