# When reading the digital wave from a DAQ, should I be getting the same wave I'm generating to it?

I am using a DAQ device, which is said to be capable of 400kS/s maximum, and therefore 50kS/s per channel when using all 8 channels. This is listed in the manual of the 1608fs plus DAQ

So I connected a function generator, and I'm sending a square wave of 25kHz, following nyquist theorem, to all 8 channels.

I thought at 50Ks/s sample rate I'll see the square wave in the software, but even at 10kHz from function generator I am not seeing a square wave. I am seeing a square wave more and more as I lessen the frequency, but I'd expect a square wave at 25kHz and below if its capable of the sampling it specifies that it is, am I wrong to expect that? Is it not capable of what it says it can do?

• Are you sure the output isn't saturating? You appear to be getting the triangle wave, but the unit is saturating at the two extremes of the output (high and low). Commented Oct 30, 2018 at 14:15
• @Puffafish I wouldn't really know how to check that. The card is said to be powered through a USB. I know that when calculating the FFT I get the expected frequency in software, but I'd expect it to also be like that on a graph? I've tried both in a programming language and its own software, DAQami. Both output triangle waves. Commented Oct 30, 2018 at 14:24

The Nyquist criterion applies to pure sinusoids. The problem here is that a square wave contains numerous higher-order harmonics, at 3× the base frequency and higher, and these components are not being captured by the sampling. Think of it like having a near-ideal low-pass filter on the input.

For further information, you might want to look up the Fourier transform, and spectral content of the square wave.

• So if I make it a sinusoid I should get the expected wave below 25kHz? Commented Oct 30, 2018 at 14:33
• That depends on how your DAQ reconstructs the signal. It looks like it just does a linear interpolation between adjacent samples, so no, you won't. I believe--though my memory is a bit spotty and this may be entirely wrong--that you need to use a sinc convolution filter to properly reconstruct it. Commented Oct 30, 2018 at 14:35

As others have noted, to be able to faithfully reproduce measured signals, the Nyquist-Shannon theorem says you need to sample at twice the signal's frequency. As a rule of thumb however, due to the non-ideal band limitation of most 'scopes, the sample rate should be at least 2.5x the signal freq'. However, this only applies to sinusoidal signals: to properly display square-wave and other non-sinusoidal signals, which contain frequency components significantly higher than the Nyquist frequency, you need a sampling rate several times the bandwidth for reproducible measurements. In fact, you may need a sampling rate up to 10x the fundamental freq' to faithfully reproduce the signal. Hope this helps - and good luck. Let us know how you fare out.

I believe that the Nyquist criterion requires that the input frequency be strictly less than one-half of the sampling frequency, so I would not expect good results at 25kHz input. Also, remember that the Nyquist limit is a hard mathematical limit...reconstructing signals with frequencies close to the limit may be difficult.

• But shouldn't 10kHz be a complete square wave? Commented Oct 30, 2018 at 14:25
• @Lukali no. Read Felthry's answer. Commented Oct 30, 2018 at 14:28

Nyqvist criterion is that the bandwidth of the signal has to be less than the sampling rate. A square wave at 10KHz has a bandwidth that is much greater than 10KHz (theoretically infinite, but practically limited by circuit characteristics). You need at least the three main components to start to approximate it (that would be 10KHz, 30KHz, and 50KHz), but it would still be an approximation.

But even if you were using a pure sine wave (that has only one frequency component) you would still not get what you are expecting with normal data acquisition software. You would need software that uses a proper reconstruction criteria to interpolate the samples into the appropriate waveform. And even then, some artifacts would remain as Nyqvist assumes an infinite duration signal.