AM and FM Transmitters
Dave Hein
Posts: 6,347
Last summer I wrote a program for the SX to generate an AM radio signal.· I used the radio signal to locate a buried wire in my sprinkler system, and it worked quite well.· I thought I would write a similiar program for the Propeller.· I found it very easy to implement using Spin code to generate the frequency tones, and an assembly routine that generates the carrier frequency.
The RF signal is very crude, but it works.· You can hear it on an AM radio at the main frequency and also at the harmonics.
Dave
Edit:· I looked at the code again, and I realized that the call to cognew should be after txnumclks is set.· It seems to work OK as is, but it would be better to call cognew just before the repeat loop.
Post Edited (Dave Hein) : 2/21/2010 11:51:29 PM GMT
The RF signal is very crude, but it works.· You can hear it on an AM radio at the main frequency and also at the harmonics.
Dave
Edit:· I looked at the code again, and I realized that the call to cognew should be after txnumclks is set.· It seems to work OK as is, but it would be better to call cognew just before the repeat loop.
Post Edited (Dave Hein) : 2/21/2010 11:51:29 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Dave
The routine that Dave posted produces a square wave which has a lot of harmonics, particularly with no filtering on it. Just adding a suitable tuned circuit can help a lot there, but you have to be careful about maximum voltages produced near resonance.
I would think it should be possible to get the video generator to do a much better approximation of a sine wave at AM frequencies, requiring much less LC smoothing with a lot less voltage transients. I suppose you could then modulate by changing the sine waveform map or using ... I know this is heresy ... an external transistor. Part 15 does allow you 100 milliwatts into your pitiful little stubby antenna, and while 3.3 volts at 30 milliamps is 100 milliwatts you'd have to have a very perfectly tuned antenna system to actually draw 30 mA at 3.3V.
Also it seems a 10 foot antenna limit means the frequency needs to be pretty high to have a good standing wave ratio and transmit efficiency. Quarter wave was popular when I was a kid. 2 meter radios worked nicely with 18" (50cm) it seems.
Post Edited (jazzed) : 2/21/2010 4:50:20 AM GMT
easily directly in Spin or by using another counter at audio frequencies. Two counters, and
you can (for instance) broadcast a 1.23KHz tone at 1.09MHz, with no further code needed,
and the spin then can do anything it wants (like vary one of the counters to sweep the
tone up and down). The 1.09MHz will be very dirty, but it should be easily receivable.
Specific frequencies will work much better and be much cleaner (like 80/64=1.25MHz)
since the counter can generate them with even-length pulses (always 32 clocks high
and 32 clocks low).
Square waves are odd harmonics. Look up Fourier functions.
A 1/4 wave antenna needs a ground plane, or some radials.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Post Edited (Leon) : 2/21/2010 11:24:08 AM GMT
Thanks for the suggestion about using the counters.· I re-did the AM transmitter code using one cog with it's two counters.· It's a shorter program, and it's all in Spin.· It work's great.
The exciting thing is that I was able to implement an FM-band transmitter as well.· With the 16x phase-locked-loop I was able to generate an RF signal in the 100 MHz range!· It is modulated by adjusting the frequency register of the counter around the center frequency value.· The nice thing about this is that it can be modulated with a fairly high precision baseband signal.· The dynamic range of the baseband signal is around +/- 50,000, or maybe more.
I have attached both the AM and FM transmitter programs.· It would be interesting to integrate the FM transmitter with a wavefile reader, and you could receive the wavefile audio on an FM receiver.
Dave
·· Great job, I never·think that propeller can generate this
good,good
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Juramento YAQUI.
Para ti no habrá sol, para ti no habrá muerte, para ti no habrá dolor, para ti no habrá calor, ni sed,· ni hambre, ni lluvia, ni aire, ni enfermedad, ni familia.Nada te causara temor, todo ha terminado para ti, excepto una cosa: HACER TU TRABAJO. En el puesto que has sido asignado, ahí te quedaras para la defensa de tu nación, de tu gente, de tu raza, de tus costumbres, de tu religión.! Juras cumplir con el divino mandato AHUI....!
Luis C. Yepiz
XE2NBW
·
Thanks.· I hadn't tried the counters before, and they are very useful.· I thought about the FM transmitter some more, and it's not quite as good as I thought.· At a an RF frequency of 100 MHz, the counter has an·average period of 12.8 cycles.· That means that sometimes it produces a·period of 12 cycles and other times it 13 cycles, with an average of 12.8.· The PLL must be very stable to produce a usable RF signal at 100 MHz.· The precision of the modulated signal isn't as good as I thought it would be, but it would still be useful for generating tones and coarsely quantized audio signals.
Dave·
The trick is to pick a broadcast frequency such that the value used for FRQx has a minimal number of one bits below the most-significant one bit. This will help to reduce PLL jitter and RF birdies.
-Phil
·
Nice work Dave.
·
Another old hobby I will have to get restarted.
·
KA2LHT
Use one of my 6.25MHz crystals, and you will get 100Mhz dead-on [noparse]:)[/noparse]
(well, within 30ppm, and PLL drift)
Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com 5.0" VGA LCD in stock!
Morpheus dual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory/IO kit $89.95, both kits $189.95 SerPlug $9.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler Largos - upcoming nano operating system
single pin of the prop, and selectively "ground" or "float" each capacitor to tune. If your Q is reasonable, you can probably cover a
frequency band pretty well with just a handful of caps. Not sure how to protect the output pins of the prop, though. Best might be to
use a single-transistor amplifier, one configured for high-frequency switching.
But the weak link in all this is the PLL.
The tuned LC circuit sounds like a great way to reduce the upper harmonics.· One advantage to the higher RF frequency for FM is that it will have fewer harmonics than a lower frequency because of the slew rate of the output driver.· I don't know what the output signal looks like, but I would guess that the rising and falling edges are rounded a bit.
Dave
You can tune an LC oscillator with a varactor driven from a filtered DUTY mode output. The output of the oscillator could be fed back to the Prop for closed-loop frequency generation. A more lightly filtered DUTY mode output summed into the same varactor could be used to modulate the frequency. Or ... you might find a happy medium and be able to use the same DUTY mode output for both. This would yield a much cleaner signal than you'd get from the Prop's PLL.
-Phil
For example, if you set the video broadcast for a nice big frequency that had no more than 5 MSBs before all 0's out to the LSB (low jitter, no birdies) in FRQB, then made an FM in the 2MHZ +/-100KHz·range on the other cog's CTRA PLL (2MHz is so low that you'll have very low jitter and birdies), you'd get very clear FM audio at·the main broadcast frequency·+/- the 2MHz.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point
Post Edited (Toby Seckshund) : 2/23/2010 9:11:34 PM GMT
Dave: Bill's 6.25MHz will get you 100MHz prop operation. DigiKey have (6MHz 96MHz) which I use on a TriBlade, 6.5MHz (104MHz) and 13.5MHz {PLLx8} (108MHz) which I use on the RamBlade.
Another idea... You can get programmable chips to deliver clock frequencies covering the range 80-108MHz which you could use for feeding the prop and a carrier cct as well.
VK2TZ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
He is saying 2Mhz plus or minus 100khz.
Graham
Son of late G0HLH
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
-Phil
Edit: BTW, Chip explained the conditions for clean PLL output much better than I did. I said to minimize the number of one bits below the most significant one bit. But that's only part of the story. As Chip implied, a better way to look at it is to maximize the number of continguous zeroes beginning with, and reaching upwards from, bit 0.
Post Edited (Phil Pilgrim (PhiPi)) : 2/23/2010 9:36:26 PM GMT
In COG #1 we create a 2MHz clean PLL frequency FM modulated (2MHz frequency modulated +/- 100KHz) and output this to say P0. The +/- 100KHz is the audio to be added. Isn't this quite wide or just an example???
In COG #2 we create a clean frequency near the desired frequency +/- 2MHz and use the video counter to take the input from P0 and mix it and output on say P1.
Then we would take P1 and externally filter out the unwanted frequency (i.e. band pass the required frequency).
Somewhere recently I read about a method of tuning by using micro's pins connected to tuning capapacitors and by either tri-stating the pins or grounding (output 0) them you could tune the loading. IIRC you are using something similar on the backpack.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
-Phil
Dave
Thank you, thank you, and in case Thank You.
I needed a good way to create a carrier for TV (channel 3), and this gave it to me (both the carrier for the NTSC, and the FM aural carrier).
OH and did I say thank you.