Heterodyne Sine wave generator - What if Tesla had a Propeller to play with?
Beau Schwabe
Posts: 6,568
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
·
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
Comments
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?
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
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
·
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.
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
You can get a nice easy 3 volt (P-P) sine wave by using XOR to heterodyne two square waves and also a choke.
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
"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.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
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...