DEMO: Direct 2M FM broadcast modulation with the Propeller
pedward
Posts: 1,642
So I was playing with my MFJ SWR meter as a frequency counter and toying with the PLL modes of the Prop. I found out that the prop would generate 220Mhz, so I grabbed my handy talky and started playing with the prop to see if I could generate a carrier the HT would pick up.
As luck would have it, it worked!
Now, the code attached is not exactly kosher; I have a HAM radio license (W0NKE) and I'm permitted to broadcast on those frequencies. If you don't have a HAM license, retune the PLL to a lower frequency in the broadcast FM range.
I arrived at the FRQ value from the equation in the Propeller Data Sheet. Restated, the equation is: FRQx = frequency / 16 / CLKFREQ * 2^32. The extra /16 is to account for the PLL running at 16X the NCO frequency.
The sample program plays a WAV file of 11.025 Khz over the air on 146.550MHz (the 2nd channel off of the national call frequency). In 2M the channel bandwidth is 20Khz and the spacing is 15Khz, I have tested this program to ensure it doesn't modulate wider than the permitted bandwidth.
I couldn't include the WAV file directly, but any 8-bit 11025Hz PCM WAV file will work as long as it fits in the EEPROM.
The bandwidth (and volume) is controlled by the bit shift of the WAV sample. I experimented with various values and found << 5 to provide the best balance of volume and channel use.
Now, there appear to be a significant amount of harmonics coming from this, so I definitely don't recommend hooking this up to a tuned antenna and putting it on the air! This is merely a trinket that you can play with. With a short wire as an antenna, it would transmit 40 feet without any degradation in signal strength.
As luck would have it, it worked!
Now, the code attached is not exactly kosher; I have a HAM radio license (W0NKE) and I'm permitted to broadcast on those frequencies. If you don't have a HAM license, retune the PLL to a lower frequency in the broadcast FM range.
I arrived at the FRQ value from the equation in the Propeller Data Sheet. Restated, the equation is: FRQx = frequency / 16 / CLKFREQ * 2^32. The extra /16 is to account for the PLL running at 16X the NCO frequency.
The sample program plays a WAV file of 11.025 Khz over the air on 146.550MHz (the 2nd channel off of the national call frequency). In 2M the channel bandwidth is 20Khz and the spacing is 15Khz, I have tested this program to ensure it doesn't modulate wider than the permitted bandwidth.
I couldn't include the WAV file directly, but any 8-bit 11025Hz PCM WAV file will work as long as it fits in the EEPROM.
The bandwidth (and volume) is controlled by the bit shift of the WAV sample. I experimented with various values and found << 5 to provide the best balance of volume and channel use.
Now, there appear to be a significant amount of harmonics coming from this, so I definitely don't recommend hooking this up to a tuned antenna and putting it on the air! This is merely a trinket that you can play with. With a short wire as an antenna, it would transmit 40 feet without any degradation in signal strength.
Comments
Makes Phils IQ demodulator even more valuable. Prop SDR Transceiver here we come...
I have too many prop projects already!!!
When I was a teenager my father would pick up the 137MHz weather sats, and that is still in me, I often look up and see them fly overhead and dream about receiving them again. It is so much easier to get a picture off of the tones now; back then it involved rotating drums or windscreen wiper motors.
(Those days made me the recycling hoarder that I am, "Thats too good to throw away... Thats bound to be useful, for something... ")
'Glad to see another RF experimenter amongst the Propeller crowd!
Have you scanned the entire two-meter band for your signal? How about for the third harmonic at 439.65 MHz? The reason I ask is that I've tried something similar myself on two meters with the PLL and found that there's enough frequency jitter to produce birdies all over the two-meter band and beyond. The jitter comes from values of frqx that have more than one "1" bit and arises due to the PLL's rather short filtering time constant. Unfortunately, there's no way to filter out the jitter, once it's introduced.
As a consequence, you might look into ways to control an external VCO with the Propeller to produce a clean signal. I've done a little bit in the HF range, but have not yet come up with a good way to extend that work to the VHF range. Plus, the breadboarding is a little trickier!
-Phil
-Phil
Addendum: Here's an early thread that talks about jitter and the birdies that result:
BTW, they can't be blocked adequately with an LC filter.
-Phil
Nothing but a carrier unsquelch at 439.650. Seems like there are harmonics at 110Khz intervals above the channel, so the Prop PLL is very noisy in this application. I don't fault the prop, it just does what it does. Now, had the PLL logic been setup so it was Before the NCO, like taps in most uC chips, it would address much of the jitter problems.
Perhaps a crystal or SAW band-pass filter would be up to the task of cleaning up the output?
-Phil
I was thinking that this could actually make a really useful foxhunt device. It's so simple, doesn't need an antenna, can be programmed into any Prop board, and the harmonics at 110Khz would actually be useful to finding the device, since the harmonics would be at a lower power. You start at the highest harmonic that receives it, then go up to the next to direction find. The closer you get, the stronger the signal on higher harmonics. Since most HTs have worthless power meters on them now, this would be a way of getting around that problem.
Now, to make a direct conversion receiver that measures the signal strength and displays it on the Quickstart LEDs...
-Phil
-Phil
We then started laughing about all sorts of conspiracy messages you could broadcast, EAS, paranoid ramblings, etc!
Since broadcast FM is on 200Khz spacing and is 19.8Mhz wide, that means ~1.2MHz coverage per counter. The harmonics are ~110KHz offset, so that's ~220Khz, which means it's darn close to the channel spacing on broadcast FM. I think you could blank the entire band with nothing more than a quickstart board and some short lengths of wire!
This is all just amusing thoughts, but it's really amazing just how trivial this is!
At first blush, that seems like it should be possible. I tried something like that once with two of them, starting them with different phases and summing. But then I realized that the Fourier transform is a linear operation, and that any frequency components extant in the individual counter outputs will also be present in their sum -- unless, of course, they're exactly 180 degrees out of phase. But I'm not optimistic that summing any number of outputs having the same frequency but with slightly different phases would produce the desired result.
One could also try generating individual jitterless components and mixing them to get sum and difference frequencies. This would work fine for maybe one or two steps. But once you get down to the smaller frequency components, filtering out the undesired image and harmonic components would become insurmountable.
As to the odd harmonics in square waves, theoretically you can sum multiple square waves to approximate a sine wave. IOW, you'd be using square waves as your basis function. In reality, though, you end up with some really weird discontinuities at the zeroes of the expected sine wave that become more prevalent, the more terms you add.
-Phil
I don't understand exactly how this program is modulating the wav file data.
I've read the parallax docs on the counters, but I still don't understand how the
counters are used to modulate two waveforms.
The key lines in the file, I think are :
FRQA := magicnum + byte[p] << 5
and previous to that : (setting up CTRA as PLL single ended)
CTRA:=%00010_111 << 23 + 0
From what I've read on AM modulation, the process is to multiply the carrier by the
baseband signal, which I would think would look something like this :
FRQA := byte[p] << 5 * PHSA[cnt]
or maybe :
FRQA := ( byte[p] << 5 * PHSA[cnt] ) + magicnum
The above two lines are just wild guesses (and from testing on my quickstart and getting no output
,apparently incorrect / non-sensical )
But this :
FRQA := magicnum + byte[p] << 5
looks like it is just ADDING the baseband (byte[p]) to the carrier (CTRA setup) ?
What type of modulation is this program doing ?
If it's FM (as the title of the thread implies), the code looks different than
the FM transmitter Dave Hein posted :
http://forums.parallax.com/discussion/download/67991/FMTransmitter2.spin
That code is :
repeat freq1 >> 1
frqb := freqb + delta
OUTA[LED1] := 1
waitcnt(numclks1 + cnt)
OUTA[LED1] := 0
frqb := freqb - delta
waitcnt(numclks1 + cnt)
I'm reading "Multiplying Signals (Amplitude Modulation)"
http://www.dspguide.com/ch10/5.htm
and " Convolution" http://www.dspguide.com/ch6.htm
to see how that applies to this spin file.
From the Multiplying signals page:
"
Since the spectrum of the carrier is a shifted delta function, the spectrum of the
modulated signal is equal to the audio spectrum shifted to the frequency of the
carrier.
Is that what this code is doing ? :
FRQA := magicnum + byte[p] << 5
Mike