Reply by lightmetal July 8, 20032003-07-08
Jerry, Dirk, Bob,

First, I would like to thank you guys for all your help and
encouragement.

Now, for the fun part:  I couldn't get the baseband I/Q to do AM
correctly for nothing, as you can see from the multiple posts.  I got
close but not perfect.

I took the analog I/Q coming in and used a complex digital mixer to
generate a 12k IF.  I still have to mess with all the filters, but it
demods AM correctly.  It is starting to look like I wasn't getting
everything I needed from the baseband I/Q.  Go figure, I am not a math
wiz, but it works.

The filters seem screwed up but I can model them with simulink and
correct them.  Though I am using a 12k mixer, the signal is showing up
at +6khz and negative 18khz.  I might have the sin/cos Lo signal off.

thanks again.
Reply by Moe July 7, 20032003-07-07
> 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 > 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. > > 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. > I've read a lot of your posts. >
The sqrt(i^2+q^2) should work but must be followed by a highpass or bandpass filter to remove the carrier component. I found a couple gotchas when implementing an AM detector using the AD6620 downconverter chip. There can't be any dc offset or amplitude imbalance in the I or Q terms or you will get a beat tone if you tune off frequency. If you think of just the AM carrier on an I/Q plot, it should be a single point if right on frequency, or samples in perfect circle if tuned off center frequency. From this its easy to see that if there is a DC offset on I and/or Q the circle will "wobble" around the origin creating the beat tones as the vector magnitude changes. As for your 2x frequency problem, it sounds like some sort of sample rate issue or implementation problem and not a problem with the conceptual AM demodulation method. Good luck, Moe
Reply by Jerry Avins July 7, 20032003-07-07
lightmetal wrote:
>
...
> > I'm getting a carrier beat tone when I tune off Fc the same as if I > was detecting SSB. Should this be happening? This is what I am > trying to get rid of. > > I think I am getting closer... >
There is no beat in ordinary AM detection because there is no locally generated carrier. If you supply one, it has to be phase locked to the broadcast carrier. Frequency lock is enough to avoid the beat, but you need the right phase to avoid distorting the signal. With a single sideband, the carrier phase in unimportant; that's why I can listen to SSB on my portable radio by using the BFO. With two sidebands present, the carrier phase has to be just right if the sum of the demodulated sidebands is to reconstitute the signal. When designing an exalted carrier receiver, it's important to keep the phase of the reconstructed carrier lined up with the original at the detector. Injecting a LO is trickier yet. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by lightmetal July 7, 20032003-07-07
Bob, Dirk,

I changed the hardware and I am now passing everything but DC to the
ADC on the DSP board.  I left a 6.8ufd cap in the circuit but I can
probably take that out.

I also changed the DSP code to lowpass filter the input.  The tones
are now correct when listening to WWV.  I still have a little
distortion on loud voices.

I'm getting a carrier beat tone when I tune off Fc the same as if I
was detecting SSB.  Should this be happening?  This is what I am
trying to get rid of.

I think I am getting closer...

Bob Doyle <doyle@globalcrossing.net> wrote in message > 
> I think Dirk is quite right here. > > Down convert the signal to 0 Hz. LOWPASS filter both the I and Q signals. > > Envelope detect using the sqrt(I^2 + Q^2). If you bandpass the > baseband signal, you remove the carrier - which is at 0 Hz if your signal > has been zero-beated. > > If you down convert to an an intermediate frequency (I.F.) you may BANDPASS > filter the signal and envelope detect as above. > > Think of a phaser int the I/Q plane rotating clock-wise or counter-clock-wise > depending on frequency difference of the input signal and down converstion. > The length of the phasor (Amplitude) is the important parameter for envelope > detection. The phasor length is the sqrt(I^2 + Q^2). > > Dont give up on it. Something simple is broken if it doesn't work. > > Bob.
Reply by Jerry Avins July 7, 20032003-07-07
lightmetal wrote:
>
...
> I am still stumped as to why the AM sqrt(i^2+q^2) sound ok when tuned > off by half the bandwidth of the filter??
That lets the carrier through, as I tried but failed to write clearly.
> > I am learning more about dsp using AM then all the ssb work! >
The more you play, the more you learn. It hardly matters with what. ... Jerry -- Engineering is the art of making what you want from things you can get. &#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;
Reply by lightmetal July 6, 20032003-07-06
Dirk, I see your point.  The matlab results are different if I use a
lowpass filter in front of the sqrt(i^2+q^2).   I would have to post
the scope display but basically the fft output for the test tones are
the correct frequency (not doubled like my dsp) but the bandpass
filter has a large low freq. component with reduced output compared to
the lowpass that looks cleaner without the low frequency half/hump at
dc.

I tried a lowpass with my dsp and when tuned to zero beat it sounds
better but still distorted. this could be due to the bandpass filter
in the analog section. I am going to have to change the analog mixing
hardware which I was planning to do anyway to fully test your theory.

Assuming you are correct, mixing to baseband in hardware outside the
dsp will never work well for AM envelope detection due to capacitive
coupling to the mixer terminating hardware.

I am still stumped as to why the AM sqrt(i^2+q^2) sound ok when tuned
off by half the  bandwidth of the filter??

I am learning more about dsp using AM then all the ssb work! 

"Dirk Bell" <dirkman@erols.com> wrote in message news:<be9k4k$ell$1@bob.news.rcn.net>...
> Lightmetal, > > If I am understanding what you are doing you correctly, you are fairly > accurately mixing the signal back to baseband and then running a bandpass > filter. If so, it seems that you are effectively changing from am-carrier > to am-suppressed carrier before you compute the amplitude modulation. The > equation you are using is not intended for am-suppressed carrier. Using it > would full-wave rectify your result. > > What other problems you may be having are not clear. This might be good > time to drop back to a simple case of sinusoidal AM modulation and verify > the results in that case. > > Dirk > > Dirk A. Bell > DSP Consultant
Reply by Bob Doyle July 6, 20032003-07-06
Dirk Bell wrote:
> > Lightmetal, > > If I am understanding what you are doing you correctly, you are fairly > accurately mixing the signal back to baseband and then running a bandpass > filter. If so, it seems that you are effectively changing from am-carrier > to am-suppressed carrier before you compute the amplitude modulation. The > equation you are using is not intended for am-suppressed carrier. Using it > would full-wave rectify your result. > > What other problems you may be having are not clear. This might be good > time to drop back to a simple case of sinusoidal AM modulation and verify > the results in that case. > > Dirk > > Dirk A. Bell > DSP Consultant > > "lightmetal" <jehancoc@pacbell.net> wrote in message > news:a95870c1.0307060750.38491da3@posting.google.com... > > Hi Dirk, > > > > A bandpass filter was used in Matlab simulink. The interesting thing > > is that if I eliminate the bandpass digital filter and just use the > > very wide bandpass analog filter, I have the same problem though I > > have to tune off much farther. I am starting to think that maybe the > > ADSP-21161 compiler I am using might have a problem with square roots. > > I tried taking the square of 4 and got 2, but when I tried a > > fractional number I got 1-undef in the visual debugger. I didn't look > > at it closely and assumed it was debugger problem. I am going to > > look at it this morning. I am about to just stick to I/Q or sideband > > diversity instead of this envelope detection method. The only reason > > I am going this route is to handle the AM amateur nets. They are > > never all on the same frequency and in the other AM detection modes I > > get a beat tone unless I retune for every person. > > > > thanks > > > > > > "Dirk Bell" <dirkman@erols.com> wrote in message > news:<be87d7$p4e$1@bob.news.rcn.net>... > > > 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) > > >
I think Dirk is quite right here. Down convert the signal to 0 Hz. LOWPASS filter both the I and Q signals. Envelope detect using the sqrt(I^2 + Q^2). If you bandpass the baseband signal, you remove the carrier - which is at 0 Hz if your signal has been zero-beated. If you down convert to an an intermediate frequency (I.F.) you may BANDPASS filter the signal and envelope detect as above. Think of a phaser int the I/Q plane rotating clock-wise or counter-clock-wise depending on frequency difference of the input signal and down converstion. The length of the phasor (Amplitude) is the important parameter for envelope detection. The phasor length is the sqrt(I^2 + Q^2). Dont give up on it. Something simple is broken if it doesn't work. Bob.
Reply by lightmetal July 6, 20032003-07-06
Vlad,  I am glad you chimed in,  I was about to send you an email. 
You suggested in the other thread that I use a complex exp. to beat a
200hz osc. against the AM signal and then sum the resulting four
signals, II+IQ-QI-QQ.  I tried this last night and it results in only
one sideband, correct?  Considering the II and IQ summation as a new
I, and the QI and QQ as a new Q, then wouldn't II+IQ-QI-QQ be the
lower sideband??? (or upper depending on analog osc phase).  As in
(II+IQ)-(QI+QQ)?

Using this method, I still have a beat tone when moving off the AM
station Fc. I mentioned in another post that I am trying to eliminate
the necessary retuning when listening to multiple AM stations on the
same frequency that have Fc's off by a few 10's of hz.

Vlad, What is causing the frequency doubling when zero beat using
sqrt(i^2+q^2)? As I mentioned, when I move off by 1/2 the lowpass
(bandpass in my case) bandwidth, the envelop derived from
sqrt(i^2+q^2) sounds fine.

Thank you.


> 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. > > > Vladimir Vassilevsky, Ph.D. > > DSP and Mixed Signal Design Consultant > > http://www.abvolt.com
Reply by Dirk Bell July 6, 20032003-07-06
Lightmetal,

If I am understanding what you are doing you correctly, you are fairly
accurately mixing the signal back to baseband and then running a bandpass
filter.  If so, it seems that you are effectively changing from am-carrier
to am-suppressed carrier before you compute the amplitude modulation. The
equation you are using is not intended for am-suppressed carrier.   Using it
would full-wave rectify your result.

What other problems you may be having are not clear.  This might be good
time to drop back to a simple case of sinusoidal AM modulation and verify
the results in that case.

Dirk

Dirk A. Bell
DSP Consultant



"lightmetal" <jehancoc@pacbell.net> wrote in message
news:a95870c1.0307060750.38491da3@posting.google.com...
> Hi Dirk, > > A bandpass filter was used in Matlab simulink. The interesting thing > is that if I eliminate the bandpass digital filter and just use the > very wide bandpass analog filter, I have the same problem though I > have to tune off much farther. I am starting to think that maybe the > ADSP-21161 compiler I am using might have a problem with square roots. > I tried taking the square of 4 and got 2, but when I tried a > fractional number I got 1-undef in the visual debugger. I didn't look > at it closely and assumed it was debugger problem. I am going to > look at it this morning. I am about to just stick to I/Q or sideband > diversity instead of this envelope detection method. The only reason > I am going this route is to handle the AM amateur nets. They are > never all on the same frequency and in the other AM detection modes I > get a beat tone unless I retune for every person. > > thanks > > > "Dirk Bell" <dirkman@erols.com> wrote in message
news:<be87d7$p4e$1@bob.news.rcn.net>...
> > 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) > >
Reply by lightmetal July 6, 20032003-07-06
Hi Dirk,

A bandpass filter was used in Matlab simulink.  The interesting thing
is that if I eliminate the bandpass digital filter and just use the
very wide bandpass analog filter, I have the same problem though I
have to tune off much farther.  I am starting to think that maybe the
ADSP-21161 compiler I am using might have a problem with square roots.
 I tried taking the square of 4 and got 2, but when I tried a
fractional number I got 1-undef in the visual debugger.  I didn't look
at it closely  and assumed it was debugger problem.  I am going to
look at it this morning.  I am about to just stick to I/Q or sideband
diversity instead of this envelope detection method.  The only reason
I am going this route is to handle the AM amateur nets.  They are
never all on the same frequency and in the other AM detection modes I
get a beat tone unless I retune for every person.

thanks 


"Dirk Bell" <dirkman@erols.com> wrote in message news:<be87d7$p4e$1@bob.news.rcn.net>...
> 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) >