LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

AI high sampling frequency triggering

Solved!
Go to solution

Dear Community

 

I am using a scanning tunneling microscope from which I am feeding two voltage signals to my USB-6212 DAQ card (Labview 2013 SP1). One voltage signal is the voltage applied to a piezo in the microscope (AI0). This signal drifts slowly over time and is noisy. The other voltage signal is a tunneling current converted to a voltage signal (AI2) (See attached picture):Signal Description.jpg

Ideally I would like to save both signals between the dashed lines in one .txt-file everytime the peak event in the top picture comes up. This should be about every second over the course of a day.

So far I have written a VI that calculates the running average of the piezo signal and if the piezo voltage goes a certain percentage over the running average it triggers a "save as file" command. The VI works ok for a sampling frequency of 100 Hz but when I go up to 20 kHz the trigger does not work properly anymore. I am also only looking at a batch of numbers (In this case 1000) and if there is a trigger signal in these 1000 samples. So if there is a signal around 0 or 1000 I would cut it and split it up into two files which I would like to avoid.

 

I don't have much experience with Labview and have probably broken every design rule in the book.

 

My question is if there is a smarter way of automatically saving the signal between the dashed lines even at high sampling frequencies?

 

Thank you very much in advance!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 6
(2,923 Views)

Hi Mario Marionis,


You can have a look at Kalman Filters in LabVIEW to filter the signal and avoid voltage drift, this would allow you to analyze your signal more effectively .

 

Regards,

 

Mark 

Applications Engineer Intern
National Instruments UK and Ireland
0 Kudos
Message 2 of 6
(2,853 Views)
Solution
Accepted by topic author MarioMarionis

Hi Mario,

I rewrote portions of your VI to improve performance (hopefully). No need for three queues.  No need to enque unless a trigger happens.

I'm confused by the triggering which seems to detect edges on high side of Piezo signal, even though the spike is in negative direction.  I modified this logic to (optionally) look for a threshold on high-side of tunneling signal.

 

It's not clear what might be happening at 20KHz.  The example shows a constant 1KHz sampling rate and 1K samples processed per loop.  If the sampling rate is changed to 20KHz, then the loop will have to run at 20Hz in order to keep-up with acquired data (@1K samples per read).

 

Hope the attached (untested) VI helps!

Message 3 of 6
(2,834 Views)

Hi Mark

 

Thanks for the suggestion with the filter! I am looking into how to implement this one to help averaging with the piezo-drift!

 

Best regards,

Mario

0 Kudos
Message 4 of 6
(2,770 Views)

Hi 550 nm!

 

Thanks for the help with the VI! It simplifies it quite a bit with only one Q in there.

Sorry about the confusion with the trigger edge! As I am quite inexperienced with Labview I was only aiming for the program to save the signal roughly around the time when the trigger occours and then write a matlab script to pick out the interesting bit (Just to make sure I don't miss the first bit of the signal). But it is of course much more elegant if Labview saves the correct part of the signal to begin with.

I'll run it on the microscope and keep you updated!

 

Thanks so much for your help!

 

Best regards,

Mario

0 Kudos
Message 5 of 6
(2,766 Views)

Hi 550nm

 

The trigger works very reliably now even at high frequencies! Thank you for that!

The output files look a bit unexpected if I go to sampling frequencies higher than 2000 Hz. I am not sure yet what's going on there. Might be that my signal is doing something unexpected there.

 

Thanks!

Mario

0 Kudos
Message 6 of 6
(2,727 Views)