Connect with us

converting square waves to sine waves?

Discussion in 'Electronic Basics' started by Joe, Jan 30, 2004.

Scroll to continue with content
  1. Joe

    Joe Guest

    I have a home built square wave generator, and I would like to be able to
    build a circuit that will convert a square wave to a sine wave of
    approximately the same frequency. I have googled for square to sine wave
    generator schematics, and found a lot of circuits that do the opposite (ie
    convert sine to square waves), and I have looked at several wein bridge type
    sine wave generators, but would like to use the square wave generator I
    already have to generate a sine wave (of about 25Khz). If I need to, I can
    build a wein bridge type sine wave oscillator for the frequency I need but I
    am hoping someone out there knows of a fairly simple circuit that will take
    a square wave and produce a sine wave from it. That way, I could just feed
    the signal from the square wave generator into the 'converter' and get a
    sine wave out.

    Any suggestions appreciated.

    TIA,
    Joe
     
  2. John Larkin

    John Larkin Guest

    Just a lowpass filter will work, but the filter cutoff frequency will
    have to change if the square wave frequency changes. A square wave
    includes the fundamental frequency (the one you want) and odd
    harmonics, so you need a filter that passes 25 KHz and attenuates 75K
    and up. A simple R-C is the simplest lowpass filter, and more complex
    filters (L-C or active) will zap those high harmonics better.

    A tuned LC (a bandpass filter) will also work well at a single
    frequency.

    John
     
  3. For fun, I used a freeware filter builder to design an active filter for
    you:

    http://home.comcast.net/~rcmonsen/misc/filter.zip

    There are jpg files of screen shots of simulations built with CircuitMaker,
    and a gif file of the output of the filter program.

    The filter designer is at http://www.nuhertz.com/

    It won't work for anything except 25kHz. It'll give you great results at
    that frequency. The component tolerances are pretty tight, I think.

    Regards,
    Bob Monsen
     
  4. Bob Masta

    Bob Masta Guest

    Besides the filtering approaches already mentioned,
    another approach for fixed-frequency work is to
    integrate the square wave to a triangle, then pass
    that through a nonlinear shaping stage. Typical
    shapers are made from overdriven differential
    amplifiers. It is fairly easy to get down to 1% THD
    this way, even lower if you want to get extreme.

    Similar sine shapers can be made from overdriven
    JFETs, or even back-to-back diodes if you are
    not worried about super-low distortion.

    Note that this approach has problems if the triangle amplitude
    isn't constant, which means that the frequency to the
    integrator has to be constant.

    Most "function generator" circuits actually generate
    a constant-amplitude triangle along with a square,
    because they are integrating an adjustable current
    up to a threshold, then reversing the polarity to
    the integrator. So they have a nice triangle to feed
    to the sine shaper.

    Hope this helps!



    Bob Masta
    dqatechATdaqartaDOTcom

    D A Q A R T A
    Data AcQuisition And Real-Time Analysis
    www.daqarta.com
     
  5. Joe

    Joe Guest

    Thanks John, I didn't think of a filter. I will have to breadboard one and
    play around and see how it works.

    Joe
     
  6. Joe

    Joe Guest

    Hi Bob,

    Thanks for the file and the link!! The zip file contained 2 filters. One was
    a sallen key filter which I will have to do some more research on because I
    am not familiar with it. That one was not included in the choices for the
    freeware filter designer at nuhertz. I downloaded it and have been playing
    with it. I haven't had a chance to breadboard anything yet cause I am having
    so much fun with this program. The tolerances are tight on your design for
    just 1Khz either side of 25Khz. I can probly live with 5Khz either side of
    it, but I am going to breadboard a few different ones including yours and
    look at it on my scope to verify.
    Thanks again !!

    Joe
     
  7. Joe

    Joe Guest


    Hi Bob,

    Thanks for the suggestions. I also got some other ideas. I like the filters
    because that is what I am going to be experimenting with next as I learn
    more about electronics. I will probly tackle a function generator in the
    near future because I received some good suggestions for one when I asked
    the group for ideas on building my signal generator (square wave only).

    Joe
     
  8. Bill Vajk

    Bill Vajk Guest

    Also consider a transformer. Common hysteresis taking place in
    the core is probably the reason you couldn't find electronic
    circuits to do te job.
     
  9. John Larkin

    John Larkin Guest

    Get Don Lancaster's excellent paperback "Active Filter Cookbook". It
    cuts right to the chase.

    John
     
  10. That's the problem: it's a whole lot easier to convert sine waves to square
    waves thant the other way around.

    The nice thing about a Wien Bridge (not Wein Bridge) Oscillator is that it
    produces an excellent low distortion sine wave with just two variable
    resistors, and two capacitors that can be switched to give the different
    ranges. After the Wien Bridge, you can use a Schmitt Trigger to give nice
    square waves. But since you already have the sq wave generator, that's not
    needed.

    I would just build a Wien Bridge oscillator to make the sine waves. The
    filter limits you to just one frequency.
     
  11. ---------------
    You need a primer on diode/trasnsistor wave-shaping, and a good
    example. Go look at how the ICL8038 IC does this in its inner
    schematic, found in its PDF databook excerpt.

    -Steve
     
  12. Joe

    Joe Guest

    Thanks to all who replied. I have lots of good ideas to try now.

    Joe
     
  13. Joe

    Joe Guest


    Hi Steve,

    I googled for it and could only find an NTE part number, when I looked up
    the data sheet, I see that it is a precision waveform generator for
    frequencies up to 200Khz. But no transistor level schematic for it, if
    that's what you meant. Do you have a link for the data sheet you referenced
    above?

    Joe
     
  14. The ICL8038 was made by Intersil, then by GE, then Harris, and now
    its a Intersil part again. Check the Intersil site to see if they still
    have a data sheet. http://www.intersil.com/cda/home/

    Maxim makes an updated version, the MAX038. http://www.maximic.com/
     
  15. Balaji

    Balaji Guest


    Joe,

    It appears that you desire, to make a variable frequency converter.
    The problem, with using a low pass analog filter, is that it has also
    got, what is called phase distortion. That means that different
    frequency signals will have a response that would be follow a little
    behind the input. That should not be a problem, if for all
    frequencies, the shift is the same, but this difference in time will
    change with frequnecy. Also if, you note, at higher frequencies, you
    will get attenuated output. That means the amplitude of the output
    would be lesser. However, its surely a very low cost design for the
    kind of a problem.

    Unless, you need very stringent requirement of phase follow up, or
    output amplitude, you need not use what is called a digital filter.
    You could build it using some sort of a DSP (An expensive solution
    when compared to the analog one, and if you have low frequencies, you
    could probably do with just any normal processor, instead of a
    full-fledged high end DSP) You will need lots of mixed signal
    components in order to get a proper output though, but there is
    nothing better than that if you want the cleanest possible signal. In
    fact, the reason, many people prefer using digital filters to analog
    ones is that spikes and sudden glitches in the signal can be cleaned
    using a very simple adaptive algorithm.

    Google "DSP" or "digital filter" for more information. You may also
    visit the websites of companies like "Texas Instruments", "Analog
    Devices" etc.

    But for your problem, it appears that a normal analog filter would
    suit the best if you don't really care about phase distortion and the
    other bullshit. Try it out. Its really good. All the best.

    Balaji
     
  16. Bob Masta

    Bob Masta Guest

    As I recall, the 8038 used a whole forest of breakpoints. They
    didn't get any better results than the overdriven differential
    pair, which only requires a couple of adjustments. Personally,
    I'd reserve the whole breakpoint approach for functions that
    are really hard to approximate by continuous means.

    Just my US$0.02 worth.



    Bob Masta
    dqatechATdaqartaDOTcom

    D A Q A R T A
    Data AcQuisition And Real-Time Analysis
    www.daqarta.com
     
  17. Baphomet

    Baphomet Guest

    I think diode wave shaping is definately the way to go because it's cheaper,
    smaller, and relatively frequency independant. You could do it with only 4
    diodes and a handful of resistors if say 5% THD could be tolerated (more
    diodes and resistors if a lower distortion level was required . You would
    first have to convert the square wave to a triangle wave and then use that
    to drive a non linear network. This is how it's generally been done in
    function generators since the late 60's.

    http://www.ozitronics.com/docs/k23.pdf
     
  18. John Fields

    John Fields Guest

    ---
    Kinda late, but I'd use a PLL with the VCO running at 32 * 25kHz driving
    a 5 bit up/down counter with the counter's MSB used to toggle the
    counter's UP-DOWN input and as the input to the phase comparator. The
    25kHz square wave would go into the other input of the phase comparator
    and the counter's numerical outputs would go to a lookup ROM with a sine
    table burned into it, and the ROM's outputs would go to an 8 bit DAC
    with a lowpass on its output. Voila! 25kHz square wave in, 25kHz sine
    wave out. Plus, change the 25kHz input and the output will follow it.
    For a while, anyway...
     
  19. Joe

    Joe Guest

    Thanks Baph, but every time I go to that link, my system seems to lock up. I
    have to use ctrl alt del to get out of it. Cannot save the document or even
    scroll it. Is it me?

    Everything else on my computer seems to be working ok.
    I am running windows xp.

    Joe
     
  20. Works for me. I'll mail it to you.

    Regards,
    Bob Monsen
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-