Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Sine wave generator

  1. Aug 16, 2009 #1
    I need to build an in-phase sine wave generator with quadrature output and its frequencies are between 1KHz-12 KHz and it need to be voltage controlled

    Thanks for any help anyone can provide.
  2. jcsd
  3. Aug 17, 2009 #2


    User Avatar

    Staff: Mentor

    Welcome to the PF. Is this a school project? What research have you done into ways to construct such a generator? What analog ways do you think you could do this? What digital or mixed-signal ways could you do this?

    We would prefer that you did the bulk of the work on your school projects.
  4. Aug 21, 2009 #3


    User Avatar
    Science Advisor

    This could be done by clocking four 8 bit parallel output Eproms at the same time.

    The Eproms would have to be programmed with precalculated data giving sinewave values for each 10 degrees between 0 and 360 degrees but stored in 4 sets that gave the values 90 degrees apart.

    The clock would have to be a pulse stream at 36 times the desired output frequency.
    So, it would have to cover 36 KHz to 432 KHz.

    The output could go to a ladder network which would turn the 8 bit digital output into a sinewave. This would need filtering.

    If 10 degree stepping created an output that was too rough, more steps could be included but this would need a faster clock rate.
  5. Aug 24, 2009 #4
    There are any number of ways to do this; the easiest probably being to program a small processor with a look up table and an R2-R ladder.

    A more gruesome method would be to use a VCO followed by a quadrature generator (hint-three flip-flops) then integrate the outputs of the quad generator to get two sawtooth waves. Put the sawtooth waves into a saw to sine wave converter - very messy.

    One method that would probably be much neater is to us a pair of LM13700 as they're shown in figure 17 of the Nation semiconductor data sheet. The oscillator shown is a phase shift type, so A2, A3, and A4 are outputting 0, 60, and 120 degrees. If you need 90 degrees, do the math and take a bit of 60 and a bit of 120 (in the correct proportions :approve: ).

    Now, one technique I haven't tried (hence it could be your own mad success story), is to use two oscillators at a frequency substantially above your output (i.e 100kHz) and beat them down to your range of interest.
    My suggestion is to use a CD4046 for your VCO and buffer the triangle wave output with a simple emitter follower (Ie~2ma). Use an NE555 (note 1) for your reference frequency, which needs to be about 4x your VCO. Using three flip-flops (design left to the student), build a quadrature generator. It will divide the output of the 555 by four and give you 0 and 90 degree outputs.
    Now, the interesting (though a bit theoretical) part of this is that the output of the 4046 is sawtooth shaped and should have even harmonics (1fs, 2fs, 4fs, 6fs....), while the outputs of the quad generator are square waves and will have odd harmonics (1fq, 3fq, 5fq...) if you multiply the two together, you get the following in the spectrum:
    1fs-1fq (useful!), 1fs+1fq, 1fs-3fq, 1fs+3fq, 2fs-1fq, 2fs+1fq, 2fs-3fq, 2fs+3fq......
    Assuming fs and fq are close in frequency, but far from the output frequency, (1fs-1fq), then all the extraneous values are much higher in frequency than (1fs-1fq). That makes it easy to eliminate everything except the sine wave with a low pass filter :smile:.
    The easiest multiplication you can perform is to turn something on and off. In this case, you want each of the two quadrature square waves to control a switch (or switches) such that you get +1 x sawtooth when high is applied and -1 x sawtooth when low is applied. A CD4066 may prove useful for switches. Finally, put a third order lowpass filter (fo about 2x your top output frequency) on the output of each multiplier. This should leave clean, healthy sine waves - if it works.


    Note - The NE555 tends to have a slow fall time. Thus, it is, at times, troublesome to use with fast flip-flops. Usually, a 1k pull down resistor will cure the problem. In general, though, the 555 is better suited to older, CD type, logic.
  6. Aug 24, 2009 #5


    User Avatar
    Science Advisor

    I think we lost him. He checked in a couple of hours after the first reply and hasn't been back since. I feel bad about that.

    Interesting brainstorming.
    Which one would you try first?
  7. Aug 24, 2009 #6
    For curiousity's sake, I'd like to try the last one - two generators. But, if the boss said we need to ship em, I'd either do number one, the processor.

    I miss the dear old days of analog, so I may just dig through the junk drawer and try the last idea.

    It's always good to see how well you're complying with reality...

    - Mike
  8. Aug 24, 2009 #7


    User Avatar
    Science Advisor

    I wondered how you would get 4 outputs from a processor? Are there any with four 8 bit output ports?
    A very fast one with four pulse width modulation outputs might be able to do it. Maybe.

    How were you thinking of doing it?
  9. Aug 24, 2009 #8
    I think the fellow was asking for a quadrature signal, which would be 0 and 90 degrees. From that, he can build any phase he wants through simple arithmetic.

    As for the method, I'd likely use an 8 bit port. Four bits off the top and four off the bottom going into two, four-bit, R-2R ladders would give me a nice step-wise approximation. That would knock most of the low order harmonics off and a follow up LPF would polish it up.

    Of course, if you want it really pretty, you can use a higher resolution R2-R and toggle it between the two outputs with an analog switch.

    Hmmmm, it occurs to me that a 7-bit R2-R with the top bit dedicated to toggling would make for a very simple look up table scheme. Then again, having the processor run at 2X the rate to keep up with both channels doesn't sound good. Perhaps an alternate port or an external latch would be best. Then both channels could be updated at about the same time.

    What always makes these processor-based clocking systems less than fun for me is converting from the desired input, frequency, to the way the processor sees the world, period. For us, 1/f is a simple calculation but for a little processor that's strumming it's brains out to produce a 10 kHz sine wave, finding extra time for a division routine is murder. Again, here comes the look up table to the rescue....
    Last edited: Aug 25, 2009
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook