I am using this circuit to see the sine wave coming from a DsPIC Pins to check the shape of sine wave created from my sine table. PWM frequency is 18 kHz

This circuit

But the sine wave does not seem to be not filtered properly. Also it seems to pick up some other noise or making its own oscillations when connecting the debugger to PC.

How should be the calculations or value for this filter or is there any other better options to see the sine-wave from my PWM output pins?

Image added. Below is the ground referenced Waveform on Pins enter image description here

  • \$\begingroup\$ This cannot be answered without understanding the sequencing and voltage levels on L1,2 and H1,2 relative to each other. You should also not connect a scope to anything other than a single-ended, ground referenced signal without special apparatus. \$\endgroup\$ – Andy aka Nov 5 '18 at 12:27
  • \$\begingroup\$ Each PWM Pin is switching between ground and 3.3Volts. Both PWMs run on central aligned, Pins in complement mode, PWM with 50% duty cycle which creates effective duty cycle as 0. Then sine point value is scaled and added to One PWM and subtracted from the other PWM which creates an effective duty cycle which updated in 360 equally spaced points in 20millisecond Sine wave. \$\endgroup\$ – user2454516 Nov 5 '18 at 13:09
  • \$\begingroup\$ Draw a picture. \$\endgroup\$ – Andy aka Nov 5 '18 at 13:31
  • 1
    \$\begingroup\$ Better yet, show us the actual waveforms you're getting on the four PWM pins, as well as the composite waveform you're seeing across the capacitor. On the face of it, it seems odd to connect H1 and L1 to opposite sides of the capacitor, but perhaps there's something funny going on with respect to the polarity of the drive signals. Also, the cutoff frequency of your filter is about 480 Hz, which is going to pass a lot of 50 Hz harmonics, distorting your waveform. \$\endgroup\$ – Dave Tweed Nov 5 '18 at 13:51

Try filtering separately, only H1, for example. If you get results, L1 should give the 180 degrees version, while H2 and L2 should give similar results. This looks like a 3-level PWM, so coupling H1 to H2 with the RC filters, and L1 to L2 should give you the two point differential filtering necessary to reconstruct your signal, V(H1_H2) - V(L1_L2). Here's a quick'n'dirty simulation showing what you tried and what I mentioned (please note that I am making an assumption about the PWM, I don't know what you have there):


  • \$\begingroup\$ Let me try this method. btw may I know how that simulation model created for that PWM? I was never able to figure out how I can create that PWM pins in Multisim \$\endgroup\$ – user2454516 Nov 6 '18 at 8:44
  • \$\begingroup\$ @user2454516 I used LTspice, but most simulators should have some ideal comparator, or similar. That's the role of A1 and A2, even if they are actually Schmitt triggers. In rest, sine source (0.8V@50Hz) and ramp ([-1,1]V@18kHz, plus inversion with E1). Don't forget that I assumed a three-level PWM, given your simplistic drawings of waveforms. If it's some other type, all bets may be off. \$\endgroup\$ – a concerned citizen Nov 6 '18 at 9:12
  • \$\begingroup\$ I think my PWM is different from what I have communicated. This arrangement is not giving that waveform I am looking for . But no problem, as suggested in one of the above rsponse, I have lowered the cut of value to 50hz by replacing the 10nF by 100nF capacitor in my original circuit. Now I can get more stable wave forms. I think this filter I am trying is resonating in 50hz by picking up 50Hz ripple and creating another waveform which confuses the scope. I need to be more cautious about my power supply and oscilloscope Auto set mechanisms.. Thanks for support \$\endgroup\$ – user2454516 Nov 7 '18 at 5:09
  • \$\begingroup\$ @user2454516 Hope it works, but, you know, I have to say it: it would have helped much better to use the pictures from the oscilloscope rather than doodling on paper. \$\endgroup\$ – a concerned citizen Nov 7 '18 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.