Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Accuracy of high frequency square wave

Go to solution

I am going to buy a multi-function DAQ device for a new project. Application is as below:


a  square wave voltage signal is applied to a home-made sensor at a specified amplitude and frequency in the range of 100k-1MHz, e.g. 2.2 V and 250 kHz,  then a response signal from the sensor is measured/read using a analog input channel. There are three ways of providing the voltage square wave to the sensor, 1) use a digital output, 2) use a counter and 3) use a analog output. 


Can someone tell me which method has the best accuracy in both the amplitude and the frequency? so I can have a better idea to select which multi-function Daq to buy.




0 Kudos
Message 1 of 6

The best choice will depend on your further consideration of more factors than you've asked about.


1. How much current will this sensor consume, i.e., how much current must the square wave source?

2. What acquisition sample rate do you need for your response samples?  At 1 MHz square wave excitation, you have 0.5 microseconds in each state.  How many samples do you want to take during that 0.5 microseconds to characterize the response?

3. How fast must the square wave transition be?  Analog outputs will have a "slew rate" spec that can make the transition a little more ramp-like rather than vertical-wall-like.


- Generally, both digital and counter outputs will produce a fixed amplitude output while an analog output can be programmed to produce different amplitudes. 

- Frequency *resolution* will be best with a counter, digital and analog will likely be similar to one another.

- Frequency *accuracy* should be the same for all, as all of them will derive timing from the same on-board timebase clock.   

- 1 MHz square wave generation *capability* will be supported by any board's counters.  Various boards may or may not support it in analog and/or digital.  Note: you'll need a 2 MHz sample rate to produce a 1 MHz square wave via analog or digital.

- As stated earlier, a 1 MHz square wave would require 2 MHz analog *input* sampling just to get 1 sample per square wave state.  If you need to see something more like a response curve, say 5 points worth, you'd need to be able to sample at 10 MHz.  Very few MIO boards can do this.



-Kevin P

0 Kudos
Message 2 of 6

If you want to measure some parameters of the square wave like slew rate, settle time. (of jitter?)

you will need a much higher bandwidth .. I would consider 10 times as Kevin noted as the minimum (20x to 30x  if you want to measure!  not just compare), Cables and (mismatched) impedances already can have funny effects.. 


Depending on time and skills you can use a timer for the timing , an driver IC for the current supplied by an AO with a LM317 (or ...) to set the output level. Or go for an PXIsystem


Bandwidth reduces if you measure with sine... but it dedends what you want to measure..

Greetings from Germany

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

0 Kudos
Message 3 of 6
Hi Kevin,
Thank you very much for your answer to my question.
I am considering to purchase USB 6361 X series multi-function unit that can provide 16 bits 8 AI differential channels at 2Mhz for single channel and aggregate 1Mhz for multiple channels, and 2 AO channels at 2 MHz.
I am thinking to use either one AO or one counter or one DO to generate a square wave at a specified frequency in the range of 100 kHz to 1 MHz and apply it to my sensor, then use one set of the 8 AI differential channels to read the response from the sensor at 2 MHz. The current is not an issue for my application, the lower the better as long as the AI can pick it's voltage up for amplitude measurement, hence, I do not need to use more points to catch up a whole square wave, 2-3 points should work for its amplitude measurement. But I need very high accuracy in both amplitude and frequency for both the output and input signals. I am also considering to purchase a counter module and an analog input module combination if the counter is the best option for the accuracy.  But I need to know which is the best option for my application.
Another question is about the definition of  aggregate AI sample rate. The USB 6361 has 2 MHz for single channel and 1 MHz in an aggregate for multiple channels. Can the USB 6361 achieve 2 MHz if only one set of differential channels is used for a short time period, e.g. 1 ms , but programmatically switches to next set of the 8 AI differential channels? no multiple channels will be used at any time, all channels will be scanned programmatically. Is this possible?
Could you please advise?



0 Kudos
Message 4 of 6
Accepted by topic author edmonton
04-11-2019 06:38 PM

Any output solution using an MIO DAQ product will NOT give you "very high accuracy in both amplitude and frequency" for the outputs.




The counters have NO amplitude control, so unless you incorporate an external level shifter, you're only ever going to get a TTL signal out of your counter.  If you use an analog output, then you're going to run into the problem of a slow slew rate rounding off your "square" edges.  It's possible that, at 1 MHz, the signal won't even fully rise to your target amplitude in one 1 MHz cycle.




The frequency accuracy is fixed at 50 ppm, but I'll bet what you mean is that you want to be able to select a precise frequency, in which case you care about frequency resolution more.  The counters only support rates that are integer divide downs of the internal 100 MHz timebase.  In other words, 1 MHz is achievable because (100 MHz)/100 = 1.  The next lowest rate you could generate is (100 MHz)/101 = 990.099 kHz.  (The lower the frequency, the smaller these gaps become and, thus, the higher the frequency resolution.)  So if you needed "exactly" 993 kHz, for example, it won't be possible.  (And of course, these "achievable" rates are all subject to 50 ppm accuracy, so a 1 MHz signal will be subject to an error of +/- (1 MHz)*(50/1,000,000) = +/- 50 Hz).  This may or may not be a problem for your application.  You just have to define what "very high accuracy" means to you and your sensor.


If you tried to use the analog outputs, you could dynamically change the sample rate to get different frequencies, but you'd be subject to the same limitations as with the counters in terms of achievable frequencies.  If you tried instead to keep a constant sample rate (2 MS/s for example) but vary the data to fractionally sample the frequency you want, you'll end up with amplitude accuracy issues and would have to architect your code to handle frequency and amplitude shifting the signal in software and streaming that phase-continuous signal to your board.  This is probably more trouble than it's worth, especially given the signal quality you're likely to get on the output.




The counters are completely not going to work unless (A) you employ an external level shifter to get amplitude control and (B) you are okay with the frequency accuracy of the device and the frequency resolution native to any counter due to the divide down architecture.  The analog output is probably even more problematic, as explained above.  I'm not going to outright say that an MIO DAQ card is the wrong device for your input requirements, but I have my doubts.  In order to read the max amplitude of a square wave at 1 MHz, you'd ideally need to be sampling a bit faster than 2 MS/s and have enough analog bandwidth for the signal to reach steady state.  There is no bandwidth statement on this board in the specs, but I'm guessing it's probably not going to be enough since you would really want to at least get the first three or four partials (5-7 MHz of bandwidth).




What you really likely need is a function generator and a scope.  The former will allow you to produce a square wave and will have APIs for changing the amplitude and frequency phase-continously and on-the-fly.  FGENs use DDS or fractional resampling to get very fine (typically sub-mHz resolution), so you can achieve more "exotic" frequencies.  It will also have enough bandwidth (if you go with an NI product, the PXIe-5413 has 20 MHz, for example), to actually reproduce the first few critical partials that define the shape of a square wave at 1 MHz.  In other words, it will slew WAY faster than the AO of the 6361, and your signal won't look sinusoidal at 1 MHz like they almost certainly will on the 6361.  Pretty much any cheap scope will have a few 10s of MS/s of sample rate and about the same acquisition bandwidth, so I'd be surprised if you could find one that wouldn't meet your needs.  (For example, the lowest allowable low pass filter on a scope is usually about 20 MHz.)  Finding 16-bit resolution will be tough on a scope and will certainly cost you because that high a bitness for a flash ADC (needed to get fast scope sample rates) is expensive.


Obviously, an FGEN+Scope will be way more expensive, but you're going to have to make the decision of whether you want to compromise capability if you go with the DAQ card.  Your requirements seem to be pushing the boundaries of what a typical DAQ board will do.

Message 5 of 6

thanks for the in-depth information.


0 Kudos
Message 6 of 6