# How do I convert a square wave to a sine?

Status
Not open for further replies.

#### RJ8214

##### Newbie level 4
I have 24VAC(input) being stepped up to 115VAC(Output). My oscillating circuit output a square wave before going to the stepup transformer. I trying to solve this problem be converting the square wave to sine before being stepped. By-the-way, the amperage is some where near 80AMPS.

Can anyone help me?

Thank
ROB

A LPF.

• raviashu01

### raviashu01

Points: 2
Thanks for the rapid reply and you must forgive my ignorance. What is an LPF?

Thanks
Rob

A low pass filter.

Design it so as the cut-off frequency is just above the fundemental of the square wave.

And obviosly choose components which will handle your power requirements.The higher the order of filter you design, the better the sinewave you'll achieve. An RC filter will give a decent sinewave though.

Thanks once again.

Can you point me in a direction of creating one. I'm some what of an amature at this. I've been learning as I go long. You know what I mean and haven't done bad so far.

Thanks

This should give you a enough to create a decent filter.

https://en.wikipedia.org/wiki/Lowpass_filter

I my memory serves me correctly, a square wave is mad up of the fandamental + the odd harmonics, so design your cut off frequency to be substantially below the 1st harmonic, but above the fundamental.

Hope that helped!

how do you say a LPF would be able to give a sine wave... isnt it supposed to be a notch filter...
If we use a LPF we'll get a composite of many frequencies of sine waves na....

instead of converting the square wave to a sine wave and applying to transformer you can go for pulse transformer....

A.Anand Srinivasan said:
how do you say a LPF would be able to give a sine wave... isnt it supposed to be a notch filter...
If we use a LPF we'll get a composite of many frequencies of sine waves na....

instead of converting the square wave to a sine wave and applying to transformer you can go for pulse transformer....

A notch filter would work, but no better than a LPF. All you have to do is remove the high odd harmonics, nothing lower than the fundamental. A high order LPF will do this every bit aswell as a notch.

Have a look at https://en.wikipedia.org/wiki/Square_wave

There's a mathematical expression of what Old Nick said.

There's also a nice animation showing how to build a square wave with an increasing number of harmonics from sine waves. If you now imagine filtering out all the harmonics again with a lowpass filter, you get back to your original sine.

Another example would be a long cable - as we all know, higher frequencies get attenuated more than low frequencies - so a cable is a lowpass. If you now put a square wave to the input, your output gets "smudged" and looks (if long enough but not too long ) similar to a sine.

i'm a little confused about the LPF reply of Old Nick... i think the square wave contains a lot of small frequencies and i dont understand what you are remarking as fundamental here....

A.Anand Srinivasan said:
i'm a little confused about the LPF reply of Old Nick... i think the square wave contains a lot of small frequencies and i dont understand what you are remarking as fundamental here....

The fundemantal of a 1KHz square wave is 1KHz, there are no lower frequencies. All the other frequencies that make up the square wave are the odd harmonics of the fundemantal. Thus a notch or LPF will output a sine wave as long as you filter out the odd harmonics. A LPF is fine for this as there are no frequencies lower than the fundemental in a square wave.

I am not sure what you mean about a square wave containing a lot of small frequencies.

hey try referring about gibbs phenomenon.... there are normally overshoots in the edge of square wave which is due to finite termination of the sine waves constituting the square wave....

actually a perfect square wave can be formed only by the combination of all the frequencies till infinity.... and hence a perfect square wave can be transmitted only by a allpass filter.... that is why i got confused when you mentioned about fundamental of square wave.... i doubt that 1kHz is the fundamental as u mentioned....

Actually This is what i remember learning....

The overshoots are of much higher frequency than the fundemental, which is the lowest frequency present.

The fundamental of a 1KHz square wave is a 1KHz sine wave.

A perfect square wave is not made up of all frequencies to infinity (that is white noise), it is made up of the odd harmonics of the fundemental, which is 1/period of the square wave. If you dont believe me, do an fft of one!

RJ8214,
A filtering scheme that is commonly used is as follows:
.
Connect a series resonant LC filter (tuned to the mains frequency) in series with the output to the transformer primary. Connect a parallel LC filter (again, tuned to the mains frequency on the output side of the series filter, and in parallel with the transformer primary.
.
In theory, this sounds simple. However both the series capacitor and the series inductor must carry the 80 ampere load. This means that the inductor must be wound with 5 AWG wire (assuming a conservative 400 circular mils/ampere).
In addition, the capacitor(s) must have extermely low ESR (Equivalent Series Resistance) to keep the capacitor dissipation, and hence the capacitor temperature, within the capacitor rating.
.
A more practical approach would be to generate a "stepped pseudo sine wave" and filter this waveform. For example, a wave form that has the following amplitudes will generate a pseudo sine wave for which all harmonics up through the ninth are absent (a symmetrical waveform contains no even harmonics):
0-30 degrees: .265 X the peak
30-60 degress: .735 X the peak
60-120 degrees: 1 X the peak
120-150 degrees: .735 X the peak
150-180 degrees: .265 X the peak
The negative half cycle would be a mirror image of the above.
.
Another approach is to use a pulse width modulation scheme. See www.tinaja.com/magsn01.asp for more details.
.
Both these schemes will make your filtering requirements less stringent, since the bandwidth of the filters could be much wider (Lower Q).
regards,
Kral

Old Nick said:
The overshoots are of much higher frequency than the fundemental, which is the lowest frequency present.

The fundamental of a 1KHz square wave is a 1KHz sine wave.

A perfect square wave is not made up of all frequencies to infinity (that is white noise), it is made up of the odd harmonics of the fundemental, which is 1/period of the square wave. If you dont believe me, do an fft of one!

Thanx for the correction... i was a little confused and that is why i kept bothering this post asking for clarification....

It is very simple. design a low pass filter with cut off equal to the square wave frequency. you will get a sine wave at the o/p.

As old Nick pointed a LPF will do the job...in this case we will get the fundamental component...wat if we want to get a sine wave of our choice...in this case a notch filter will do..(correct me if am wrong)

Is there a problem if we were to just use a tank circuit, viz. LC circuit. Wouldn't that just filter the resonant frequency out...?? Correct me if i'm wrong, but these tank circuits produce sine waves from just any input and hence can be used to make sine waves of just any frequency unlike the LPF where only the fundamental freq can be obtained.

Also, if we require a sine wave of the odd harmonics(any one of them), then would a notch filter be more useful? Here again, the tank circuit is yet again the option.

RJ8214, Coolguy_ar,
The problem with using a tank circuit alone, is that large harmonic currents would flow from the output. At frequencies above the fundamental, the tank (parallel LC) circuit presents a very low impedance (the capacitor dominates). By using a series resonant LC circuit in addition to the tank circuit, as I suggested in my earlier post, the problem of high harmonic current is greatly reduced. The series reson circuit presents a high impedance to the harmonics, thus reducing the harmonic current that flows into the tank circuit.
Regards,
Kral

hi
do you use a low pass filter for it?

Status
Not open for further replies.