Squaring Loop Synchronous AM ISB Demodulator

Back to index

An AM Synchronous demodulator for IQ input, suitable for some SDRs (KiwiSDRs only, in IQ mode). Requires 0Hz IF direct conversion input.

This demodulator uses a squaring loop to regenerate the AM carrier from the sidebands during signal fades. This allows it to maintain carrier lock even without a carrier! The squaring loop multiplies the signal with itself, causing a 2F carrier to be generated. Carrier + carrier = 2F. LSB + USB = 2F.

To make carrier filtering easier, the AM signal is moved up in frequency by 200Hz to ensure the carrier is always in an easily tunable range of 100 to 300Hz. This is done by IQ mixing the I and Q channels with a 200Hz quadrature sinewave (DSP IQ oscillator), and matrixing the signals to select the sum mixing product only.

The carrier is regenerated by squaring the sample values (I*I and Q*Q). This generates a frequency doubled carrier at 400Hz, by frequency mixing (200Hz + 200Hz). Once again, IQ matrixing is used to select the sum component only.

Next, the 400Hz carrier is filtered by a narrow peaking filter, and then downmixed to 200Hz again by mixing with the 200Hz output signal from the routine. To start with, this is not available, so it is improvised by adding some white noise to the loop at low level. The following 200Hz filter stage then filters the noise, and a Hilbert clipper clips it - producing a crude carrier signal. This 200Hz signal is then sent back to the downmixer to downmix the signal from 400Hz to 200Hz. This causes a big signal increase, as it then mixes the incoming 400Hz signal down to 200Hz. On each pass around the loop, the signal is filtered and clipped again resulting in a rapid rise to maximum level (Q multiplier effect).

Since even slight mistuning causes a phase shift that degrades the demodulation performance, an APC (Automatic Phase Control) routine has been added. This detects the phase error in the demodulated Q channel, and feeds it to an integrator to measure the long term error. The integrator output is then fed back to the various carrier bandpass filters where it is used to correct the filter tuning. Effectively, the system acts like a quadrature FM detector - converting the frequency error into a phase error, converting the phase error into a DC error signal, then using this error signal to correct the tuning of the various carrier filters.

Because the 200Hz regenerated carrier is derived from the 400Hz carrier (by mixing), it isn't guaranteed to be in-phase with the incoming AM carrier. This doesn't seem to matter for AM demodulation, other than the fact that it reverses the polarity of the output. This is compensated for by multiplying the demodulated I and Q channels with each other for the APC phase detector signal. Then, if the carrier phase reverses, the I channel swaps polarity and inverts the phase of the Q channel - maintaining the correct APC phase lock sense.

It is also possible to synchronize the regenerated carrier with the incoming AM carrier by injection locking. This seems to degrade the noise performance of the system, so the latest software doesn't use this technique.

DSP frequency divider (simplified)

The IQ carrier output of the carrier regenerator stage is then downmixed to the original carrier input frequency, and used for AM demodulation of the signal. This allows more than 20kHz of audio bandwidth on an incoming IQ baseband signal (>40kHz IQ bandwidth).

An AGC signal is derived from the amplitude of the carrier, and from the amplitude of the DSB signal (carrier notched by 30dB). The maximum of these two values is used for AGC. This helps to control the audio level during fading.

A new feature is to compare the amplitude of the DSB signal to the carrier only signal and compute a DSB AGC time constant from this. This detects when the DSB signal is stronger than the carrier (during a selective fade) and uses a much slower time constant on the DSB AGC to reduce AGC pumping on the modulation.

The resulting audio is very clean and has a good SNR. The LSB audio appears on the left channel, and the USB audio appears on the right channel.

Aug 3, 2018: Automatic fine tuning has been added.

Aug 18, 2018: Audio glitch muting has been added. This detects and mutes signals that exceed the output clipping level.

Aug 22, 2018: A Noise Blanker has been added. It consists of a floating threshold level detector, a pulse stretcher and a variable lowpass filter. When a noise impulse is detected, the IQ bandwidth is contracted down to 20Hz for slightly more than it's duration, suppressing the noise while still allowing the carrier to pass.

Aug 27, 2018: DSB AGC time constant computation added.

See my Shortwave and  AM videos on YouTube

The following (older version) Faust example is compiled in Webassembly format. It is not ideal. It can't be fed directly from any online SDR, as it runs in a web browser (same as the SDR does). It requires the 0Hz IF SDR IQ output to be fed into the selected sound input device. This can be done by replaying an IQ WAV file recorded from a KiwiSDR in Audacity using VAC, or by inputting a 0Hz IF IQ signal from an external hardware SDR.

In-browser AM ISB Demodulator

free web