Shop OBEX P1 Docs P2 Docs Learn Events
DEMO, new FM broadcast code using Chip's Video mixer method + explanation — Parallax Forums

DEMO, new FM broadcast code using Chip's Video mixer method + explanation

pedwardpedward Posts: 1,642
edited 2012-08-25 06:46 in Propeller 1
I came across this post: http://forums.parallax.com/showthread.php?120170-AM-and-FM-Transmitters&p=884290&viewfull=1#post884290 and thought it was interesting enough to follow up.

I haven't seen anyone do what he suggested, so I modified my FM broadcaster demo to use the video modulator.

In Chip's post it suggests that you should not have 1's in more than 5 MSB positions. I'm operating the PLL outside of the specified range, generating a 140Mhz carrier (6 MSBs), plus a 6.550Mhz sub carrier.

The audio is very crisp and clear, and the jitter, birdies, and harmonics appear to be a lot better at first blush. I'm going to do some additional testing. I've got it attenuated into a 100 Ohm resistor on the breadboard right now.

Attached is the code.

Here's a video: http://youtu.be/pQlqV8Iyqfw


EDIT: I have revised the code so that PLLB is used for the broadcast generation and PLLA is used for sub-carrier modulation, only 1 COG is needed, not 2. I have also attached a nice WAV file for experimentation. :lol:

The way this works, the video generator is setup to only generate a broadcast aural sub-carrier, no video output. The PLL mode is set to 1, internal, with the output pin set to pin 7 for audio. Since the video generator expects PLLB to be setup at the proper broadcast frequency, that is used to generate a low-jitter carrier onto which the aural sub-carrier is modulated.

You can use the PLLA on the same COG to generate the aural sub-carrier since PLLA isn't used for generating baseband video. According to Chip's post above, the video generator XORs the sub-carrier onto the broadcast carrier, mixing the 2 values. This should generate a broadcast carrier of high stability and an upper image that is at frqPLLB + frqPLLA.

The attached sample has constants for several different frequencies, 80 + 6.5Mhz, 100 + 6.5Mhz, and 140 + 6.550Mhz. The lower 2 are broadcast FM frequencies which typically have a channel spacing of 200Khz and a bandwidth of 150Khz. To get a decent output volume the audio sample has to be shifted by 14 places, or 16384 to increase the deviation of the sub-carrier, that is a modulation of 8+14 bits, 22 bits. On the 2M band the channel spacing is much smaller and requires only 10 places of amplification, 1024, 8+10 bits, 18 bits. If you multiply the sample too much, you will overmodulate and get clipping, or worse, deviate outside your allotted channel width.

For the broadcast FM, 22 bits is a bandwidth of 40Khz, for 2M the 18 bits is 4.8Khz, so you can see, at 2M our deviation is within the recommended max 10Khz, and for broadcast FM, we can accommodate high quality audio, albeit monaural.

I'm a bit more confident in the quality of this modulation than the first try I did (directly modulating a single PLL). I haven't yet put this on a spectrum analyzer, but as soon as I can borrow one, I will (my father has a 1.2Ghz unit).

How is this demo useful? Well, there are several people that have been working on APRS, starting with the Bell 202 object. With this sample, you could direct modulate APRS or another low speed data protocol, allowing something like a quadcopter to send back telemetry for nearly free (Ken KI6HBT, are you reading this?).

Let's talk antennas. I tested this code with 2 antenna strategies, the first was just a 100 Ohm resistor, which limits the current output to 33ma, which is ~109 milliwatts. This was quite powerful, even without a proper antenna. My second test was with a 4.7k resistor, which limits the output to ~2.3 milliwatts. At 2mw, the PPDB board with resistor could broadcast over 80 feet before significant signal degradation.

The formula for antenna length is 468 / fMhz, this gives you a half wavelength antenna in feet, using a .97 free air velocity factor. It's unlikely that a 1/2 wavelength antenna would be used with this, so you will probably go shorter.

For the small data comms, they typically use either board traces or a wire antenna. A wire antenna is basically an isotropic unbalanced antenna that uses the PCB as the ground plane. The PCB ends up being the half of the antenna that isn't the wire, if you were looking at it like a dipole.

A good rule of thumb is to have a minimum antenna length of 1/8th wavelength, losses are so significant that it doesn't make sense to go shorter. As an example taken from here: http://www.kc7key.org/presentations/Vertical%20Antenna%20Myths%20final%20version.ppt A proper 1/4 wave antenna can have less than 3db loss, but a 1/8th wave antenna can have 12db of loss. To put that in perspective, a 3db loss means about 70% of the power you put into the antenna is radiated, at -12db you only get 25% of the power output -- that is 75% of the transmit power going into heating and losses.

At 1/8th wavelength, a 12db loss will mean that 108mw in translates to only 6.8mw output. A 1/4 wave antenna will radiate ~54mw for the same power input!

For a quadcopter that uses 144.390 Mhz (the standard 2M data channel), your half wavelength is 38.89 inches, 1/4 is 19.44, 1/8th is 9.72 inches, then you divide that by 2 if you are using a ground plane whip style, that's 4.86 inches.

A wire antenna that is just under 5 inches really isn't an imposition for a quadcopter. You can shorten the physical length by wrapping the antenna around a dielectric, which keeps the effective length the same. It's common to see mag mount antennas on cars that have coil loops at the base, this has the effect of shortening the physical length and creating a small air core loading coil at the base of the antenna. The loading coil causes the area below the coil to radiate the primary energy, as an inductor causes a phase shift and current lag in the RF signal. You will see some antenna manufacturers put the loading coil at the top of the antenna to increase the effective radiating element, this is mostly done on CB antennas and lower frequency HAM antennas (or center loading coils).

See:
http://hf-antenna.com/013/
http://www.qsl.net/g3pto/mobant.html
http://www.sstran.com/pages/sstran_buildant.html
http://www.amateur-radio-wiki.net/index.php?title=Antenna_loading
http://www.see.ed.ac.uk/~jwp/radio/software/loading.html

Hopefully this post is useful and opens up some applications for the Propeller. Oh, and please excuse any inaccuracies, I tried to explain things with references and from what I remember reading the HAM books. I'm sure any errors will be pointed out.
«1

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-02-05 18:25
    Pretty slick...


    Relating to a recent project.. Could 310Mhz be achieved this way?

    OBC
  • pedwardpedward Posts: 1,642
    edited 2012-02-05 22:13
    Jeff, my testing proves that at least 420Mhz is just outside the range of usable. I was unable to quickly check 310Mhz, but I'm skeptical that anything above 220Mhz is iffy.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-05 22:22
    One thing that works really well is to use the video in broadcast mode to just create a carrier near the target transmit frequency. Then, select another cog's CTRA PLL output for an aural subcarrier. The two will be XOR'd together, giving you two images in the spectrum.
    pedward wrote:
    I'm operating the PLL outside of the specified range, generating a 140Mhz carrier (6 MSBs), plus a 6.550Mhz sub carrier.

    You're also emitting an equal amount of energy at 140 MHz minus your 6.550 MHz subcarrier, not to mention odd harmonics of both frequencies.

    -Phil
  • pedwardpedward Posts: 1,642
    edited 2012-02-05 23:38
    Yes, I glossed over the low side image. I would recommend using a passband filter or at a minimum a high-pass filter to block the low side image (133.45Mhz in the case of the 2M output).
  • kuronekokuroneko Posts: 3,623
    edited 2012-02-06 00:35
    pedward wrote: »
    EDIT: I have revised the code so that PLLB is used for the broadcast generation and PLLA is used for sub-carrier modulation, only 1 COG is needed, not 2.
    Last time I checked counter B was not wired to the video h/w. So how do you generate the broadcast (with ctrb that is)?
  • pedwardpedward Posts: 1,642
    edited 2012-02-06 01:19
    The datasheet says the broadcast carrier frequency is generated by ctrb, I just followed the datasheet.
  • kuronekokuroneko Posts: 3,623
    edited 2012-02-06 01:25
    pedward wrote: »
    The datasheet says the broadcast carrier frequency is generated by ctrb, I just followed the datasheet.
    Got it. One of the less often referred to (by me) parts of the documentation :)
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2012-02-06 01:55
    I've been on a row of long days, so the thinking is dulled more than usual (yes it is possible).

    If the LS bits have to be kept zeros for the dreaded jitter did you choose the 6.55MHz so that by chance this allowed for 144MHz to be free of any "ones", or was it that it was just handy. I will have to try and work out what the stepping frequency interval could be so that those bottom bits were left low.

    I thought that I had a 74HC4046 kicking around to try Phils slaved VCO idea. It would have to be down around 20-25MHz and multiplied back up. I have better access to a R&S FSH3 analyzer now so at least I could see some of the nasties that crop up. I am more interested in the 137MHz NOAA wx sats which do require a bit more Rx bandwidth, fortunately. I wonder if 2M with 12.5KHz channel spaced, 2.5KHz deviation would be a bit tight for any, significant, amount of jittering.

    EDIT I have now realized that the 6.55 wasn't the Xtal freq. Hey-Ho.
  • pedwardpedward Posts: 1,642
    edited 2012-02-06 12:42
    Toby,

    Chips post recommended using a broadcast frequency with no more than 5 of the MSBs set. That will take you up to 120Mhz, but that would mean modulating a 26.55 Mhz sub-carrier to generate 146.550. I would expect a larger sub-carrier frequency would contribute to jitter and harmonics, so I tried to keep it small.

    I have attached a spreadsheet I made that shows all of the possible single bit PLL frequencies. It is quite clear just where jitter comes from when looking at the spreadsheet. Looking at the data, I wonder if the jitter is caused more by odd frequencies (FRQ values that have a remainder) or simply the number of poles (number of frequency bins) the counter shifts through?

    Based on this spreadsheet, I can actually adjust my PLL values to produce the broadcast frequency with only bits in the top nibble, but that would put the NCO outside of the 4-8Mhz. Ill try it anyway...
  • BRBR Posts: 92
    edited 2012-02-06 20:13
    This is neat. It is pretty amazing what can be done with a propeller chip and a couple dozen lines of code.

    I'd like to try this demo, but radio is not my strong suit...could you elaborate on how to hook up a breadboard antenna? Is it literally as simple as a 4.7k resistor connected between a prop pin and ground (to make a very low gain antenna)? Or is a piece of wire of appropriate length a necessity? If yes, is it as simple as placing one end of the wire in electrical contact w/ the prop xmit pin and leaving the other end free?

    Thanks for the demo, this should be interesting.
  • pedwardpedward Posts: 1,642
    edited 2012-02-06 20:23
    You can run this demo without anything connected to the prop, but I recommend a 4.7k resistor from pin 7 to ground. This will give you sufficient output to test, without being obnoxious RF wise.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-02-06 20:46
    'Just a friendly reminder: emitting RF between 144 MHz and 148 MHz requires an amateur radio license, although very-low-power transmissions for experimental purposes may also fall under Part 15 of the FCC regs in the U.S (sub-part C that deals with "intentional radiators"). Know what you're doing before polluting the airwaves!

    -Phil
    AD7YF
  • pedwardpedward Posts: 1,642
    edited 2012-02-06 20:55
    Phil, the demo code broadcasts at 86.5Mhz by default. I figured that most people wouldn't have a 2M receiver anyway.

    But yes, you are 100% correct in pointing this out. The 2mw output is *MORE* than enough for testing and tinkering, 80ft+ radius line of sight without a tuned antenna.

    --Perry
    W0NKE
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2012-02-07 02:04
    I had thought about using a non jittering high value frequency and doing yet another mix with a lower one, but then I may as well use a xtal stage for the first bit. Then there are all those mixer products to fight ...

    I have a couple of 74HC4046s on order so that I can try Phil's "flywheel" circuit down at 20MHz, or so, and use the Prop for the stepping, thinking and display bits.

    Used to be G8LCU
  • pedwardpedward Posts: 1,642
    edited 2012-02-07 13:13
    I spoke to my father and we plan on putting this on his spectrum analyzer this weekend, when he's back in town. I will measure the carrier and products to see what the damage is.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2012-02-08 01:22
    Sometimes it is better to remain blissfully ignorant.

    Pride in the new project takes a knock, when you see that its output resemble the rear view of a frightened hedgehog :-)
  • BRBR Posts: 92
    edited 2012-02-08 19:18
    'Just a friendly reminder...Know what you're doing before polluting the airwaves!

    -Phil
    AD7YF

    Thanks for the link, and I'll heed your admonition. Rest assured I'm not planning on starting a pirate radio station, just wanted to try another interesting Propeller experiment.

    [At the risk of incurring the wrath of a moderator]...now I have this mental image of Browser staring intently at a scope, looking for the faintest sign that "those Propeller hooligans" are causing trouble on the airwaves..."Fil! Fil! Dey're at it ugain! Call da FCC..."
  • BrowserBrowser Posts: 84
    edited 2012-02-08 20:14
    not to worrie. i only moderate forumz. too bizzy napping to moderate airwavz too.

    -browz
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-12 20:36
    pedward,

    'Finally got around to trying your transmitter code. Here's what I observed using a Yaesu VX-2 HT, with the Prop programmed for a fundamental at 100 MHz, and working upward:

    100.0-100.3 MHz: quieting, no or little modulation.
    100.4 MHz: maximum modulation.
    Modulated birdies (strongest ones in boldface) at 102.1,103.9,104.2,105.2,106.5,107.7,108.7,109.3,110.7,...,118.4,119.6, and so on.

    Here's what the spectrum looks like:

    attachment.php?attachmentid=90543&d=1331609717

    Lots of birdies, I'm afraid, clear up into the aviation band, the 2m ham band, and beyond.

    -Phil
    640 x 480 - 17K
  • pedwardpedward Posts: 1,642
    edited 2012-03-12 20:55
    Phil, I'm unfamiliar with the readout on your scope, what was the relative power output of the birdies? I was expecting noise off-center, but I'm curious what the relative power output is off-center.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-12 21:00
    The vertical scale is calibrated in decibels, with each major division being 10dB down from the max. The major horizontal divisions in this case are 25 MHz. The vertical cursor is positioned at 100 MHz.

    Here's the same spectrum, zoomed in to 5 MHz per major division:

    attachment.php?attachmentid=90546&d=1331611441

    -Phil
    640 x 480 - 17K
  • gnategnate Posts: 8
    edited 2012-04-04 09:54
    If you are looking to filter the generated signal, you might consider TOKO's line of Helical filters http://search.digikey.com/us/en/cat/filters/helical/3408137?k=272mt for about $16 + S/H.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-04 09:58
    Bandpass filtering, unfortunately, does not help to reduce jitter or its in-band spectral artifacts.

    -Phil
  • gnategnate Posts: 8
    edited 2012-04-13 13:24
    Aren't the birdies primarily being generated by the digital mixing system? Why do we want to use the video mixer?

    Is its Chip's limitation of 5 ones in the MSB? (top word or byte?)

    Can we generate a simple PLL signal at 88-160mHz, and if so, what would it look like?

    For example, using a simple PLL counter with a /16 and a FREQx of 1CE13A92 would generate a 144.399 MHz signal, right? Could you run a spectrum analysis on that and see how bad the birdies are in-band (+/- 3MHz)?

    If it is fairly clean (-20db), then I have an idea for generating an FM signal from an analog input. (I'm fairly new to the propeller, so please excuse my generic oversimplification).

    Create a PASM cog to:

    1. Look up a FREQx value from a 256 byte table, spanning from 144.38875 to 144.39125 (144.399MHz +/- 2.5kHz /2 deviation). Use an index value to load the correct value into the FREQx register. (256 to keep it local to the 512 word cog).

    2. Use a sigma delta ADC on an input pin to increment or decrement the index. That way the analog signal picks the transmit frequency (FM modulation, right?). We would need to limit the index to between 0 and 255 (or perhaps -128 to +128).

    By using a local sigma delta ADC, we don't have to pass data through the hub (to reduce cycle time and therefore jitter). The analog signal could be any source, but it could also be the filtered (300-3000Hz) result of another Cog generating an audio signal of a APRS packet, who's source is another Cog creating an AX.25 packet from another Cog, picking apart the GPS signal from a VPN1513 GPS Receiver Module (with propeller on board!).

    (Okay, so pick it apart now!)
  • pedwardpedward Posts: 1,642
    edited 2012-04-13 13:40
    My first play with direct FM modulation did as you suggest, however it was REALLY noisy. The video modulator method is much less noisy.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-13 14:00
    gnate wrote:
    For example, using a simple PLL counter with a /16 and a FREQx of 1CE13A92 would generate a 144.399 MHz signal, right? Could you run a spectrum analysis on that and see how bad the birdies are in-band (+/- 3MHz)? If it is fairly clean (-20db),
    It's not at all clean. Propeller PLL output is rampant with jitter and the birdies that result, and it cannot be cleaned post-generation. You simply cannot use the PLLs to generate a clean signal suitable for transmission. I've tried. Other people have tried. None was successful.

    -Phil
  • pedwardpedward Posts: 1,642
    edited 2012-04-13 14:50
    How much is due to the main oscillator and how much is just the design of the PLL? Would it help to use a precision external oscillator?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-13 15:03
    The jitter originates in the NCO. The filter between the PLL's phase detector and the VCO has too short of a time constant to adequately remove the jitter.

    -Phil
  • gnategnate Posts: 8
    edited 2012-04-18 10:45
    Okay, never say die.

    How about a simple transmitter, either a MAX2606 at 0.1 mW (http://www.maxim-ic.com/datasheet/index.mvp/id/2323 and http://electroschematics.com/83/mini-fm-transmitter-max2606/) or a AD7012 at 25mW (http://www.analog.com/en/rfif-components/rfif-transceivers/adf7012/products/product.html).

    Now you say "yeah, go do it!". Wish I had the time.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-18 11:06
    An external VCO would work just fine. For the Propeller to act as a DPLL to lock the broadcast frequency, you would also have to add a frequency divider to bring the feedback frequency well below the 40 MHz Nyquist limit (80 MHz clock). A divide-by-4 would put it in the 25 MHz range, which should be okay.

    -Phil
Sign In or Register to comment.