1
\$\begingroup\$

I am trying to sample a 50kHz sinewave @ 200 ksps using a 16-bit ADS8517 ADC. I am having a problem in that there is a lower frequency signal present on my input signal as shown:

Sampled output waveform, X axis is sample number, Y axis is sample value

I have scoped the input and it is a perfect 50kHz 500mV signal. The ADC is setup for +/-10V and all circuits follow the datasheet. If I sample a 1kHz signal I get: enter image description here

\$\endgroup\$
  • \$\begingroup\$ Do you have an analog anti-aliasing filter? Are you sure your input sinewave is distortion free, i.e. no significant harmonics? Looks like something is aliasing to me. \$\endgroup\$ – John D Feb 14 '18 at 18:57
  • \$\begingroup\$ I am driving directly from the scope just now so no anti-alias filter. I could try a simple RC one. It seems fairly clean. \$\endgroup\$ – smith1993 Feb 14 '18 at 19:02
  • \$\begingroup\$ Any chance that the 200kHz sampling rate and the 50kHz signal are not exact, maybe off enough to create a 50Hz alias? \$\endgroup\$ – Taniwha Feb 14 '18 at 19:02
  • \$\begingroup\$ It does it on lower frequencies as well. \$\endgroup\$ – smith1993 Feb 14 '18 at 19:04
5
\$\begingroup\$

There is no low frequency component there, and no screen resolution or sampling problem.

Shannon's theorem says you need at least 2 samples per cycle to represent the waveform accurately, and you have 4, so you are sampling it accurately.

HOWEVER:

Draw a sinewave, and mark 8 equally spaced sample points on it starting at 0, (at 45 degree intervals).

Now imagine the sinewave was sampled at 0, 90, 180 and 270 degrees; highlight those 4 samples and perhaps connect them with straight lines. Note the peak amplitude is the same as the peak amplitude of the original waveform.

Now repeat with the 45/135/225/315 degree set. Highlight and join with straight line. This time, you'll see the peak amplitude is 1/sqrt(2) of the original amplitude - yet both representations are correctly and accurately sampled representations of the original sine.

(First set : green points, second set, blue points) enter image description here

All you're seeing in the first plot is this correct sampling drifting between these two forms, as your signal and sampling rate are not precisely frequency locked.


The reason that either the sampling points, or a straight line interpolation, don't appear to reproduce the original waveform correctly, is that their spectrum extends above the Nyquist limit (Fs/2).

If you correctly band-limited the reconstructed waveform, with BW less than FS/2, you would draw it as the smoothest possible curve between the points, (alternatively, you would low pass filter at FS/2 with a reconstruction filter - or interpolate using Whitaker's Function - another way of saying the same thing) and that smooth curve would, of course, be the original sine wave.

\$\endgroup\$
  • \$\begingroup\$ So it is basically the effect of me sampling a sine wave at only 4x the frequency? The sampling will always become offset? The signal is passed through a 12th order bandpass IIR filter, rectified and then low pass filtered but the lumps are still present. \$\endgroup\$ – smith1993 Feb 14 '18 at 20:16
  • \$\begingroup\$ See diagram (just added) for yourself. What you're doing is displaying the sampled points themselves, rather than reconstructing the sampled waveform either by a suitable interpolation or an analog filter. (This was actually a serious problem in digital audio level metering, in the days before cheap DSP). \$\endgroup\$ – Brian Drummond Feb 14 '18 at 20:19
  • \$\begingroup\$ This is the correct answer. Taking the data sampled at 200kHz and running a sinc interpolation (oversampling) on it will reconstruct the original 50k signal perfectly. What you see on screen only indicates that the way we visually interpret things in our brains makes it hard to see. The low frequency component you are seeing is due to the 50k and 200k not being exact. If they come from different oscillators, maybe you get 50.01kHz and 199.99kHz sampling, which will create this kind of graphical illusion of a "beat frequency" due to sampling points occurring at different spots on the waveform. \$\endgroup\$ – peufeu Feb 14 '18 at 20:20
  • \$\begingroup\$ And funnily enough, a sinc interpolation is also known as Whitaker's function : it's also the impulse response of a "perfect" low pass filter. \$\endgroup\$ – Brian Drummond Feb 14 '18 at 20:20
  • \$\begingroup\$ I understand exactly what you mean and thanks a lot. I will have a look into the sinc interpolation. Thanks again. \$\endgroup\$ – smith1993 Feb 14 '18 at 20:22
1
\$\begingroup\$

You need at least display 2 pixels per sample to prevent aliasing and more to reduce intepolation error to some defined error limit. Shannon's law.

I measured you have 1000 datapoints in 579 image pixels instead of 2000 to 3000 Pixels. Thus a display aliasing frequency results.

\$\endgroup\$
  • \$\begingroup\$ I will alter my code just now and see how it goes. I have covered Shannon's law but would never have thought to relate it to this. Thanks a lot. \$\endgroup\$ – smith1993 Feb 14 '18 at 19:57
  • \$\begingroup\$ Thus the display is causing the aliasing? \$\endgroup\$ – analogsystemsrf Feb 15 '18 at 5:20
0
\$\begingroup\$

It’s your screen resolution that is giving you the impression the the signal is aliased. Try focussing in and taking a closer look. My estimate is that this is a storm in a tea cup. Sure there will be artefacts that look like aliasing but it’s just how your screen is handling things. If necessary use a simulator and get an alternative view of things.

\$\endgroup\$
  • \$\begingroup\$ Do you mean the sample sizes? \$\endgroup\$ – smith1993 Feb 14 '18 at 19:35
  • \$\begingroup\$ no he means horizontal resolution \$\endgroup\$ – Sunnyskyguy EE75 Feb 14 '18 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.