Square wave to sine wave conversion?


Joined Jan 11, 2009
Particurlarly hard to do if you want to vary the frequency and have the output amplitude to stay the same. I wonder if a phase lock loop could manage this.


Joined Oct 22, 2008
A microcontroller could be programmed to read the period of the incoming square wave and use pulse width modulation to generate a sine of the same frequency over that range.

If the PWM was much faster than 5 kHz then a single high-frequency low-pass filter might be good enough to clean up the entire frequency range well enough.


Joined Oct 28, 2009
If you first convert the square wave to a triangle wave, check out this link......


Here is another approach....... http://mypeoplepc.com/members/scottnoanh/sitebuildercontent/sitebuilderfiles/th_sine_shape.jpg

mind to know whr is the breakpoint voltage?when i simulate on pspice,the value for Iu is wrong,some of the formula are wrong too.please check it out.

use my circuit that i attach,and use the formula on the pdf to calculate according my circuit.
the red arrow indicate current flow


Last edited:


Joined Feb 28, 2009
I am not the author of the article so cannot lend any insight into how it was developed or respond to any errors it may contain. I simply located it and presented it for your evaluation.. Now to your simulation. Please note that the total conversion is made by having multiple sections, each providing a slightly different slope at different activation levels or breakpoint. From the first paragraph on the first page........

"The sine converter is a classic diode-resistor multiple -breakpoint shaper It achieves an approximately piecewise - linear sinusoid approximation and is based on optimizing the breakpoint locations to minimize function error by uniformly spreading the error across a range of the function. The five-breakpoint circuit is shown below."

Your simulation shows only one section and would only produce a slight modification to the slope of the triangle wave applied to its input. With multiple sections, as the input continues to rise, more and more modification to the slope would be evident, up to the point of the peak where the slope would approach almost flat.


Joined Oct 28, 2009
i know you are not the author.
i was referring the formula and did some calculation for the circuit.see the page 2.i was very vey confuse about this formula on page 2.i spend alot of time today by analysis it,but some formula seem error and i dont know how to fixed it.im here by asking for help about the formula on page no.2.


Joined Dec 20, 2007
I used a switched-capacitor lowpass filter IC to convert a square-wave into a very good sine-wave. The cutoff frequency of the filter is adjusted with the frequency of its clock which is 100 times the cutoff frequency.


Joined Feb 28, 2009
Maybe you could send a PM to member named "Mathematics!" (with the explanation point) He stated in another thread that he has a Master's Degree in Pure Mathematics.


Joined Aug 7, 2008
Also check out Forrest M. Mims III, Engineers Notebook II, pg 81; 4 op amps, first square wave gen, 2nd, to triangle, 3rd triangle to sine, 4th amplifier. Two caps used in conversion. Fixed frequency of 1 kHz.