+ Post New Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 34
  1. #1
    Newbie level 5
    Points: 54, Level: 1
    Nurahmed's Avatar
    Join Date
    May 2019
    Location
    Montreal, Canada
    Posts
    9
    Helped
    0 / 0
    Points
    54
    Level
    1

    How can I generate Sine wave from any periodic waveform that has low frequency?

    I need to generate a low frequency sine wave from any waveforms (square wave, triangle wave, etc.). I know Class D amplifier has high efficiency, but the switching frequency of square wave is very high. Is there any waveforms that has lower switching frequency, and use some filters to generate a sine wave?

    Thanks.

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 74,899, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,186
    Helped
    3460 / 3460
    Points
    74,899
    Level
    66

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Hi,

    There is no specifcation in your post .... thus we have to guess.

    "Low frequency" for an RF designer may mean 1MHz....for an audio designer maybe 20Hz ... for another designer it may mean 0.0001Hz.

    I don't understand what the switching frequency of a class D amplifier has to do with your application.

    And why do you mention efficiency? What voltage and current are you talking about - for both input and output signal? What is the source if the signal? And what is the load/ target of the signal?

    *******
    Any non sinusoidal signal of a dedicated frequency contains other frequencies.
    There may be a problem finding what output frequency you want as output.
    --> You urgently need to specify the frequency range of interest.

    Some ideas:
    Input signal --> analog LPF --> comparator (to get square wave, independent of input signal waveform) --> LPF (to get rid of square wave overtones) --> sinewave.

    Input signal --> analog LPF --> comparator (to get square wave, independent of input signal waveform) --> LPF (to get rid of square wave overtones) --> PLL (to multiply frequency) --> sine lookup table --> DAC --> LPF --> sinewave.

    Input signal --> analog LPF --> ADC --> FFT --> select lowest frequency --> inverse FFT --> DAC --> LPF --> sinewave.
    (This keeps the amplitude of the low frequency signal, the others don't)

    Also consider what you expect to happen when the input signal is so low, that noise amplitude becomes significant. Noise contains a lot of signals....which may wrongly be interpreted as "true" input signal.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

  3. #3
    Advanced Member level 4
    Points: 5,647, Level: 17
    kripacharya's Avatar
    Join Date
    Dec 2012
    Location
    New Delhi
    Posts
    1,026
    Helped
    173 / 173
    Points
    5,647
    Level
    17

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Simplest is to construct a Low Pass Filter (LPF) with cutoff frequency just above your 'arbitrary waveforms' 1/T. The higher the filter order the better.

    This essentially filters out everything except the fundamental.

    For low freq - say below 10khz- there are some excellent Switched Cap Filter chips with 8th order lpf. All it needs is power and a switching freq input. e.g. MAX293, MAX294 etc
    Last edited by kripacharya; 27th May 2019 at 05:15.



  4. #4
    Advanced Member level 5
    Points: 16,357, Level: 30

    Join Date
    Nov 2012
    Posts
    2,995
    Helped
    727 / 727
    Points
    16,357
    Level
    30

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    I need to generate a low frequency sine wave from any waveforms...
    I do not know what is the objective of the said exercise, but you can always use a bandpass filter to get a sine wave from any arbitrary waveform.

    Of course if you want to have a variable centre frequency, you have to do more work.

    By the way, a square wave of frequency f (say 10kHz) will have sine wave components of f, 2f, 3f etc (but no sub-harmonics).

    So if you want to have pure sine wave, you have to use a high order band pass filter. But using a digital filter may be simpler in many cases.


    1 members found this post helpful.

  5. #5
    Advanced Member level 4
    Points: 5,647, Level: 17
    kripacharya's Avatar
    Join Date
    Dec 2012
    Location
    New Delhi
    Posts
    1,026
    Helped
    173 / 173
    Points
    5,647
    Level
    17

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    A 'square' wave does not have 1f 2f 3f.... It only has odd harmonics - 1f 3f 5f etc

    - - - Updated - - -

    A bandpass filter is much harder to design and achieve than an equal order lowpass. In any case, there is no need for a BPF, unless you are targeting one of the harmonic components.

    - - - Updated - - -

    The design of digital filters is a deceptively complex topic. Although filters are easily understood and calculated, the practical challenges of their design and implementation are significant and are the subject of much advanced research.

    In addition the need for appropriate ADC, anti-alias filters, the actual DSP, develipment environment & toolchains, the DAC, another LPF after DACetc etc would definitely not make it 'simpler'. As illustrated by KlausS above also.

    - - - Updated - - -

    KlausST idea to use a comparator to 'square up' the wave is interesting, since then any 2f component is removed, and the LPF design made easier.


    1 members found this post helpful.

  6. #6
    Super Moderator
    Points: 74,899, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,186
    Helped
    3460 / 3460
    Points
    74,899
    Level
    66

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Hi,

    KlausST idea to use a comparator to 'square up' the wave is interesting, since then any 2f component is removed, and the LPF design made easier.
    It all depends on the OP's requirements and the input signal.

    In worst case the input signal (including overtones) has more then one zero cross in a (low frequency) period. Making the comparator solution impossible. An LPF in front of the comparator may give improvements.

    Another approach could be a LIA (lock in amplifier).

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  7. #7
    Advanced Member level 4
    Points: 5,647, Level: 17
    kripacharya's Avatar
    Join Date
    Dec 2012
    Location
    New Delhi
    Posts
    1,026
    Helped
    173 / 173
    Points
    5,647
    Level
    17

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    If it has zero cross due to overtones then the LPF will filter it out. I don't see any problem in this.



  8. #8
    Advanced Member level 5
    Points: 16,357, Level: 30

    Join Date
    Nov 2012
    Posts
    2,995
    Helped
    727 / 727
    Points
    16,357
    Level
    30

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    A 'square' wave does not have 1f 2f 3f.... It only has odd harmonics - 1f 3f 5f etc...
    You are right.

    A square wave is an odd function and all the even harmonics are absent. But they are there for an arbitrary waveform.

    Sorry for the oversight.


    1 members found this post helpful.

  9. #9
    Advanced Member level 4
    Points: 5,647, Level: 17
    kripacharya's Avatar
    Join Date
    Dec 2012
    Location
    New Delhi
    Posts
    1,026
    Helped
    173 / 173
    Points
    5,647
    Level
    17

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    AFAIK lock-in-amps are used to detect presence of very weak but known frequencies, and not for OP's requirement.



  10. #10
    Super Moderator
    Points: 74,899, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,186
    Helped
    3460 / 3460
    Points
    74,899
    Level
    66

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Hi,

    It is not mentioned whether the frequency is known or unknown...

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  11. #11
    Advanced Member level 4
    Points: 5,647, Level: 17
    kripacharya's Avatar
    Join Date
    Dec 2012
    Location
    New Delhi
    Posts
    1,026
    Helped
    173 / 173
    Points
    5,647
    Level
    17

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Quote Originally Posted by KlausST View Post
    Hi,

    It is not mentioned whether the frequency is known or unknown...

    Klaus
    That is irrelevant..... no ?
    If it is unknown, then you cannot use LIA. And if it is known, then the LIA has to generate that frequency, in which case why do you need original signal ??

    - - - Updated - - -

    Maybe now we wait for OP to show some interest.



  12. #12
    Super Moderator
    Points: 256,485, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,748
    Helped
    13609 / 13609
    Points
    256,485
    Level
    100

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    My principle answer to the original question is:

    Use PWM. Sample the input signal with a rate above Nyquist (plus a margin accounting for feasible output filter order). Convert the sample magnitude to respective width of one center aligned pulse. Sinx/x correction required for frequencies near fs/2.



  13. #13
    Full Member level 5
    Points: 1,257, Level: 8

    Join Date
    Jan 2019
    Posts
    255
    Helped
    50 / 50
    Points
    1,257
    Level
    8

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Nurahmed

    please provide some information

    what frequency, or frequency range is required?
    adjustable or fixed?
    harmonic content?

    is it necessary to generate from a different wave form?
    or can it be generated by an oscillator ?

    what voltage and power level?



  14. #14
    Advanced Member level 5
    Points: 49,889, Level: 54
    Achievements:
    7 years registered
    Audioguru's Avatar
    Join Date
    Jan 2008
    Location
    Toronto area of Canada
    Posts
    8,674
    Helped
    2025 / 2025
    Points
    49,889
    Level
    54

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    I have used a Switched Capacitor Butterworth Lowpass Filter IC to produce an audio sinewave with extremely low distortion (almost no harmonics) and others used the filter IC to produce a very good sinewave from a squarewave.
    The cutoff frequency is set with an internal or external high frequency oscillator.



  15. #15
    Advanced Member level 5
    Points: 39,001, Level: 48

    Join Date
    Mar 2008
    Location
    USA
    Posts
    6,305
    Helped
    1837 / 1837
    Points
    39,001
    Level
    48

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Could use a PLL to generate a 2^N*Fin clock, roll a counter
    through a sine wave lookup ROM/PROM/EPROM and use that
    data to control a second "on time" counter (load) for PWM
    creating a sine at the far side of a suitable filter (if it's power)
    or just use the PWM logic signal raw (maybe through offset /
    gain / filter chain) if small signal.



  16. #16
    Newbie level 5
    Points: 54, Level: 1
    Nurahmed's Avatar
    Join Date
    May 2019
    Location
    Montreal, Canada
    Posts
    9
    Helped
    0 / 0
    Points
    54
    Level
    1

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Quote Originally Posted by Nurahmed View Post
    I need to generate a low frequency sine wave from any waveforms (square wave, triangle wave, etc.). I know Class D amplifier has high efficiency, but the switching frequency of square wave is very high. Is there any waveforms that has lower switching frequency, and use some filters to generate a sine wave?

    Thanks.
    Dear All,

    Thanks for the kind reply. Here are the more specific requirements:

    Click image for larger version. 

Name:	Load_Requirements.jpg 
Views:	4 
Size:	10.0 KB 
ID:	153336
    Click image for larger version. 

Name:	Accuracy.jpg 
Views:	6 
Size:	56.4 KB 
ID:	153337



    •   AltAdvertisement

        
       

  17. #17
    Super Moderator
    Points: 256,485, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,748
    Helped
    13609 / 13609
    Points
    256,485
    Level
    100

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Here are the more specific requirements
    How P<=1W has to be read? Maximal real load power? Or what?

    You didn't yet further explain your initial specification "generate a low frequency sine wave from any waveforms". Literally, the specification seems useless to me. It has been understood in the further discussion as class-D like switching power stage and the discussion went on about appropriate carrier frequency, switching pattern etc.

    Seeing your latest THD and SNR specification, it becomes clear that some filter effort is involved, and that you shouldn't choose the carrier frequency too low to keep the filter feasible.



  18. #18
    Newbie level 5
    Points: 54, Level: 1
    Nurahmed's Avatar
    Join Date
    May 2019
    Location
    Montreal, Canada
    Posts
    9
    Helped
    0 / 0
    Points
    54
    Level
    1

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Quote Originally Posted by FvM View Post
    How P<=1W has to be read? Maximal real load power? Or what?

    You didn't yet further explain your initial specification "generate a low frequency sine wave from any waveforms". Literally, the specification seems useless to me. It has been understood in the further discussion as class-D like switching power stage and the discussion went on about appropriate carrier frequency, switching pattern etc.

    Seeing your latest THD and SNR specification, it becomes clear that some filter effort is involved, and that you shouldn't choose the carrier frequency too low to keep the filter feasible.
    Hi,

    You are right. P<=1W is the load power. As you can see in the spec I need to generate a sine wave that its frequency can be fallen any between DC to 10kHz. How can choose my carrier frequency? The carrier frequency shouldn't be too low, but how low it can go?

    Thanks



  19. #19
    Super Moderator
    Points: 256,485, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,748
    Helped
    13609 / 13609
    Points
    256,485
    Level
    100

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    Not lower than imposed by the Nyquist criterion. In practice at least 25 to 30 kHz, higher if you want to keep the filter effort low.



  20. #20
    Full Member level 5
    Points: 1,257, Level: 8

    Join Date
    Jan 2019
    Posts
    255
    Helped
    50 / 50
    Points
    1,257
    Level
    8

    Re: How can I generate Sine wave from any periodic waveform that has low frequency?

    you specified a sin wav up tp 10 kHz, with THD < 5%

    where does carrier frequency come in?
    carrier frequency implies some sort of modulation.
    is there any expected modulation?



--[[ ]]--