DSPRelated.com
Forums

AM digital demodulation methods

Started by gretzteam April 23, 2010
gretzteam wrote:
>> >> How does the average value of samples of the carrier relate to the >> approximate value of the envelope? Would it help if the "carrier" were >> triangular? >> > > Yes you have a point here! All I've proven so far is that when the input > signal contains only a carrier, full scale, then the output of the lowpass > filter is pretty much exactly 0.63 (2/pi), which is the average value of a > full scale sine wave. > > I was pretty happy to see this, but that's probably not AM demodulation > just yet! But isn't this what the Analog version does when using bandpass, > full wave rectifier and capacitor?
Some analog implementations rectify and average, which is what you're doing. Some (the ones that have a series diode to a shunt cap) detect the peak of the waveform, then have the charge drained out of the cap by other circuit elements. I.e. a peak detector. Different things, but close enough when the carrier frequency is way higher than the audio. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Jerry Avins wrote:
> On 4/23/2010 4:24 PM, Tim Wescott wrote: >> Jerry Avins wrote: >>> On 4/23/2010 1:52 PM, gretzteam wrote: >>>>>> Use it, but understand it. Understand the implication of in-band >>>>>> interference. Understand the need to exclude out-of-band signals from >>>>>> the demodulation process. (The baseband low-pass filter can't remove >>>>>> aliases.) >>>>> >>>>> I am assuming that he is properly prepping the signal prior to the >>>>> multiplication by sin/cos and will pick appropriate filters at >>>>> baseband. >>>> >>>> >>>> Ok I must admit that I'm more confused than before! Why do you still >>>> need a >>>> bandpass filter for method 2? Isn't multiplying by sin/cos shifting the >>>> carrier frequency to DC? >>> >>> What Brent said. Keep in mind that you not only shift the carrier to >>> baseband, you also shift everything else down by a similar amount. >>> Where do the aliases of the out-of-band signals go? >>> >>>> About method 1 having the problem of peak values not being close to >>>> full >>>> scale, can we say that this is not a problem when fs>> carrier? >>> >>> When the carrier is adequately oversampled, method 1 works. I leave it >>> to you to determine what "adequate" means. How many samples per >>> carrier cycle are needed to ensure that one is at least 95% of either >>> peak? Is that a reasonable expenditure of resources? >> >> Except that by his original description he's not peak-seeking -- he's >> averaging the absolute value. That _ought_ to work better, but I don't >> know by how much. > > How does the average value of samples of the carrier relate to the > approximate value of the envelope? Would it help if the "carrier" were > triangular?
Well, the RF signal (not the carrier) is carrier * (audio signal + offset) -- so you can find a scaled value of the audio signal either by finding the peaks (as in traditional AM receivers) or by rectifying and averaging. I suspect (but would have to play with it to find out) that the rectify and average is not as harshly nonlinear, and therefore would stand a lower sampling (or carrier) rate. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Vladimir Vassilevsky <nospam@nowhere.com> wrote:
(snip)
 
> Even with ideal diode and ideal source, the angle of conduction is > determined by transcendental equation. Now account for impedance, > nonlinearity and add noise, and it gets really messy.
(snip)
> Jerry, do you know what was the rationale for choosing 455kHz > vs 465kHz standard IF ?
Interesting question. I don't see anything in wikipedia that hints as an answer. It seems obvious that it should be a multiple of 5kHz, and presumably set such that image frequencies don't come out in places you don't want them. Otherwise, my guess is that once one was chosen, and the appropriate parts started to get popular, there would be incentive to keep using the same frequency. That might be enough reason. I am interested to see what Jerry has to say. -- glen
Jerry Avins <jya@ieee.org> wrote:
> On 4/23/2010 5:05 PM, Vladimir Vassilevsky wrote:
>> Jerry, do you know what was the rationale for choosing >> 455kHz vs 465kHz standard IF ? > > The AM band is roughly 560 to 1600 KHz, a nearly 3:1 range. A little > thought reveals that the LO must be above the signal in order avoid a > band switch in the receiver. Someone did an image analysis to pick the > IF, and 455 came out. I don't know the calculation or if it made sense. > I remember 455, 456, even 460.
I was thinking a few minutes ago that it was obvious it should be an odd multiple of 5kHz, but maybe not so obvious. It is convenient in that the image frequency is also an odd multiple of 5kHz, and so between stations that are multiples of 10kHz. I used to know about the rules for TV channel assignment, partly based on where the image frequencies of other channels come out. (Especially for UHF.) It does seem that there are AM radio stations at 910kHz.
> Standard IF transformers locked in 45x. > It couldn't be very different. It needs to be below the AM band itself > and not so low that the selectivity becomes too high. Also, one doesn't > want many harmonics that fall into the band.
> If my cousin Jack were still alive, I could ask him. Among his patents > are the VTVM and the ratio detector. http://tinyurl.com/2g8koyp
I still have my Heathkit VTVM that I built many years ago. (Christmas present from my dad.) I don't use it so much, though, as I have a nice Fluke handheld. Sometimes that analog readout is useful, though. -- glen
On Apr 23, 7:59&#4294967295;pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
> Vladimir Vassilevsky <nos...@nowhere.com> wrote: > > (snip) > > > Even with ideal diode and ideal source, the angle of conduction is > > determined by transcendental equation. Now account for impedance, > > nonlinearity and add noise, and it gets really messy. > > (snip) > > > Jerry, do you know what was the rationale for choosing 455kHz > > vs 465kHz standard IF ? > > Interesting question. &#4294967295;I don't see anything in wikipedia that > hints as an answer. &#4294967295;It seems obvious that it should be a multiple > of 5kHz, and presumably set such that image frequencies don't come > out in places you don't want them. &#4294967295; > > Otherwise, my guess is that once one was chosen, and the appropriate > parts started to get popular, there would be incentive to keep > using the same frequency. &#4294967295;That might be enough reason. > > I am interested to see what Jerry has to say. > > -- glen
I am not sure that a multiple of 5KHz was required. the AM band is 10 KHz wide and when AM was defined it was in the context of a continuous tunable oscillator. Also, If I am not mistaken, Europe has a 9 KHz channel spacing.
Jerry Avins <jya@ieee.org> wrote:
(snip)
 
> Rarely is a carrier to be demodulated sampled at more than twice the > carrier frequency; that would be a waste. The sampling theorem tells us > that we have to sample more than twice the frequency corresponding to > the bandwidth of interest. There are some practical restrictions (the > second edition of Understanding Digital Signal Processing by Rick Lyons > has an excellent analysis of them) but in general, sampling 20 KHz wide > signal on a 356 KHz carrier can be accomplished with a 50 KHz sample > rate. A bandpass filter assures that the AM signal is not contaminated > by adjacent channels.
OK, but say one wants to minimize the analog circuitry, and fast digital circuitry is available, including a fast ADC. That would seem to go against the analog bandpass filter, but a lot of digital filtering after the ADC could be provided.
> With bandpass sampling, we need to exclude signals > both above and below the band being sampled. Even if the signal were > sampled at 1 MHz, a low-pass filter would be needed to substantially > eliminate all signals above 500 KHz.
But 1MHz is pretty slow for an ADC by now, isn't it?
> Incidentally, sampling at 1 MHz provides a little over 2 samples per > carrier cycle, with little chance that either of them will be near a > carrier peak and hence representative of the envelope. With bandpass > sampling at 50 KHz, there will be only one sample for every 9 or so > carrier cycles. There is then no hope of peak detection.
Even a small FPGA should allow for a lot of digital filtering that can run at 100MHz or so. -- glen
On 4/23/2010 6:09 PM, gretzteam wrote:
>> On 4/23/2010 5:03 PM, gretzteam wrote: >>>> >>>> >>>> How does the average value of samples of the carrier relate to the >>>> approximate value of the envelope? Would it help if the "carrier" were >>>> triangular? >>>> >>> >>> Yes you have a point here! All I've proven so far is that when the > input >>> signal contains only a carrier, full scale, then the output of the > lowpass >>> filter is pretty much exactly 0.63 (2/pi), which is the average value of > a >>> full scale sine wave. >> >> How many samples per carrier cycle do you have? How many carrier cycles >> do you average over? How long does that take, and what does that imply >> about the highest envelope frequency you can demodulate without > attenuation? > > Ok I'm way oversampled. I'm doing this to learn about it so I don't want to > have the added difficulty of sample rate (just yet). Here is the current > system - I should have posted this FIRST! > > parameters: > fs = 4MHz > carrier: 99kHz > > Currently, there is no noise, and no 'information' being modulated. Just a > carrier sine wave:) One gotta start somewhere! > > I then bandpass using a 2nd order bandpass filter centered at the carrier.
You realize that there's nothing for the bandpass filter to remove.
> Then take the absolute value. > Then lowpass filter using a 2nd order CIC filter all the way down to > something ridiculous like 10-50Hz.
You learned that the numbers are correctly manipulated, but little more.
> The output matches surprisingly well the 2*A/pi formula depending on the A > of the carrier.
It doesn't surprise me. The effective sample rate is even higher than it might seem. Successive carrier cycles have their sampled points in slightly different places along the curve. You get information about every point along the curve (well, almost) by overlaying enough cycles.
> Now if I do a frequency sweep, using a full scale sine wave from 0 to 2MHz > (fs/2), and plot the obtained average value after it settled, I get the > shape of the bandpass filter! I guess this was to be expected, which is why > I asked if 'method-1' was only dependent on the performance of the bandpass > filter.
The sweep probes the bandpass filter. Overall output falls when the filter attenuates the signal. How could it be otherwise?
> I guess so far my 'information' is only at DC, but it works well. > > Now, ff I modulate a 2Hz signal, I also see it at the output, with a DC > offset. > > And this is where I decided to post, since I didn't know how to measure > performance of the system when there IS information. > > Does this make sense?
It makes sense in that it fits together in an understandable way. It won't get you to a practical demodulator without a lot of tweaking. Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On 4/23/2010 7:23 PM, Tim Wescott wrote:
> Jerry Avins wrote: >> On 4/23/2010 4:24 PM, Tim Wescott wrote: >>> Jerry Avins wrote: >>>> On 4/23/2010 1:52 PM, gretzteam wrote: >>>>>>> Use it, but understand it. Understand the implication of in-band >>>>>>> interference. Understand the need to exclude out-of-band signals >>>>>>> from >>>>>>> the demodulation process. (The baseband low-pass filter can't remove >>>>>>> aliases.) >>>>>> >>>>>> I am assuming that he is properly prepping the signal prior to the >>>>>> multiplication by sin/cos and will pick appropriate filters at >>>>>> baseband. >>>>> >>>>> >>>>> Ok I must admit that I'm more confused than before! Why do you still >>>>> need a >>>>> bandpass filter for method 2? Isn't multiplying by sin/cos shifting >>>>> the >>>>> carrier frequency to DC? >>>> >>>> What Brent said. Keep in mind that you not only shift the carrier to >>>> baseband, you also shift everything else down by a similar amount. >>>> Where do the aliases of the out-of-band signals go? >>>> >>>>> About method 1 having the problem of peak values not being close to >>>>> full >>>>> scale, can we say that this is not a problem when fs>> carrier? >>>> >>>> When the carrier is adequately oversampled, method 1 works. I leave it >>>> to you to determine what "adequate" means. How many samples per >>>> carrier cycle are needed to ensure that one is at least 95% of either >>>> peak? Is that a reasonable expenditure of resources? >>> >>> Except that by his original description he's not peak-seeking -- he's >>> averaging the absolute value. That _ought_ to work better, but I don't >>> know by how much. >> >> How does the average value of samples of the carrier relate to the >> approximate value of the envelope? Would it help if the "carrier" were >> triangular? > > Well, the RF signal (not the carrier) is carrier * (audio signal + > offset) -- so you can find a scaled value of the audio signal either by > finding the peaks (as in traditional AM receivers) or by rectifying and > averaging. > > I suspect (but would have to play with it to find out) that the rectify > and average is not as harshly nonlinear, and therefore would stand a > lower sampling (or carrier) rate.
Even so, it takes more oomph to adequately upsample for averaging than to generate an analytic signal. Unless there is a frequency lock between the carrier and the sample clock, rectifying effectively doubles the chance of finding a point near the carrier peak and also doubles the number of points averaged over. That's a wash. Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On 4/23/2010 5:56 PM, Vladimir Vassilevsky wrote:
> > > Jerry Avins wrote: > >> On 4/23/2010 5:33 PM, HardySpicer wrote: >> >>> On Apr 24, 8:24 am, Vladimir Vassilevsky<nos...@nowhere.com> wrote: >>> >>>> HardySpicer wrote: >>>> >>>>> Synchronous demodulation using a PLL will give you 3dB improvement >>>>> over ordinary envelope detection. >>>> >>>> >>>> This is wrong. >>>> >>> It's in the textbooks...read it! >> >> >> What is ordinary envelope detection? Peak detection? > > Doesn't matter; It is very simple. Think of |I| vs sqrt(I^2 + Q^2)
Still, when someone claims "3dB improvement", I want to know what is improved upon. Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On 4/23/2010 8:27 PM, glen herrmannsfeldt wrote:
> Jerry Avins<jya@ieee.org> wrote: > (snip) > >> Rarely is a carrier to be demodulated sampled at more than twice the >> carrier frequency; that would be a waste. The sampling theorem tells us >> that we have to sample more than twice the frequency corresponding to >> the bandwidth of interest. There are some practical restrictions (the >> second edition of Understanding Digital Signal Processing by Rick Lyons >> has an excellent analysis of them) but in general, sampling 20 KHz wide >> signal on a 356 KHz carrier can be accomplished with a 50 KHz sample >> rate. A bandpass filter assures that the AM signal is not contaminated >> by adjacent channels. > > OK, but say one wants to minimize the analog circuitry, and fast > digital circuitry is available, including a fast ADC. That would > seem to go against the analog bandpass filter, but a lot of digital > filtering after the ADC could be provided.
I'll rephrase this:
>> With bandpass sampling, we need to exclude signals >> both above and below the band being sampled. Even if the signal were >> sampled at 1 MHz, a low-pass filter would be needed to substantially >> eliminate all signals above 500 KHz.
With baseband sampling, we need an anti-alias lowpass filter. With bandpass sampling, we need an anti-alias bandpass filter.
> But 1MHz is pretty slow for an ADC by now, isn't it?
Sure, but needing all those samples means that you need the MIPS (and the watts) to process them. Why do that?
>> Incidentally, sampling at 1 MHz provides a little over 2 samples per >> carrier cycle, with little chance that either of them will be near a >> carrier peak and hence representative of the envelope. With bandpass >> sampling at 50 KHz, there will be only one sample for every 9 or so >> carrier cycles. There is then no hope of peak detection. > > Even a small FPGA should allow for a lot of digital filtering > that can run at 100MHz or so.
I think the trade-offs between analog and digital selectivity keep changing as technology advances. What sample rate would be needed to digitize the whole AM band? Should we build receivers that way? Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;