LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Single Pulse TTL

Solved!
Go to solution

Oleks,

 

I think there may be some possibilities.  I have never worked with the 4472, so I am speaking general terms and from what I have read in the manuals.

 

Clearly, one method is to use an external comparator to generate a logic signal (at your zero crossings) and use that to trigger the acquisitions.

 

Another thing which might work and would not require any additional equipment is to use an Analog Trigger on the resonance signal. You can route that signal out of the PXI-4472 and coulud use it to trigger the camera. If the signal is not directly available (my unfamiliarity with your hardware), you could probably use it to trigger a digital output from the PXI-6221, which could trigger the camera.

 

Another method which is not as good and would require a lot of post processing is this: 1. Acquire the pressure signal and measure the resonance frequency. 2. Generate a clock signal with the PXI-6221 counters which is a close to the resonance frequency as possible. It will never be an exact match and the frequencies will drift apart eventually. 3. Use this clock to trigger the camera. Also measure this clock on one of the unused PXI-4472 input channels. 4. Post process the data to find clock pulses which occur near the zero crossings of the resonance signal. Use the images captured from those pulses.

 

Lynn

0 Kudos
Message 11 of 21
(1,008 Views)

Hi Lynn,

 

These are great ideas! I somewhat tried #3, with the same approach as the current VI, that is I assumed that I will not get all 0-crossing of a dynamic data and thought that just one correct crossing might be sufficient. The way I implemented it was, once I get "true" from 0-xing routine, I initiated a pulse train at the same frequency as the resonance is, then I used it as a trigger for flow vizualisation. I guess I was hitting the same problem as I have right now, since the images that I recorded did not correspond to a single phase.

 

I am reading through the manual of the PXI 4472 and it looks like it support analog triggering (p3-11), in particular it has different ways of generating a triggering signal depending on the input. I think the "low value", when the trigger is generated at the time the signal value is less than "low value"  would be the ideal case for me.

 

I found the VI used by NI as a reference of this option(attached) and created a virtual channel "APFI0" which had ai0 wired to it. From my understanding, it should accept ai0 as an analog trigger input and once it passes a theshold of 0V(falling edge), it should graph the data that I feed to ai1. Besides that I can't figure out right now is how to actually wire the generated signal ouput so it can be used for triggering an external device. From the manual, it seems like it happens at the same time as the analog trigger reaches required crossing.

 

Did you have any experience with this type of triggering?

0 Kudos
Message 12 of 21
(1,001 Views)

Oleks,

 

No.  I have not used any of the trigger modes on modern DAQ devices.

 

I think that you need to do all the triggering in hardware.  The software part just sets everything up to be triggered. This is the way I would try to do it:

1. Find out how to get (if it is possible) the AI Start trigger OUTPUT from the PXI-4472 to a logic voltage signal on a connector so you can wire it to the camera trigger.  From the manual it appears that this signal is available on the PXI bus. If you cannot get to it directly, use it to trigger a Digital Output or Counter Output from the PXI-6221. Then you can use that for the camera.

2. Once all the physical connections are made, set up the program to trigger the output pulse from the PXI bus or the 6221.

3. Set the 4472 to analog trigger on the resonance signal zero crossing and to place the AI Start trigger on the bus if necessary.

4. Start the digital or counter task on the 6221.  It should now be waiting for the AI trigger.

5. Arm the camera to trigger.

6. Start the air flow and verify the presence of the resonance.

7. Start the AI task.

 

Now you should get a trigger on the zero crossings. I do not know how soon you can trigger the camera again. Set the AI task for finite samples and set the number of samples such that the AI task runs slightly longer than the minimum interval between camera triggers. Put the AI Read inside a loop.

 

Lynn

Message 13 of 21
(994 Views)

Thank you very much Lynn!

0 Kudos
Message 14 of 21
(989 Views)

Hi Oleks

   Have you finish your project using pressure signal to generate a trigger for PIV. Actually, I am doing the similar work. If you have time I have some questions to ask you.

 

 

Yang 

 

 

sincerely 

0 Kudos
Message 15 of 21
(912 Views)

Hi yangxu,

 

my two cents:

- Don't hijack old threads because you have "similar work". Create your own thread by posting a question!

- Instead of "I have questions to ask" you should just post your questions along with your VI. (Use your own thread as mentioned before!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 21
(910 Views)

@GerdW wrote:

Hi yangxu,

 

my two cents:

- Don't hijack old threads because you have "similar work". Create your own thread by posting a question!

- Instead of "I have questions to ask" you should just post your questions along with your VI. (Use your own thread as mentioned before!)

Hi  GerdW:     

      I am sorry to reply like that.

      Actually, I am working on a project. I use a pressure sensor to acquire analog signal (similar to a sine wave), and then I want to send triggle (TTL) at signal peak to PIV system to conduct measurements. I use DAQ NI-USB 6229, the attachment is my labview code and final signal goal that I want.  When run my code, I find the sended trigger is not stable, in other words, it is not in a same phase of pressure signal.

    So if any people know something about this, please help me. Or is it possible to achieve this goal using only this DAQ  without extra hardwares or devices?

 

thank you very much.

0 Kudos
Message 17 of 21
(899 Views)

Hi yangxu,

 

why do you:

- read your AI signal as "N channel" when you only use one channel in the task?

- read your AI task as "N samples" when you want to read only one sample?

- read your AI task as waveform when you want to process single samples?

- do you wait for 100ms in your loop when you have set a sample rate of 1kHz and read only one sample per DAQmxRead? You need to read at 1ms intervals! (You shouldn't use ANY wait function in the loop!!!)

 

On your phase shift problem:

- you build up a queue of 10 samples to detect peaks: this will give you a phase shift…

- starting a DAQmx tasks needs some time: this will give you a phase shift…

- doing a lot of UI stuff in your loop may lead to slower execution of other code parts and can create jitter in your CO task too…

 

Idea:

Does your DAQ device support analog triggers? If so you could create an analog trigger, that triggers when your signal reaches your peak. Using this trigger you might (re)start your CO task.

Think about noise in the pressure signal: it will not be that smooth as you have shown in your image!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 21
(884 Views)

Hi Gerdw

     Thank you for your reply. I check my DAQ (NI-USB-6229), it does not have the function of analog trigger, it only has digital trigger. As you mentioned, if I try to postporcess pressure data (like detect peak) and send trigger, it will cause lots of delay. So I did a test to bulid easy code to dectect zero-crossing, (see attachement) I find it still cannot give me a fixed phase (sine wave about 200Hz). The mininmum time for while loop is 1 ms, period of sine wave is  5 ms, so it will bring about 20% uncertainty. Is it impossible to finish my project without analog trigger?  Or do you have any suggestion?

 

thank you very much.

 

Sincerely 

0 Kudos
Message 19 of 21
(875 Views)

Hi yangxu,

 

you can have less iteration times of your loop when you don't use the Wait function at all!

You can set the iteration rate using the DAQmxRead function: you configured a samplerate of 4kS/S. When you would read 10 samples the Read function would wait for 2/4000=0.5ms!

 

period of sine wave is  5 ms, so it will bring about 20% uncertainty.

Yes, there is some inaccuracy…

Additional jitter will occur due to using a USB connection to your DAQ device: even when you detect the zero crossing instantly DAQmx will need time to forward the command to start the CO task to your USB device!

 

You can calculate the needed speed of your loop fromyour signal frequency and your required accuracy: detecting the zeri crossing within 10µs needs a loop able to spin at 100kHz. You will NEVER be able to achieve this by reading singe samples on a USB-connected device! You would need a FPGA target (like myRIO or cRIO) to be able to fulfill such a requirement…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 20 of 21
(867 Views)