How fast should you sample? Sample rate and aliasing
A 900 Hz tone sampled at 1 kS/s lands in your data as a clean 100 Hz sine, and no filtering after the fact can take it back out.
Sample rates often get picked by habit, 1 kS/s because it is round or the device maximum because more feels safer. The right rate depends on the highest frequency present at the input (including frequencies you don’t care about), what you need to see in the data, and whether anything ahead of the converter removes frequencies it can’t represent. The sample rate and aliasing calculator runs the numbers below for your own signal and channel count.
The Nyquist frequency
A converter sampling at fs can unambiguously represent frequencies from DC up to fs/2, the Nyquist frequency, which is where “sample at twice the highest frequency” comes from. Energy above fs/2 still gets sampled, and it aliases, producing exactly the samples some lower in-band frequency would. Once those samples are in your file, nothing distinguishes the false tone from a real one, and no filtering afterward can separate them.
Working out where an alias lands
A tone at frequency f, sampled at fs, appears at
f_alias = |f - k*fs|
where k is the whole number closest to f/fs, which puts the result between 0 and fs/2. Take a 900 Hz tone sampled at 1 kS/s. Nyquist is 500 Hz, so 900 Hz is out of band. With k = 1, |900 - 1000| = 100, and the tone shows up in your data as a clean 100 Hz sine with the original amplitude. A 1,100 Hz tone and a 2,900 Hz tone also land at 100 Hz. The spectrum folds back and forth across multiples of fs/2 like a paper fan, which is why this is called folding. The calculator does the folding for any tone and rate.
| Input frequency | Sample rate | k | Appears at |
|---|---|---|---|
| 900 Hz | 1 kS/s | 1 | 100 Hz |
| 1,100 Hz | 1 kS/s | 1 | 100 Hz |
| 2,900 Hz | 1 kS/s | 3 | 100 Hz |
| 5 kHz | 6.25 kS/s | 1 | 1.25 kHz |
| 60 Hz mains | 50 S/s | 1 | 10 Hz |
| 50 Hz mains | 60 S/s | 1 | 10 Hz |
| 60 Hz mains | 10 S/s | 6 | 0 Hz (DC) |
The mains rows show up on slow logging jobs. A strain or thermocouple channel logged at 10 S/s with some 60 Hz pickup takes every sample at the same point in the mains cycle, so the hum becomes a fixed offset that depends on where in the cycle the run started. Grid frequency is never exactly 60.000 Hz, so that offset creeps up and down over minutes and looks like thermal drift. At 50 S/s the same hum appears at 10 Hz, where it at least looks like noise. Both cases need an analog filter or an integrating measurement, covered below and in the thermocouple guide.
Why 2× isn’t enough
The 2× rule assumes an ideal filter that passes everything below fs/2 and removes everything above it, plus an ideal reconstruction (sinc interpolation) between samples. A CSV file plotted as a line chart has neither.
Seeing the waveform shape
For time-domain viewing, what counts is how many points per cycle the plot needs to resemble the signal. With N samples per cycle of a sine wave, the worst-case error in the captured peak is 1 - cos(π/N):
| Samples per cycle | Worst-case peak error |
|---|---|
| 4 | 29.3% |
| 5 | 19.1% |
| 10 | 4.9% |
| 20 | 1.2% |
Hence the usual rule of 5 to 10 times the highest frequency of interest for time-domain work, and more for peak values or edge timing. A 1 kHz sine logged at 10 kS/s can read up to about 5% low at its peaks. Logged at 2.5 kS/s, the plotted peaks can be off by more than half.
The 2.56 convention in spectrum and vibration analyzers
Frequency-domain instruments sample at closer to 2× because they have a steep analog filter ahead of the converter, and the usual ratio is 2.56. In the SR760 FFT analyzer manual from Stanford Research Systems, the instrument samples at 256 kHz, an analog filter attenuates everything above 128 kHz by 90 dB, and the displayed span stops at 100 kHz because the filter needs 100 to 128 kHz to roll off. Its 1,024-point FFTs give 400-line spectra for the same reason (1024 / 2.56 = 400).
The NI-9234 sound and vibration module runs at up to 51.2 kS/s, which is 2.56 × 20 kHz, and NI specifies its alias-free bandwidth as 0.45 × fs. The 2.56 ratio only holds up with an anti-aliasing filter like these in the signal path.
Anti-aliasing filters, and which DAQ devices have them
An anti-aliasing filter is an analog low-pass filter ahead of the converter. It can’t be digital, because once a frequency has aliased, a digital filter sees an ordinary in-band signal and passes it.
Delta-sigma devices designed for dynamic signals build one in. The NI-9234 and NI-9239 both list their converter type as “Delta-Sigma (with analog prefiltering)”, and the NI-9234 specifies 100 dB of stopband rejection from 0.55 × fs. Their sample rates are limited to the values the filter design supports.
Multiplexed SAR devices, which covers most low-cost USB multifunction DAQ hardware, usually don’t have one, since a fixed filter would limit the rates the device can scan. Check your own datasheet. Input bandwidth on these devices sits well above the maximum sample rate:
- LabJack’s T7 analog input specs give a −3 dB bandwidth of 445 kHz at gains of 1 and 10, against a 100 kS/s maximum stream rate, and call for an external hardware filter if unwanted signals between the Nyquist point and the analog cutoff are expected.
- The NI USB-6211 specifies a 450 kHz small-signal bandwidth on inputs that sample at up to 250 kS/s.
- The MCC USB-1208FS-Plus user’s guide lists no anti-aliasing filter for its 50 kS/s successive-approximation converter.
On these devices you supply the filter. A first-order RC is the minimum, and 1 kΩ with 100 nF gives a corner at fc = 1/(2πRC) ≈ 1.59 kHz. It falls at only 20 dB per decade, so a tone ten times above the corner loses 20 dB, and pushing an interferer below one LSB of a 12-bit converter (about 74 dB) would take a frequency ratio of around 5,000. Pair a modest RC corner just above your band with a sample rate well above it, then filter and decimate digitally. Keep the series resistor small on multiplexed inputs, because the input has to settle between channels. LabJack lists 1 kΩ as the maximum source impedance for the T7.
Per-channel rate on a multiplexed DAQ
Most USB DAQ devices share one converter across every analog input through a multiplexer. The headline rate is the aggregate across all channels in the scan:
per-channel rate = aggregate rate / number of channels
| Device | Aggregate maximum | Channels scanned | Per channel |
|---|---|---|---|
| MCC USB-1208FS-Plus | 50 kS/s | 8 single-ended | 6.25 kS/s |
| LabJack T7 | 100 kS/s | 14 | about 7.1 kS/s |
| NI USB-6211 | 250 kS/s | 16 single-ended | 15.6 kS/s |
Nyquist applies to the per-channel figure. A USB-1208FS-Plus scanning eight channels gives each one a Nyquist frequency of 3.125 kHz, so the 900 Hz tone from earlier is fine and a 5 kHz component on any of those channels aliases to 1.25 kHz.
The channels in a multiplexed scan are not sampled at the same instant. At the USB-1208FS-Plus’s full 50 kS/s, adjacent conversions are 20 µs apart, so the eighth channel lags the first by 140 µs. Temperatures and slow voltages won’t notice, but between two channels carrying a 1 kHz signal, 20 µs is 7.2 degrees of phase. For phase measurements, use a simultaneous-sampling device or correct for the known skew. Timing between separate devices is covered in synchronizing multiple DAQ devices. Devices without a hardware pacer add timing jitter on top, as described in hardware-timed vs software-timed sampling.
Oversampling and decimation
Delta-sigma converters sample faster than needed and reduce the rate internally (NI lists a 64× oversample rate for the NI-9234). You can do a coarse version on any device by averaging blocks of samples. Uncorrelated noise drops by the square root of the block length, so averaging 4 samples halves the noise, worth about one bit, and averaging 256 samples gains about four bits. The average also acts as a crude low-pass filter, so less high-frequency content folds into the lower output rate.
The resolution gain only appears when the noise is random and spans at least a few LSBs. Averaging won’t remove an interferer inside your band, and a plain block average has weak stopband rejection, so for spectral work use a decimating low-pass filter (a windowed FIR or a cascaded integrator-comb design) before dropping samples. Oversampling also multiplies the raw data you store. The DAQ file size calculator shows what a high rate does to a long run, and ADC resolution vs accuracy covers how noise, averaging and resolution interact.
A checklist for picking a rate
- Write down the highest frequency you care about, and separately the highest frequency present at the input, including mains harmonics, switching supplies and motor drives.
- For time-domain viewing, sample at 5 to 10 times the highest frequency of interest. For spectra measured through an anti-aliasing filter, 2.56 times is the convention.
- Divide the device’s aggregate rate by your channel count and check the result still satisfies step 2.
- If the device has no anti-aliasing filter and there is energy above the per-channel Nyquist frequency, add an RC filter, raise the rate and decimate, or both.
- For slow channels near mains wiring, average over a whole number of mains cycles instead of logging at a rate that divides evenly into 50 or 60 Hz.
- Check a spectrum of a test run, then change the sample rate and check again. A real tone stays at the same frequency and an alias moves.
The last test is quickest with a live spectrum beside the time-domain trace. DAQAtlas, which is in development, can put an FFT spectrum and a strip chart on the same dashboard.