# Having some questions about converting a PWM signal to analogue signal

Hello i am using a Lowpass filter to effectively "create in a sense" a analogue signal. The problem im having is the example that i was shown fourth diagram has a smooth wave essentially. However for mine it has to have an input frequency of 62.5Khz and i have used a lowpass to cutoff half of this (we were told to do this). The problem i have is that i dont understand why for the same circuit with a frequency of 1kHz looks much cleaner than mine of 62.5kHz. Why is this? Is it essentially the same just since the larger frequency makes it look more compact? Essentially im asking is for the input of frequency 62.5kHz will this give me an audio signal? I believe i have done what is correct besides from the output going through an amp (just focusing on the filter stage at the moment). I dont have the equipment to physically test it at the moment either. My main worry is that this (62.5kHz input frequency) output signal doesnt look like a typical analogue, sine shaped signal essentially but however just looks like a lot of noise (diagram 2 red signal). As in also for the enlarged image (diagram 3) from 0 to 1ms, there is no sine shape to it, like the example that was given (diagram4 or like diagram 1?

Shortform: Dont understand why for diagram 2, the output doesnt look like a audio signal such as for example the shape of diagram 1 or 4? Diagram 3 is an enlarged version of diagram 2. Did i do something wrong? I have my high pass filter at cutoff 20Hz and this removes the dc bias and my lowpass at cutoff 62.5/2kHz (as the pwm outputs 62.5kHz, i know a lowpass isnt needed since 62kHz is much larger than the audio heard to humans (i.e. 20-20kHz) but it was stated that it should still be done. Th voltage divider is used due to the output voltage needing to be under a certain voltage due to the amp needing 0.4 to -0.4V. Hence why does my signal change with larger input frequencies and lower frequencies?

I am probing all graphs at the TOP node for C2

Note: Vout is not where i have probed and i know that it is not the actual output voltage for these circuits

• If you want to see the result of your low-pass, then you need to take your output there - at the junction of R3 & C2 - and not at the output of your high-pass where you have it. Commented May 16, 2017 at 13:11
• This is what i am doing by probing at the top node of C2? I.e. the junction of R3 and C2? Commented May 16, 2017 at 13:13
• Ok - I was looking at your schematics where you have a conspicuously labeled 'Vout', which is not at the top of C2. Commented May 16, 2017 at 13:14

## 1 Answer

The fourth picture has a PWM frequency that is more like 600 kHz. Just count a few cycles between 0.3 ms and 0.4 ms (100 us difference). I count at least 6 so the period of one cycle is no more that 1.667 us and that is a frequency that is at least 600 kHz.

At ten times the frequency, the ripple on the output will be ten times less and your sine wave will look far nicer.

I'm not going to go down the path of answering what appear to me as questions that are as a result of your initial lack of understanding about filters. Get your head around this one answer then it should all slip into place.

• Oh ok thanks. However for the 62.5Khz input signal does this seem correct. I was just under the impression i would get a sine shaped in a sense signal and not just straight cut edges.? If it is not how can i improve it? Commented May 16, 2017 at 13:19
• You can improve it by building a 2nd order filter - it will have twice the attenuation slope and will reduce your ripple a decent amount. A typical simple 2nd order filter would use an inductor and capacitor but, given that you probably want it to have a cut-off at about 10 kHz, you'll probably have to consider using a sallen key op-amp filter. Commented May 16, 2017 at 13:23
• Ah ok thanks, However would this still produce a sound when played through a signal (obviously a amp is needed after ther lowpass) but besides this would a signal still be played? For the second diagram circuit. Note without doing a second order filter at this stage? Commented May 16, 2017 at 13:25
• You might get some strange distortion due the the amp being affected by the spikiness of the signal but you should hear it. Commented May 16, 2017 at 13:32
• If i used a second order filter as you stated before would this smooth out the spikiness or not? Commented May 16, 2017 at 13:33