# Computing stuff tied to the physical world

## Fourier analysis

In Hardware on Dec 8, 2012 at 00:01

The three scope shots shown yesterday illustrated how the output signal moves further and further away from the “ideal” input sine waves, near the limits of the AD8532 op-amp.

This was all based on a vague sense of how “clean” the wave looks. Let’s now investigate a bit deeper and apply FFT to these signals. First, the 500 KHz from my frequency generator:

You can see that peak #1 is the 500 KHz signal, but there’s also a peak #2 harmonic at 1 MHz, i.e. twice that frequency, and an even weaker one at 1.5 MHz.

My frequency generator is not perfect, but let’s not forget to put things in perspective:

• peak #1 is at roughly 10 dBm
• peak #2 is at roughly -40 dBm, i.e. 50 dB less

First off: I really should have set to scope to dBV. But the image would have looked the same in this case – just a different scale, so let’s figure out this dBm thing first:

• 0 dBm is defined as 1 mW of power
• the generator was set to drive a 50 Ω load, but I forgot to enable it
• therefore the “effective load” is 100 Ω (off by a factor of two, long story)
• the signal is swinging ± 1 V around a 2V base level, i.e. 0.707 V (RMS)
• so the signal is driving ± 7.07 mA into the load (plus 14.14 mA DC)
• power is I x V, i.e. 7.07 mA x 0.707 V x 2 (for the termination mistake) = 10 mW

Next thing to note is that dB and dBm (decibels) use a logarithmic scale. That’s a fancy way of saying that each step of 10 is 10 times more or less than the previous. From 0 to 10 dBm is a factor 10, i.e. from 1 mW to 10 mW. From 10 to 20 dBm is again a factor 10, i.e. 10 mW to 100 mW, etc. Likewise, -10 dBm is one tenth of 0 dBm (0.1 mW) etc.

The 500 KHz signal (peak #1) is therefore 10 mW (10 dBm), and the 1 MHz harmonic is roughly 100,000 times as weak at 0.1 µW (-40 dBm). It looks like a huge peak on the screen, but each vertical division down is one tenth of the value. The vertical scale on screen covers a staggering 1:100,000,000 power level ratio.

That 500 KHz sine wave is in fact very clean, despite the extra peaks seen at this scale.

Now let’s look at the same signal, on the output of the op-amp:

Not too bad (the second peak is still less than 1/30,000 of the original). Which is why the output shape at 500 KHz still looks very much like a pure sine wave.

At 1 MHz, the secondary peaks become a bit more pronounced:

.

And at 2 MHz, you can see that the output harmonics are again a lot stronger:

.

Not only has the level of the 2 MHz signal dropped from 9.23 dBm to 6.59 dBm, the second harmonic at 4 MHz is now only a bit under 1/100th the main frequency. And that shows itself as a severely distorted sine wave in yesterday’s weblog post.

In case you’re wondering: those other smaller peaks around 1 MHz come from public AM radio – there are some strong transmitters, located only a few km from here!

Anyway – I hope you were able to distill some basic intuition from this sort of signal analysis, if this is all new to you. It’s quite a valuable technique and all sort of within reach now, since most recent scopes include an FFT capability – the bread and butter of the analog electronics world…

Let’s now get back to digital again. Ah, bits and bytes, sooo much simpler!

1. I’m interested, what settings do you have your scope set to for the FFT measurements? I have the same Hameg at work and have recently been using it to measure a custom 4 channel frequency generator board and using (or trying) the FFT a fair bit. I haven’t decided the best use of the windowing or averaging settings yet.

• Usually 16 or 64 averaging. Getting the bottom window narrow enough is a bit of a trial-and-error game: you have to widen the top capture window (i.e. slower timebase) to allow zooming in further. For the scale, I use dBm, and then scale back to 10 or 20 dB per div to see the whole picture, moving the vertical position upward. Also, I tend to switch away from the default “rectangle” FFT window setting, since that leads to a funny baseline. It all definitely takes a bit of getting used to.

2. Offtopic, just to say a big thank you for this absolutely interesting blog, one of my favorite daily reads.