Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform generation problem

Hello all!

I'm trying to implement a system where I generate a sinusoidal waveform with a certain frequency and amplitude to modulate a laser.
At the same time I'm using the lock-in example that NI provides and I'm trying to adjust the DC value (offset) of the waveform I'm generating in order to make the "X" value given by the lock-in, for the first harmonic (order 1), equal (approximately) zero.

Everything works fine, when I'm not constantly generating a new waveform due to the value change of the "offset" (I check this by deleting the property "Value (signaling)" of the "offset"). When I continuously adjust the DC value of the wave I generate things start to get a little bad. The lock-in starts to have some problems in locking to the reference frequency and consequently I'm not able to properly measure the "X" value given by it.

In the waveform generation, I chose to store the output waveform on the on-board memory of the device and then generated continuously from there (I don't know if this is the best choice). I thought this could be better than continuously generate an output waveform.

And in order to generate an output waveform with the desired DC value I use an event structure.

Another doubt I have is if in the DAQmx Timing.vi I should use "Sample clock" or "Use Waveform".

I don't know if these assumptions are the best, and I'm asking if you could give me some help or suggestions in order to improve my system.

I think my solution would come from generating an output waveform with a certain frequency, amplitude, and DC value, in the most efficient way and varying the DC value according to the value calculated in the lock-in while loop.

I've got a PCI-6221, a BNC-2110 and Labview 7.1.

My vi's are attached below and the main one is the "lock-in.vi."

Thanks in advance!

Download All
0 Kudos
Message 1 of 9
(4,598 Views)

Hi,

This looks like a fun application. A couple questions about your setup: How are you supplying your reference signal - is this straight from your laser or some other source? Also, is the signal that you are PLL'ing to  from the AO on your card, or a reading from your laser?

As for your questions, if you use on-board memory, you have to stop, write your waveform and start your task to change the generation. If you don't use on-board, you can just write a new waveform on the fly. You won't have to write a new waveform every time, the card will regenerate your signal until you change whats in the buffer. Seeing as starting and stopping can mess with your phase and cause a bit of havoc with the Lock in Amp, I would suggest not using only on-board memory.

For the timing, they should be one in the same. If you choose Sample Clock, you have to specify a rate at which you are generating, and then use that same rate when you use the Basic function Generator down in your gera_onda.vi. If you use waveform timing, all that is pretty much handled for you. The DAQmx write vi takes the dt (1/Fs) and uses that to calculate the sampling frequency. It's really a matter of preference.

As far as getting x down to zero, I would try changing the phase rather that the DC offset - though that could work as well.

One thing to note, the Lock in Amplifier Toolkit isn't designed for M-Series cards, so performance will vary. Take a look at this KB so you know what to expect - Lock-In Amplifier Startup Toolkit Compatibility with Non-DSA Hardware . To get the best performance from your card, make sure to use the smallest range possible that will still cover your signal. It looks like you are using a range from +/- 10 V but you're generating a sine wave at 75mV. If you change your AI ( and AO) range to reflect your signal, you will have better accuracy over that range. This is crucial for the Lock in Amplifier.

Hope this helps, please don't hesitate to post back if you have additional questions or need clarification over any of my comments.

Cheers,

Andrew S

National Instruments

0 Kudos
Message 2 of 9
(4,592 Views)
Hi!

First of all, thank very much you for your answer.

Answering what you asked, I'm using for reference signal the AO that I generate with PCI-6221 and the signal that I'm PLL'ing is from my laser.

Sorry for posting just now, but I've been out these last days. I'll follow your advices and see if I get the desired results.

Best regards,
Filipe
0 Kudos
Message 3 of 9
(4,576 Views)
Hi again!

I've been working on this, and the results are not much better.

Is it possible to be happening some type of "non-syncronization", between the waveform generation and the lock-in acquisition? The PCI-6221 continuously output the waveform until I change its DC value, right? So, I don't think this could cause the problem...

I've restricted the maximum and minimum value and that does not cause any change at all.

I also tried to change the phase instead of the DC value, but that did not caused any change either.

I'm starting to get a little frustrated Smiley Sad

Another thing is that if I'm generating a waveform with, for example, a frequency of 1KHz, the lock-in PLL will give an output frequency not exactly equal to 1KHz. The difference is small, +/-3 Hz (and this difference is also achieved when I generate the waveform with a external function generator, just for testing purposes), but sometimes it gets bigger with differences around +/- 200Hz. Is this the best I can expect from this virtual lock-in?

Any help would be greatly appreciated!

Thanks in advance,
Filipe
0 Kudos
Message 4 of 9
(4,560 Views)
Hi Filipe,
 
A good way to see how the Lock in works is to run a loop back test from the cards AO. I've attached a quick VI that outputs a reference signal, and allows you to change the parameters of your measured signal on the fly. If you hook AO 0 to AI 0, AO 1 to AI 1 and use the original MultiChannel Lock In - DAQmx example you should be able to get a feel for what adjustments need to be made to get a 90 or 270 phase difference (x = 0).
I used this and changed the phase to get x close to zero.
 
Remember, the Lock in Toolkit was not designed for M series devices. They are lacking the dynamic range and antialiasing filters that our DSA devices have so perfomance is always going to be iffy.  Also, you can use the same sample clock on the AI and AO to try to improve your frequency accuracy, though I met with mixed results with this method.
 
Hope this helps, let me know if you have additional questions about the vi.
 
Cheers,
Andrew S 
0 Kudos
Message 5 of 9
(4,543 Views)
Hi Andrew!

Once more, thank you very much for the help provided.

Could you (or someone that reads this thread) please send me the .vi you attached as a previous version VI? I'm using Labview 7.1... Sorry about this...

I'd like to ask some more questions.
In the PCI-6221 the different input channels are simoultaneously sampled or not?
Is there any "cross-talk" between channels?
Is there any "MultiChannel Lock In - DAQmx example" that I can use with PCI-6221 in my application, or do I have to implement one that is suitable for PCI-6221, or PCI-6221 definitely  won't let me have an "100% trust/efficient" system for this kind of application I pretend?

Thanks in advance,
Filipe

Message Edited by Goju-Ryu on 04-11-2007 11:04 AM

0 Kudos
Message 6 of 9
(4,532 Views)
Hi!
Just one more thing, if someone could save the "Lock in tester.vi" as version 8.0 it is also suitable for me.

Thank you in advance!
0 Kudos
Message 7 of 9
(4,519 Views)

Hey Filipe,

I've attached a version that can be opened in LabVIEW 7.1. To answer your questions: Your 6221 is not a synchronous card - it multiplexes your inputs to a single ADC. This will add in a phase difference which will cause some errors. We spec the crosstalk at 100 kHz to be -75 db for adjacent channels and -95 db for non adjacent. This shouldn't have much of an effect on your reading. When it comes down to it, the 6221 is not well suited for the lock in amplifier. Hopefully you'll see better results with the Lock in tester, and be able to tweak your system with the laser to get better results.

cheers,

Andrew S 

 

0 Kudos
Message 8 of 9
(4,512 Views)
Hello all!

After many headaches Smiley Tongue I finally succeeded with my problem.

I chose another sampling rate (50 000 Hz) and increased the number of samples per channel to 8192, and the lock-in works just great. It locks exactly to the reference frequency, without any error, and my system is now able to perform its task correctly.

There was a conflict with these parameters, I don't know exactly what but probably a "beating" frequency between the internal clocks of my DAQ board and the sampling frequency, or something like that.

I hope this information can be helpful to someone.


0 Kudos
Message 9 of 9
(4,455 Views)