## AM demodulation using I and Q

### AM demodulation using I and Q

I started a thread re: AM demodulation using I and Q a few weeks ago
and I am still having a problem.  According to Frerking, AM should be
A=sqrt(i^2+q^2).  This works if I tune off the AM zero beat frequency
by 1/2 the low pass filter bandwidth.  I don't understand this
problem.

A little more detail:

I am using a pair of mixers fed with a sin/cos local osc. to generate
I/Q at baseband.  SSB demod works fine for upper and lower sidebands
with excellent opposite sideband rejection.  I can zero beat the AM
carrier and receive upper, lower, or both sidebands to stereo output.
I am using a DDS LO and I am able to accurately zero beat the AM
carrier to less than 1hz. When I do this while listening to both
sidebands or I/Q in stereo, I can hear the sidebands come into phase

Once I have the signal zero beat, I flip it into the AM algorithm and
I hear a great deal of distortion.  Assuming I use a low pass filter
(actually a bandpass) from 30-4000hz, prior to the sqrt(i^2+Q^2) math,
if I move off zero beat by 2000hz, the AM sounds great.  I can move
either higher or lower by 2000 with the same results. It almost seems
like the filter is acting like a mixer??

I'm missing something here.  When I modeled this receiver using Matlab
Simulink, it works fine at zero beat.  If I get this simple
demodulator working I am going to move onto synch AM.  I actually like
listening to the independent sidebands in stereo since it takes care

thanks.

### AM demodulation using I and Q

> I started a thread re: AM demodulation using I and Q a few weeks ago
> and I am still having a problem.  According to Frerking, AM should be
> A=sqrt(i^2+q^2).  This works if I tune off the AM zero beat frequency
> by 1/2 the low pass filter bandwidth.  I don't understand this
> problem.

> A little more detail:

> I am using a pair of mixers fed with a sin/cos local osc. to generate
> I/Q at baseband.  SSB demod works fine for upper and lower sidebands
> with excellent opposite sideband rejection.  I can zero beat the AM
> carrier and receive upper, lower, or both sidebands to stereo output.
> I am using a DDS LO and I am able to accurately zero beat the AM
> carrier to less than 1hz. When I do this while listening to both
> sidebands or I/Q in stereo, I can hear the sidebands come into phase
> as I tune the radio.

> Once I have the signal zero beat, I flip it into the AM algorithm and
> I hear a great deal of distortion.  Assuming I use a low pass filter
> (actually a bandpass) from 30-4000hz, prior to the sqrt(i^2+Q^2) math,
> if I move off zero beat by 2000hz, the AM sounds great.  I can move
> either higher or lower by 2000 with the same results. It almost seems
> like the filter is acting like a mixer??

> I'm missing something here.  When I modeled this receiver using Matlab
> Simulink, it works fine at zero beat.  If I get this simple
> demodulator working I am going to move onto synch AM.  I actually like
> listening to the independent sidebands in stereo since it takes care
> of some of the fade.

> thanks.

I don't understand the sqrt(i^2+q^2). Intuitition tells me (i + q)/2.
When you tune over by half the passband, one of the sidebands
disappears, and so does the distortion. Do you know that if you
eliminate one sideband from an otherwise normal AM signal, then square
the peak-detected output, the result is pretty distortion free?

Jerry
--
Engineering is the art of making what you want from things you can get.

### AM demodulation using I and Q

> > I started a thread re: AM demodulation using I and Q a few weeks ago
> > and I am still having a problem.  According to Frerking, AM should be
> > A=sqrt(i^2+q^2).  This works if I tune off the AM zero beat frequency
> > by 1/2 the low pass filter bandwidth.  I don't understand this
> > problem.

> > A little more detail:

> > I am using a pair of mixers fed with a sin/cos local osc. to generate
> > I/Q at baseband.  SSB demod works fine for upper and lower sidebands
> > with excellent opposite sideband rejection.  I can zero beat the AM
> > carrier and receive upper, lower, or both sidebands to stereo output.
> > I am using a DDS LO and I am able to accurately zero beat the AM
> > carrier to less than 1hz. When I do this while listening to both
> > sidebands or I/Q in stereo, I can hear the sidebands come into phase
> > as I tune the radio.

> > Once I have the signal zero beat, I flip it into the AM algorithm and
> > I hear a great deal of distortion.  Assuming I use a low pass filter
> > (actually a bandpass) from 30-4000hz, prior to the sqrt(i^2+Q^2) math,
> > if I move off zero beat by 2000hz, the AM sounds great.  I can move
> > either higher or lower by 2000 with the same results. It almost seems
> > like the filter is acting like a mixer??

> > I'm missing something here.  When I modeled this receiver using Matlab
> > Simulink, it works fine at zero beat.  If I get this simple
> > demodulator working I am going to move onto synch AM.  I actually like
> > listening to the independent sidebands in stereo since it takes care
> > of some of the fade.

> > thanks.

> I don't understand the sqrt(i^2+q^2). Intuitition tells me (i + q)/2.

Nonsense! that's (upper + lower)/2.

Jerry
--
Engineering is the art of making what you want from things you can get.

### AM demodulation using I and Q

Jerry, More input;

1) If I tune over by half the filtered I/Q channels, only half of one
sideband would be out of the passband, I think.

2) I found last night that if I zero beat wwv on 10.000.0mhz and
listen to the alternating 600 and 500hz tones, when I switch to the AM
the effect one would get from squaring a signal, correct?  My sqrt
function is working.

2.5) since I/Q are out of phase when I tune over by half, I think the
square problem is going away.  By the way, It doesn't have to be
exactly half, anything from about 25% on works but the audio sounds
best at half.

3) As far as sqrt(i^2+q^2), this should return the envelope of the
signal according to Frerking and others.  I don't think I should be
just applying this to one sideband.  If so, then 1/2 the signal will
be gone with a 3db s/n penalty.

4) Getting back to item (2), I am looking at decimating by 2 on the
output (or 4 on the input??) to clear up the problem.  I saw a diagram
of an AM demod by Dough Smith that had a decimation filter prior to
the sqrt function.

Thanks for your quick response.  I was hoping your would chime in.

Quote:> I don't understand the sqrt(i^2+q^2). Intuitition tells me (i + q)/2.
> When you tune over by half the passband, one of the sidebands
> disappears, and so does the distortion. Do you know that if you
> eliminate one sideband from an otherwise normal AM signal, then square
> the peak-detected output, the result is pretty distortion free?

> Jerry

### AM demodulation using I and Q

> Jerry, More input;

> 1) If I tune over by half the filtered I/Q channels, only half of one
> sideband would be out of the passband, I think.

Yes, but tuning over by half the RF passband will move one sideband
completely out of it. Which is it?

Quote:

> 2) I found last night that if I zero beat wwv on 10.000.0mhz and
> listen to the alternating 600 and 500hz tones, when I switch to the AM
> algorithm, the tones jump to 1200hz and 1000hz respectively.  This is
> the effect one would get from squaring a signal, correct?  My sqrt
> function is working.

Why are you square rooting? AM is simply the sum of the sidebands, I
think. On the other hand, a lone sideband beat with the carrier then
squared yields a clean signal, so each sideband squared yields two good
signals. Maybe you want the sum of the squares without the square root.
The square comes into it as the first term of a longer series, IIRC, but
I haven't done the analysis since about 1954, and I'm not certain.

Quote:

> 2.5) since I/Q are out of phase when I tune over by half, I think the
> square problem is going away.  By the way, It doesn't have to be
> exactly half, anything from about 25% on works but the audio sounds
> best at half.

> 3) As far as sqrt(i^2+q^2), this should return the envelope of the
> signal according to Frerking and others.  I don't think I should be
> just applying this to one sideband.  If so, then 1/2 the signal will
> be gone with a 3db s/n penalty.

> 4) Getting back to item (2), I am looking at decimating by 2 on the
> output (or 4 on the input??) to clear up the problem.  I saw a diagram
> of an AM demod by Dough Smith that had a decimation filter prior to
> the sqrt function.

> Thanks for your quick response.  I was hoping your would chime in.

<blush> I wish I still had those notes! Did you look in the ARRL
handbook? If it's not there, I may tackle the math for myself.

Jerry
--
Engineering is the art of making what you want from things you can get.

### AM demodulation using I and Q

[deleted]

Quote:

> <blush> I wish I still had those notes! Did you look in the ARRL
> handbook? If it's not there, I may tackle the math for myself.

The Handbook has the same sqrt(I^2 + Q^2) formula for AM demodulation.

Leon
--
Leon Heller, G1HSM

http://www.geocities.com/leon_heller

### AM demodulation using I and Q

> [deleted]

> > <blush> I wish I still had those notes! Did you look in the ARRL
> > handbook? If it's not there, I may tackle the math for myself.

> The Handbook has the same sqrt(I^2 + Q^2) formula for AM demodulation.

> Leon
> --
> Leon Heller, G1HSM

> http://www.geocities.com/leon_heller

Now I need to see why.

Jerry
--
Engineering is the art of making what you want from things you can get.

### AM demodulation using I and Q

Jerry, Thanks again.  LSB+USB/2 = ((I+Q)+(I-Q))/2 or I.  This isn't
it.

Getting back to the filter issue.  4k low pass at zero beat (Fc) would
put both sidebands (positive and negative) frequencies in the passband
(I think).  Moving the 4k passband up or down by 2k would center Fc at
2k with 1/2 of each passband in the filter.

I think the solution is somehow related to the frequency doubling I
mentioned in the other note.

Thanks again.  This is a perplexing problem.

> > [deleted]

> > > <blush> I wish I still had those notes! Did you look in the ARRL
> > > handbook? If it's not there, I may tackle the math for myself.

> > The Handbook has the same sqrt(I^2 + Q^2) formula for AM demodulation.

> > Leon
> > --
> > Leon Heller, G1HSM

> > http://www.geocities.com/leon_heller

> Now I need to see why.

> Jerry

### AM demodulation using I and Q

> Jerry, Thanks again.  LSB+USB/2 = ((I+Q)+(I-Q))/2 or I.  This isn't
> it.

Yeah. I figured that out already. :-(

Quote:

> Getting back to the filter issue.  4k low pass at zero beat (Fc) would
> put both sidebands (positive and negative) frequencies in the passband
> (I think).  Moving the 4k passband up or down by 2k would center Fc at
> 2k with 1/2 of each passband in the filter.

> I think the solution is somehow related to the frequency doubling I
> mentioned in the other note.

> Thanks again.  This is a perplexing problem.

How wide is the whole signal -- both sidebands? You don't have AM if
they aren't both in the passband. The doubling is a good sign of
nonlinearity. I'll plug away when holiday chores are over.

Jerry
--
Engineering is the art of making what you want from things you can get.

### AM demodulation using I and Q

Jerry,

I am using the AM broadcast band for testing.  I think the bandwidth
is 10k or 5k per sideband.  I am also using WWV at 10.000mhz to get
the regular tones.

If I set my input filters (one for I and the other for Q) equal to 5k
and tune to Fc, then I get distortion.  Adding or subtracting 2.5k,
which puts my LO at Fc - 2.5k gives me a clear signal.

thread and a recommended AM demod from Vlad but it was compute
intensive.

thanks again

### AM demodulation using I and Q

> Jerry,

> I am using the AM broadcast band for testing.  I think the bandwidth
> is 10k or 5k per sideband.  I am also using WWV at 10.000mhz to get
> the regular tones.

> If I set my input filters (one for I and the other for Q) equal to 5k
> and tune to Fc, then I get distortion.  Adding or subtracting 2.5k,
> which puts my LO at Fc - 2.5k gives me a clear signal.

> thread and a recommended AM demod from Vlad but it was compute
> intensive.

> thanks again

Most AM broadcast channels are 10 KHz including guard bands, but some
are -- or were -- allowed to go wider if that caused no interference.
At one time, WQXR AM had 15KHz audio. If your bandpass (IF?) is 5 KHz
wide and the carrier is at one edge of that, one of the sidebands is
gone down the slope. When the carrier is in the middle of passband,
you're left with two matching 2.5 KHz sidebands, and that ought to
work. Is that what you see, or have I misinterpreted what you wrote?

My lady friend is looking daggers at me. More some other time.

Jerry
--
Engineering is the art of making what you want from things you can get.

### AM demodulation using I and Q

> Most AM broadcast channels are 10 KHz including guard bands, but some

That should be 9kHz - unless you live in one of those odd out of the way
places that doesn't follow the global mainstream. :-)

Regards,
Steve

### AM demodulation using I and Q

Lightmetal,

Try using a lowpass rather than a bandpass after you beat the signal to 0.
Then do sqrt(i^2+q^2). Bandpass the signal after AM demod to get rid of any
DC offset.

Let me know how it works.

Just curious, did the Simulink version use a bandpass or lowpass before the
sqrt()?

Dirk

Dirk A. Bell
DSP Consultant (ISO WORK)

if you need to get rid of the DC offset.

Quote:> I started a thread re: AM demodulation using I and Q a few weeks ago
> and I am still having a problem.  According to Frerking, AM should be
> A=sqrt(i^2+q^2).  This works if I tune off the AM zero beat frequency
> by 1/2 the low pass filter bandwidth.  I don't understand this
> problem.

> A little more detail:

> I am using a pair of mixers fed with a sin/cos local osc. to generate
> I/Q at baseband.  SSB demod works fine for upper and lower sidebands
> with excellent opposite sideband rejection.  I can zero beat the AM
> carrier and receive upper, lower, or both sidebands to stereo output.
> I am using a DDS LO and I am able to accurately zero beat the AM
> carrier to less than 1hz. When I do this while listening to both
> sidebands or I/Q in stereo, I can hear the sidebands come into phase
> as I tune the radio.

> Once I have the signal zero beat, I flip it into the AM algorithm and
> I hear a great deal of distortion.  Assuming I use a low pass filter
> (actually a bandpass) from 30-4000hz, prior to the sqrt(i^2+Q^2) math,
> if I move off zero beat by 2000hz, the AM sounds great.  I can move
> either higher or lower by 2000 with the same results. It almost seems
> like the filter is acting like a mixer??

> I'm missing something here.  When I modeled this receiver using Matlab
> Simulink, it works fine at zero beat.  If I get this simple
> demodulator working I am going to move onto synch AM.  I actually like
> listening to the independent sidebands in stereo since it takes care
> of some of the fade.

> thanks.

### AM demodulation using I and Q

>> Most AM broadcast channels are 10 KHz including guard bands, but some

> That should be 9kHz - unless you live in one of those odd out of the way
> places that doesn't follow the global mainstream. :-)

Indeed - it's 9 kHz in every country where A4 paper is used. ;-)

Paul

### AM demodulation using I and Q

> > > I started a thread re: AM demodulation using I and Q a few weeks ago
> > > and I am still having a problem.  According to Frerking, AM should be
> > > A=sqrt(i^2+q^2).  This works if I tune off the AM zero beat frequency
> > > by 1/2 the low pass filter bandwidth.  I don't understand this
> > > problem.

> > > A little more detail:

> > > I am using a pair of mixers fed with a sin/cos local osc. to generate
> > > I/Q at baseband.  SSB demod works fine for upper and lower sidebands
> > > with excellent opposite sideband rejection.  I can zero beat the AM
> > > carrier and receive upper, lower, or both sidebands to stereo output.
> > > I am using a DDS LO and I am able to accurately zero beat the AM
> > > carrier to less than 1hz. When I do this while listening to both
> > > sidebands or I/Q in stereo, I can hear the sidebands come into phase
> > > as I tune the radio.

> > > Once I have the signal zero beat, I flip it into the AM algorithm and
> > > I hear a great deal of distortion.  Assuming I use a low pass filter
> > > (actually a bandpass) from 30-4000hz, prior to the sqrt(i^2+Q^2) math,
> > > if I move off zero beat by 2000hz, the AM sounds great.  I can move
> > > either higher or lower by 2000 with the same results. It almost seems
> > > like the filter is acting like a mixer??

> > > I'm missing something here.  When I modeled this receiver using Matlab
> > > Simulink, it works fine at zero beat.  If I get this simple
> > > demodulator working I am going to move onto synch AM.  I actually like
> > > listening to the independent sidebands in stereo since it takes care
> > > of some of the fade.

> > > thanks.

> > I don't understand the sqrt(i^2+q^2). Intuitition tells me (i + q)/2.

> Nonsense! that's (upper + lower)/2.

To demodulate AM, you *have* to use its carrier or local reference osc
which is phase locked to the carrier.
There is no way you can demodulate AM sidebands correctly without phase
reference, no matter how accurate is your heterodyne.

DSP and Mixed Signal Design Consultant

http://www.abvolt.com

I have an I/Q direct conversion receiver feeding a dsp board.  SSB
upper and lower signals are demodulated fine.  I also listen to the
I/Q pair for a stereo effect with the uppper or lower sideband heard
on the opposite stereo side.

If I zero beat an am carrier by tuning to say 1510khz (AM broadcast
band), either sideband sounds fine but the frequency response is off
equal to the 300-2400hz bandpass in my I/Q fir filters (q having the
hilbert transform).  Listening in I/Q mode causes a nauseating stereo
flutter.

I took a crack at AM demod using the sqrt(I^2+Q^2) method again using
the 300-2400 bandpass filter (without the hilbert) on both I/Q
channels.  There is a great deal of distortion when zero beat that
goes away at zero beat plus or minus about 400hz.  When not zero beat
though, the carrier is heard as a tone.  When tuned off by 400hz the
bass comes up as the distortion goes away, more bass than my 400hz
filter should allow.

I'm missing something here. I haven't tried it yet but I suspect that
by changing the lower cut off of the filter will cause the +- offset
to be reduced.

What's going on?

Thanks

8. HURRAH!