Shop OBEX P1 Docs P2 Docs Learn Events
Heterodyne Sine wave generator - What if Tesla had a Propeller to play with? — Parallax Forums

Heterodyne Sine wave generator - What if Tesla had a Propeller to play with?

Beau SchwabeBeau Schwabe Posts: 6,568
edited 2008-07-28 11:19 in Propeller 1
Ok... So night before last lying in bed, trying to figure out how to produce a decent sine wave without completely dedicating a COG and using a HUGE inductor capacitor combination to get 60Hz for an inverter design I have in mind.· It dawned on me, that I could use a reference Sine wave at a much higher frequency thus eliminating the need for a large coil capacitor combination.· At first I thought I would just keep track of the reference frequency and sample at a specific phase and pass that along to the·equivalent 60Hz phase when I needed it...· That would work, but it would be more involved that I wanted to deal with.·· No,·I wanted something simple.· So keeping the higher reference frequency idea, I came up with a solution that only uses two counters.· Once·you set them, you don't have to mess with them, and your COG is free to do whatever else it wants, as long as it doesn't require a counter.· Cool HUH?·
·
A fixed or reference sine wave is created from a few external components.· A sine wave of your choice is created by heterodyning a different frequency (Your frequency plus the fixed reference frequency) with the reference sine wave.· The result is a decent Sine wave based on the·difference of two frequencies and virtually no·processing overhead ... plus a small inductor and capacitor combination for your sine wave reference.
·



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 7/25/2008 5:19:50 PM GMT
900 x 600 - 153K
900 x 600 - 153K
900 x 600 - 140K
900 x 600 - 154K

Comments

  • rokickirokicki Posts: 1,000
    edited 2008-07-25 17:19
    I'm a tiny bit confused. I don't see a circuit diagram, so I'm not sure exactly how the discretes come in to play.
    But certainly you can heterodyne two counters on the same pin, and low-pass-filter the result, to generate a
    reasonable low frequency (of course it will only be half the amplitude but that's not a big deal). Can you post
    a circuit diagram?
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2008-07-25 17:22
    rokicki,

    Try again, there is a schematic within the Spin file... somehow an older version got uploaded the first time... It is correct now.


    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 7/25/2008 6:03:19 PM GMT
    1141 x 645 - 146K
  • rokickirokicki Posts: 1,000
    edited 2008-07-25 18:37
    Okay, now I'm even more confused. I'm sure smarter people than me see this, but I don't.

    Why can't we just take the output of the two free-running counters and low-pass-filter and be done with it?
    Why do we need a resonant stage, and the pair of diodes?

    I guess I should just build the circuit and run the program and scope it, but I think I'm missing something
    very obvious.

    -tom
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2008-07-25 18:45
    rokicki,
    ·
    The Low-pass-filter method works okay at·a specific·frequency, but over a range of frequencies the sine wave deteriorates.
    ·
    Using an LC at a fixed specific frequency creates a nice natural sine wave... using that as a reference sine wave,·it is easier to generate·sine waves at other frequencies with better consistency.
    ·
    The use of the back-to-back diodes is to ensure that any loading on the output sine wave is reactive from the·coil and capacitor·rather than the I/O pin.
    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 7/25/2008 6:51:15 PM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-07-25 19:03
    Nice Curves!! (Geek porn)

    Why can't my UPS give a 60hz wave that pretty?!!

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    Need a part? Got spare electronics? - The Electronics Exchange
  • CJCJ Posts: 470
    edited 2008-07-25 20:58
    very nice, though I was expecting something a little more hair raising when you mentioned Tesla and Propeller in the same sentence

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
  • RsadeikaRsadeika Posts: 3,837
    edited 2008-07-25 21:20
    Last night on the History channel they had a show on Tesla; he would not have had time to use the Propeller, he was to busy conversing with Outer Space.
  • whickerwhicker Posts: 749
    edited 2008-07-25 23:59
    Personally, I can forgive Tesla's personality quirks for all that he invented for society and for the nature of things he was experimenting with. Yeah, I know it's funny to make fun of oddball, reclusive personalities, but this man was brilliant. And for massive projects like the Niagara Falls AC generators and lighting up the Chicago's World's Fair, I'm afraid he'd find the Propeller a bit boring in comparison.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2008-07-26 03:56
    whicker,

    Yes, Tesla was an interesting character. It's too bad that many of his greatest ideas have yet to be understood. I often wonder what some of the brilliant minds in history would have done with our modern "toys" if they had access to them at their disposal.

    Oldbitcollector,

    "Nice Curves!! (Geek porn)" - Thanks
    "Why can't my UPS give a 60hz wave that pretty?!!" - Is it a stepped modified sine wave?


    Note:

    Notice the output is only about 430mV, but it is consistent throughout all of the sine waves produced.· The consistency is one of the pro's about this sine wave generator.· Another is the little to no processing overhead required.· The reason for the 430mV output is simple really.... When you mix the two frequencies, you·loose about·half of the voltage right there, so 3.3V becomes 1.65V ...· You loose another 0.6V through the first diode, so now you have about 1.05V, and then another 0.6V through the second diode plus some of the energy lost in the coil/cap.·· ... So 1.05V becomes 450mV.··Even though the signal is small (430mV),·the overall signal to noise ratio is·about 86 to 1.





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 7/26/2008 4:19:51 AM GMT
  • VIRANDVIRAND Posts: 656
    edited 2008-07-26 07:17
    This does remind me vaguely of a tesla coil working in reverse. (Resonance+Voltage Loss)

    You can get a nice easy 3 volt (P-P) sine wave by using XOR to heterodyne two square waves and also a choke.
  • PerryPerry Posts: 253
    edited 2008-07-27 23:54
    my windows system crashed so I can not look at the spin code for this sine wave generator.

    how high a frequency can this code generate?

    Anyone want to comment on this to use a a "Local oscillator" for a software radio using the propeller

    Perry
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2008-07-28 07:31
    Perry,

    "how high a frequency can this code generate?" ... The initial intension was to generate low frequency sine waves without wasting processor overhead and without having to use a large inductor/capacitor combination to get a nice sine wave. I showed various sine waves produced from this program ranging from 5Hz to 100Hz mainly to illustrate the consistency in the wave shape and amplitude over the frequency range... The lowest frequency sine wave that you can produce with this program would be 1Hz and it's just as consistent as the other frequencies.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • AleAle Posts: 2,363
    edited 2008-07-28 07:45
    Hei Beau, this could easily replace a DDS smile.gif, at a fraction of the cost !. I just wonder if 20 kHz could be produced this way...
  • LeonLeon Posts: 7,620
    edited 2008-07-28 08:50
    I've used a software DDS using an AVR with a DAC to drive an ultrasonic transducer at around 25 kHz. Something similar should be feasible with a Propeller.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • TubularTubular Posts: 4,705
    edited 2008-07-28 11:19
    Really very neat, Beau.

    If I use your technique to generate a second 100Hz reference (using a 2nd counter/cog), what kind of phase resolution could theoretically be achieved between the two sinewaves? (I presume they can be phase locked)

    I apologise in advance if the answers to these are obvious, I'm just about to get to grips with the Prop counters...
Sign In or Register to comment.