How can I go from a square/triangle wave to sine wave?

Thread Starter

avecs

Joined Nov 3, 2024
2
Hi there,

I am building a wave generator project, and I am looking to generate a sine, square and triangle ( with variable frequency !! )
I am just a beginner, I already made a square with variable frequency ( using a relaxation oscillator ). I am now using an integrator to make the triangle wave. Is there any way of using one of these 2 to make a sine wave with variable frequency? I can't use premade blocks; I only use the basic components.

Thanks!
 

DickCappels

Joined Aug 21, 2008
10,661
Would you consider a project using the XR2206, or the even older MAX038. ICL8030?

What frequency range do you want to cover?

What amplitudes do you need?

Do you want a DC offset control?

What is the lowest and highest frequencies that you want to generate?
 
For constant frequency you can use matched LC circuit.

For variable frequency you can integrate the triangle but the output will not be true sine. Also the sine amplitude will change with frequency.

For variable frequency but in steps you can switch/change the LC tank with many inductors and capacitors.

For smoothly variable frequency you need to tune LC circuit with variable L or C. It can be done by pushing core inside coil or turning variable capacitor with stepper motor, etc..
 

LvW

Joined Jun 13, 2013
2,019
A very simple method for converting a triangle into a (pretty good) sine wave is to use the classical two-transistor-differential amplifier (long-tailed pair). Because of its transfer function with a tanh-characteristic the triangle-sine conversion works best with triangle amplitudes between 70 and 90 mVolts (THD:Total Harmonic Distortion):
* 3% THD for 70mV
* 1.3 % THD for 80mV
* 2% THD for 90mV

Note that this method is independent on frequency, which can be tuned up to the working limit of the diff. amplifier,
 

atferrari

Joined Jan 6, 2004
5,007
Would you consider a project using the XR2206, or the even older MAX038. ICL8030?

What frequency range do you want to cover?

What amplitudes do you need?

Do you want a DC offset control?

What is the lowest and highest frequencies that you want to generate?
Hola Dick, it should be ICL 8038
 

AnalogKid

Joined Aug 1, 2013
12,093
National Semiconductor (now a part of Texas Instruments) and Linear Technology (now a part of Analog Devices) have application notes on generating sinewaves. These show how to use a group of diodes and resistors to "round off" the points in a triangle wave to make a pretty decent sinewave.

Here is a website with a huge section on sinewaves.

https://sound-au.com/articles/sinewave.htm#s7

And see the attached PDF, pages 11 - 17.

ak
 

Attachments

Last edited:

Thread Starter

avecs

Joined Nov 3, 2024
2
Would you consider a project using the XR2206, or the even older MAX038. ICL8030?

What frequency range do you want to cover?

What amplitudes do you need?

Do you want a DC offset control?

What is the lowest and highest frequencies that you want to generate?
It doesn't matter, I just need to be able to vary the frequency a little bit. The same for the amplitude and DC offset. I just don't really know how to do it. I can't use prebuilds, only basic components.
 

crutschow

Joined Mar 14, 2008
38,423
An integrator will turn a triangle wave into a reasonable facsimile (quasi) sinewave, but its amplitude is frequency sensitive.
According to my LTspice simulation of such a circuit, the total harmonic distortion is <4% with the 3rd harmonic about 28dB down (integrator input and output waveforms below).

If you ganged the integrator time-constant with the triangle frequency change, then the output amplitude with frequency could be made reasonably constant.

Filtering that with a low-pass filter whose corner frequency tracks the signal frequency would, of course, reduce the distortion.

1730651115528.png
 
Last edited:

DickCappels

Joined Aug 21, 2008
10,661
It doesn't matter, I just need to be able to vary the frequency a little bit. The same for the amplitude and DC offset. I just don't really know how to do it. I can't use prebuilds, only basic components.)
I recommend getting one of these chips (as long as it meets your frequency requirements.
https://www.ebay.com/itm/1835012234...94rbfvg==|tkp:Bk9SR_7blK_eZA&var=690837251173
Chips:XR2206, or the even older MAX038. ICL8030.

These chips contain a a square wave generator, a triangle wave generator, and a sine shaper. Just follow the application note and ask questions here.

Kits are available in the usual places (eBay etc).

Example: https://www.ebay.com/itm/183501223464?_skw=xr2206&itmmeta=01JBSF55QV061EZ76SS8D0M7C2&hash=item2ab9867628:g:2YwAAOSwOYRb0G71&itmprp=enc:AQAJAAAAwHoV3kP08IDx+KZ9MfhVJKlFk1tGiHN6aSseYNWcd9U7oV03VG/QMRaLwZ1lL5Aj9Jn1UU6NTWvzAZSFfW59kqEIXW1SjkWy9qHGtXS4LyqM+5tweCJON4tmjr1ouY/r0N0lp+d2MSR4zLz8zRU2Sev8fxhqWXWqraeC7cbyqhZdKZC0+ilVBkzIUoGlF6oPyjOAClCaLTxtXruxyXOpbtRCEmv66--tlK52H60L8kCLPJ7EiReijYtEUbA94rbfvg==|tkp:Bk9SR_7blK_eZA&var=690837251173
 

panic mode

Joined Oct 10, 2011
4,947
How about some details on actual signal requirements such as frequency range, stability, acceptable distortion etc ? I guess this is not going into THz or uHz but unless you state it, everything us just a guess.
And why go from square wave to sine? Shaping signals has its challenges. It is usually better to produce correct waveforms from the start. You can turn any periodic waveform into a sinewave by using suitable low pass filter.
Also, what are the "basic components" to you? One can consider that all components not involving IC are basic. Does that mean you want design based on vacuum tubes? Or perhaps even more basic parts such as cranks, cams and potentiometers? How about digital design using only relays?
 
Last edited:

WBahn

Joined Mar 31, 2012
32,777
I am building a wave generator project, and I am looking to generate a sine, square and triangle ( with variable frequency !! )
I am just a beginner, I already made a square with variable frequency ( using a relaxation oscillator ). I am now using an integrator to make the triangle wave. Is there any way of using one of these 2 to make a sine wave with variable frequency? I can't use premade blocks; I only use the basic components.
Why can't you use premade blocks? Is that a constraint of the assignment?

What is the actual assignment you have been given? What are the specs? Don't make people have to guess.
 
Top