# How a diode-detector affects to Frequency Response?

I have a question related to crystal radio. I can't understand how a crystal detector (diode) shifts the spectrum from the carrier frequency to zero.

The antenna receives bunch of signals and the LC circuit passes the most of the frequencies to the ground excepting the resonance frequency (and the near frequencies). So it's the signal before detector:

The diode passes the positive half-waves to the capacitor/buzzer. So it's the signal after detector:

The capacitor just smooths the high-frequency ripples and the buzzer emits the original demodulated low-frequency signal.

Let's see how it works in the frequency domain.

The antenna receives signals:

The LC circuit extracts the interesting bandwidth:

The non-linear detector as i can understand should shift the bandwidth to zero (and add some other harmonics):

The capacitor/buzzer pair removes the high-frequency harmonics:

The non-linear detector thing i can't understand. How does cutting the half-wave affect to the spectrum? Why the spectrum is shifted down?

I understand how it works in the time-domain. My question is how does it work in the frequency-domain?

I tried to reproduce such behavior in the sound editor. I've generated the sine at 1000 HZ and then modulate it by the 5000 HZ carrier:

So we have 2 peaks at 4kHz (negative frequency shift) and 6kHz. The next step is the detection. So i've reproduce it by using clipping but the result spectrum isn't the same as i expect:

As you can see there is NO peak at 1kHz at all so the low-pass filter is pointless here.

Why here i've got such result? Where am i wrong?

• Nothing is "shifted down" in AM. Another name for that circuit is envelope follower. The capacitor does smooth the signal which would mean that the peaks in the third figure are "bridged" but you are not showing this. The diode charges the capacitor at the peak and the capacitor "fills in the gaps" until the next boost in its charge.
– A_A
Sep 29, 2020 at 14:19
• Thank you for response. I knew about envelope follower but i don't understand how it works in frequency domain. For example we have carrier at 12MHZ and the upper-sideband has 20KHz bandwidth. So to restore the original signal we need to transmit the upper-sideband back to 0..20KHz, i.e. shift it down. We could do it using for example a sync-demodulation so the original signal we get from negative frequencies. But what does detector in the frequency domain? Why the example in audio editor doesn't work? Thanks.
– John
Sep 29, 2020 at 14:49
• You say "Let's see how it works in the time domain.", but I think you mean let's see how it works in the frequency domain. Sep 29, 2020 at 18:10
• @TimWescott , thank you! I've fixed my mistake.
– John
Sep 29, 2020 at 18:18
• It would help if you would add your question "Why the example in the audio editor doesn't work?" to your question -- stack exchange likes the whole question and the whole answers to be in the question and answer bodies -- not in the comments. Sep 29, 2020 at 18:24

But what does detector in the frequency domain?

Something really complicated. We get trained to think about signal processing almost exclusively in the frequency domain, and we forget that the frequency domain stuff was only invented as a mathematical trick to make it easier to understand what's going on in the time domain. If it's easier to do in the time domain, do it there.

In fact, envelope detection is really horrid from a frequency domain point of view, because not only are there nonlinearities in play, but there's nonlinearities and that perfectly linear capacitor that are interacting. So generally if you want to analyze AM radio demodulation you try to find some equivalent operation that is linear, or at least less horridly nonlinear.

In this case, just considering the demodulation to be clipping isn't bad. Figure that the clipping operation can be denoted as $$y(t) = f\left( x(t) \right )$$, where $$f(x)$$ is (thankfully) memoryless. So you can assert* that it has a Taylor's expansion $$f(x) = \sum_{n=0}^\infty h_n x^n$$ where the $$h_n$$ are the terms of the expansion**

If we feed a sum of sinusoids through $$f(x)$$, the above expansion tells us that we're going to get just about every possible distortion product out of the thing. We'll get stuff at the sum of all the sinusoid frequencies, at every possible combination of sum and difference frequencies, and at ever possible combination of the sum and difference of every possible harmonic of both sinusoids.

At this point, I'm just going to claim without proof that the element at the difference between the carrier and the sideband frequencies will be prevalent -- if the carrier and the modulating signal are widely spaced apart. AM radio works because you're transmitting at 500kHz or more, and modulating the carrier with a signal that only occupies 0Hz to 3000Hz or so.

I'm not going to try to prove this in more detail because the math gets crazy in the frequency domain -- and because you can so clearly understand the operation in the time domain.

Why the example in audio editor doesn't work?

First, because you just multiplied $$\cos \omega_c t$$ with $$\cos \omega_s t$$ For AM modulation, you want something like $$\left(\cos \omega_c t\right ) \frac{s(t) + 1}{2}$$ -- you multiply the carrier by something that never falls below zero.

Second, because your carrier and your modulating tone are so closely spaced (although the signal may be recognizable).

Here's some plots.

1. Top, a picture of one 1kHz cycle's worth of your signal, as you've defined it. Because you didn't shift your modulating tone, you don't have enough carrier to form an envelope.

2. My version with your frequencies, your modulating tone shifted by 1 and reduced by half.

3. My version with a carrier frequency of 20kHz, and the modulating tone shifted.

* You can assert this, but you'd be lying, because it has derivatives that go to infinity -- but you can make up something arbitrarily close to a clipping function that does have a Taylor's expansion -- just assume I've done that.

** And I use $$h$$ in honor of the horrid things I'm doing to the math...

• Thank you for response!
– John
Sep 30, 2020 at 9:18

To add a simple explanation before reading the good details Tim has provided:

It’s quite simple: if the diode only passes the positive half of the signal and blocks the negative we end up with a DC offset which is the average of this rectified waveform, notice riding on that DC offset is the original signal of interest! It is obvious by inspection that low pass filtering this will provide the demodulated signal while we would get nothing out of low pass filtering prior to the detector.

This will only work properly as such with “Large Carrier AM”, meaning we need to transmit the actual carrier with the waveform to do the work off turning on and off the diodes (creating the clear offset where our signal remains intact in the upper positive half of the time domain waveform). For small carrier AM and suppressed carrier AM we cannot use this detector approach directly like this and need to instead recreate the carrier locally (using carrier recovery approaches). Transmitting the carrier is a huge waste of power! Hence we do the latter in most modern waveforms.

• Thank you for response!
– John
Sep 30, 2020 at 9:18

I thank everyone for their help.

I've studied the impact of non-linear transformations to harmonic and bi-harmonic signals. I'm not sure if i use the proper terms because i've got them from the books in other language. So you can fix me in the comment and i'll fix them here.

So.

Any non-linear transformation may be approximated by a polynomial therefore we can put our signal to this one and checks the output harmonics. For example if we use the polynomial of 3 we can calculate the harmonics:

$$i = a_0 + a_1(u - U_0) + a_2(u - U_0)^2 + a_3(u - U_0)^3$$

Where $$U_0$$ - the offset voltage and $$u$$ - the input signal.

Let's firstly check how this non-linear transformation affects to a harmonic signal. Using input signal $$u(t) = U_0 + U_mcos(\omega t)$$ we get:

$$i(t) = a_0 + a_1U_mcos(\omega t) + a_2U_m^2cos^2(\omega t) + a_3U_m^3cos^3(\omega t) = a_0 + a_1U_mcos(\omega t) + a_2U_m^2(\frac{1}{2}+\frac{1}{2}cos(2\omega t)) + a_3U_m^3(\frac{3}{4}cos(\omega t) + \frac{1}{4}cos(3\omega t)) = (a_0 + \frac{1}{2}a_2U_m^2)+(a_1U_m+\frac{3}{4}a_3U_m^3)cos(\omega t)+\frac{1}{2}a_2U_m^2cos(2\omega t) + \frac{1}{4}a_3U_m^3cos(3\omega t)=I_0 + I_{m1}cos(\omega t)+ I_{m2}cos(2\omega t)+ I_{m3}cos(3\omega t)$$

, where $$I_0$$ - DC offset, $$I_{m1} - I_{m3}$$ - harmonics.

As we can see there is 3 harmonics in the output signal. By adding degrees to the polynomial, we get additional harmonics that will decrease infinitely in amplitude. For example let's get the diode approximation at -1 to 1 with the following coefficients:

$$\frac{1}{3} x^3 + \frac{1}{2} x^2 + \frac{1}{6} x$$

$$\hskip2in$$

Substituting the coefficients in the formula and use $$U_m = 1$$ we get: $$I_0 = 0.25$$, $$I_1 = \frac{5}{12} \approx 0.416$$, $$I_2 = 0.25$$, $$I_3 = \frac{1}{12} \approx 0.083$$.

Okay let's test the result experimentally using clipping and FFT:

$$\hskip1in$$

Okay, that's good. If we add the highest degrees we can approximate it more accurate. The other approximation we can use here is piecewise-linear one. This allows to calculate the harmonics of a cut-offed harmonic signal based on a cut-off angle. The animated graph of the amplitudes of the harmonics versus cut-off angle:

This functions is called Berg's functions. The smaller cut-off angle (the impulse is narrowed), the smaller harmonics attenuation.

This is was for a harmonic signal. The other behavior we can see if we use a biharmonic signal (or multiharmonic one). A signal which consists the sum of two harmonic oscillation with different frequencies $$\omega_1$$, $$\omega_2$$ and amplitudes $$U_{m1}$$, $$U_{m2}$$ is called biharmonic:

$$U_0 + U_{m1}cos(\omega_1t)+ U_{m2}cos(\omega_2t)$$

Substituting this signal to an approximation polynomial we can calculate the harmonics of this signal. To simplify the calculation we use the polynomial of degree 2:

$$i = a_0 + a_1(u - U_0) + a_2(u - U_0)^2 \Rightarrow$$ $$i(t) = a_0 + a_1U_{m1}cos(\omega_1t) + a_2U_{m2}cos(\omega_2t) + a_2U_{m1}^2cos^2(\omega_1t) + 2a_2U_{m1}U_{m2}cos(\omega_1t)cos(\omega_2t)+ a_2U_{m2}^2cos^2(\omega_2t)$$

Using following trigonometric functions:

$$cos^2(\psi)=\frac{1}{2}(1 + cos(2\psi))$$ $$cos(\psi_1)cos(\psi_2)=\frac{1}{2}(cos(\psi_1 + \psi_2)+cos(\psi_1 - \psi_2)) \Rightarrow$$ $$(a_0 + \frac{a_2}{2}(U_{m1}^2 + U_{m2}^2)) + a_1U_{m1}cos(\omega_1t) + a_1U_{m2}cos(\omega_2t)+\frac{a_2U_{m1}^2}{2}cos(2\omega_1t)+\frac{a_2U_{m2}^2}{2}cos(2\omega_2t) + a_2U_{m1}U_{m2}cos((\omega_1+\omega_2)t)+a_2U_{m1}U_{m2}cos((\omega_1-\omega_2)t)$$

As we can see there is the new harmonics which weren't there when we processed a harmonic signal with frequencies $$\omega_1\pm\omega_2$$. Those frequencies are called combined frequencies. Let's check the spectrum using FFT experimentally. $$U_{m1} = 0.5; U_{m2} = 0.5$$ Using the following polynomial:

$$\frac{1}{2} x^2 + \frac{1}{2} x \Rightarrow$$

$$I_0 = 0.125; I_{\omega_1} = 0.25; I_{\omega_2} = 0.25; I_{2\omega_1} = 0.0625; I_{2\omega_2} = 0.0625; I_{\omega_1+\omega_2} = 0.125; I_{\omega_1-\omega_2} = 0.125$$

$$\hskip1in$$

Using polynomials with the higher degree $$N$$ the result contains the combined frequencies $$p\omega_1 \pm q\omega_2$$, where $$p + q = N$$; $$p, q\in \mathbb{N}$$.

For example the polynomial of 3 degree contains the following frequencies:

┌─────┬─────┬────────┬────────┬─────┐
│ q\p │  0  │   1    │   2    │  3  │
├─────┼─────┼────────┼────────┼─────┤
│   0 │ I0  │ ω1     │ 2ω1    │ 3ω1 │
│   1 │ ω2  │ ω1±ω2  │ 2ω1±ω2 │ -   │
│   2 │ 2ω2 │ ω1±2ω2 │ -      │ -   │
│   3 │ 3ω2 │ -      │ -      │ -   │
└─────┴─────┴────────┴────────┴─────┘


The spectrum and the waveform are more accurate:

$$\hskip1in$$

When we have the bunch of the input harmonics we can represents them as:

$$u(t) = U_0 + \sum_{k = 1}^{\infty}U_{mk}cos(\omega_kt -\varphi_k)$$

Depending on the degree $$N$$ of the approximation polynomial we have the following combined frequencies:

$$p\omega_1\pm q\omega_2\pm s\omega_3\pm ... \pm k\omega_k\pm ...$$ $$p + q + s + ... + k + .. = N$$ $$p, q, s, k \in \mathbb{N}$$

For example if we use the polynomial of degree 2 with a bi-harmonic input the result spectrum contains DC, two first harmonics of each input frequencies and combined frequencies $$\omega_1 \pm \omega_2, \omega_1 \pm \omega_3, \omega_2 \pm \omega_3$$. Using polynomial of degree 3 third harmonics appears $$3\omega_1, 3\omega_2, 3\omega_3$$ with the combined frequencies $$\omega_1 \pm \omega_2 \pm \omega_3; 2\omega_1 \pm \omega_3; \omega_1 \pm 2\omega_3$$ etc.

So the answer to my question is:

Cutting a signal in the time domain adds the higher harmonics with the combined frequencies in the frequency domain. Particularly, the combined frequencies allows to demodulate a signal in the crystal detector, i.e. shift them down (and up).

Thanks to all again!