U3 streaming at 4000 Hz : done , but ...

Recommended Posts

First of all, let me thank the AZEOTECH support team for providing the U3 4-channel streaming example. See attached .CTL file , this is the "generic" AZEOTECH solution and recommendation.

It also saved my day. Should I say my year!

The waveforms I get are perfect.

You need to provide a voltage signal that is always between 0 V and + 2V.

If you apply ground-centered signals on U3, you will only see the positive half.

Remember this.

This topic is not about signal conditionning.

This topic is about putting U3 in advanced modes like streaming and burst, in order to maximize its efficiency.

Let me express here the reason why I am posting this new topic :

Not only I need to acquire signals with a 4000 Hz sampling frequency, but

my application ALSO requires to monitor a couple of slow varying signals

So let us start explaining how I managed to get the maximum attainable sampling frequency in streaming mode. I did edit the generic .CFG file following AZEOTECH recommendations, using only two channels. See attached .CTL file at 4000 Hz.

You will note some critical changes in the workspace "sequence" area and also in the "page view" area (the properties of the graph).

You need to define the graph timebase in such a way that you don't waste the samples. If you sample at 4000 Hz, and if you intend to display 400 "true" acquired points on the graph, then the graph must have a timebase equal to 400/4000 sec = 0.1 sec. Properties -> bottom axis -> 0.1 s.

Displaying 400 horizontal points is fine, this is a convenient size on a 1024 x 768 screen.

In this example, I am sampling at 4000 Hz, meaning that 25% duty cycle square waves with a frequency of 400 Hz are perfectly rendered on screen. This is excellent for my car ignition diagnosis system. A 6 cyl engine running at 6000 RPM does generate a 300 Hz signal on the negative terminal of the coil.

Of course I am using a 1:500 voltage divider in order to reduce a potential 1000V on the coil to a safe 2V on the U3.

Problem solved you may think ... YES but ...

I still have big questions.

StartUp sequence


global d_number = 0

Logging.WriteFile.strFileName = "C:\MyFile"

//First, we do a pin config reset to set the U3 to factory defaults.

//eGet(D#, IOType, Channel, Value, x1). First 3 parameters always required.


Start_Stream sequence


Device.LabJack.AddRequest(d_number,"LJ_ioPUT_ANALOG_ENABLE_PORT",0,15,16,0) //Configure FIO0-FIO3 as analog and FIO4-EIO7 as digital.


Device.LabJack.AddRequest(d_number,"LJ_ioPUT_CONFIG","LJ_chSTREAM_SCAN_FREQUENCY",4000,0,0) // Set Scan Rate: 4000 samples/sec

Device.LabJack.AddRequest(d_number,"LJ_ioPUT_CONFIG","LJ_chSTREAM_BUFFER_SIZE",8000,0,0) // Specify a buffer in the UD driver.


Device.LabJack.AddRequest(d_number,"LJ_ioADD_STREAM_CHANNEL",0,0,0,0) // Add two streaming channels



Device.LabJack.AddRequest(d_number,"LJ_ioSTART_STREAM",0,0,0,0) // Start Stream Request


Stop_Stream sequence


Device.LabJack.AddRequest(d_number,"LJ_ioSTOP_STREAM",0,0,0,0) // Stop Stream Request


Here you can see how I am doing it, really a cut and paste from the AZEOTECH generic example and some critical changes to attain the 4000 Hz sampling frequency.

However, my application ALSO requires to monitor a couple of slow varying signals like coolant temperature, manifold air pressure, fuel pressure, and so on ... let us say aquiring them at 20 Hz and displaying them on the same DAQFactory page.

How to do this ?

Say that we want to aquire 2 fast signals : FIO0 and FIO1 (like in AZEOTECH generic example)

Say that we want to acquire 8 slow signals : EIO1 ... EIO7 (DB15 connector)

I see a couple of possibilities, but I need advice to properly implement this.

I can allocate a second U3 for the slow varying signals, but this is somewhat sub-optimal as I only need to capture two fast signals ... so what a waste if there is one dedicated U3 for the streaming ...

But if two U3 are really needed, I will use that solution.

So, I fear it is impossible to have one U3 doing two things simultaneous : a) streaming two channels at 4000 Hz and B) aquiring 8 channels at 20 Hz each ... this in order to display all channels on the same page using many graphs.

Approach 1


Is it possible to have two U3 running. First U3 in streaming mode and aquiring two channels at 4000 Hz. Second U3 in "normal" mode and acquiring about 8 channels at 20 Hz each ?

Approach 2


Is it possible to have within the same .CTL file, a kind of program sequencer that is dynamically reconfiguring the U3.

At the beginning, we send "reset" to U3.

Branch_0 :

Then imediately after we use U3 in "normal" mode : aquiring 8 channels at 20 Hz.

Then we stop this after one second.

Then we send another "reset" to U3.

Then we send the famous "stream" configuration and "start stream" configuration.

As soon as we have 500 samples in (from streaming), we send again "reset" to U3.

And we return to Branch_0. Meaning that we do cycle between the two modes.

Approach 3


Same as approach 2 but putting U3 in "burst" mode instead of stream" mode.

This may be less complicated, I don't know.



from Brussels

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.