Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Unstable Frequency Measurement USB6210

Hi All, 

 

I'm struggling to get a stable frequency measurement, to measure the RPM of a motor, using a single counter on a USB6210 board. 

 

I'm using the +5V TTL signal to power an opto-transistor, and reading that signal back through Ctr0 (PFI1). See attached wiring schematic.

 

I've put a scope in line (between PFI1 and DGND), and at the PFI1 terminal get a square wave, about 50Hz, peaks at about 2.5V. Do I need to be linking this signal to DGND, and how?

 

I've set up a task in MAX, and readings fluctuate from 45Hz to 900Hz.

 

I've also tried to read this in LabVIEW using the example VI - Meas Dig Frequency-Low Freq 1 Ctr.vi. I then get even more random results of +100,000 (full scale).

 

Many Thanks,

 

Martin 

Download All
0 Kudos
Message 1 of 8
(8,564 Views)

Hi Martin,

 

The threshhold for the digital input to be registered as a "High" could be as high as 2.2 V (from the specifications page).  From your screen capture of the oscilloscope, it looks like the signal is a bit noisy--what I imagine is happening is that you are reading in multiple edges for each trasition (this would show up as periods of a high frequency signal).

 

 

I suggest to try enabling the digital filtering on the 6210 with the following property node in LabVIEW:

 

PFI Filter.png

 

Just wire the property node anywhere in between the creation of the channel and the start of the task.  This will ignore any pulses below 2.56 ms and should hopefully be a good way to remove the ringing you are seeing.

 

 

Best Regards,

John Passiak
Message 2 of 8
(8,547 Views)

hi, im measuring an voltaje digital signal wich voltaje range is 0-138mV when 0 volts is zero and 130 mV is one and the max noise magnitude is 4,45mV and my expected signal's frequency is in 0-100Hz range.

 

i tried to measure the frequency with counter input 0 and i used daq assistant.vi, i configured it on one counter for low frequency signals, one sample on demand and i connected my signal on gate terminal(pfi 9 ni daq 6221). but my signal's frequency measure goes between 1 hz and 6.2 MHz. but i tested my signal with oscilloscope and it is being generated correctly.

 

do you think i can fix my problem with the digital filter that you proposed?, should i do anything more?, how i should choose the time you connected on CI.Freq.DigFltr.MinPulseWidth terminal in daqmx channel?, may i use this invocation node if i use daq assistan.vi.

 

thanks for help and best regards

.:. Pedro Rivera .:.
i love to work and develop on labview, this is real fun!!!
Photobucket
0 Kudos
Message 3 of 8
(7,582 Views)

Hi pedrorivera,

 

0-138 mV doesn't meet the voltage requirement to be registered as a logic high by the 6221 (which uses TTL voltage levels).  In all honestly I'm surprised that you are seeing anything other than a timeout error--can you post what your signal looks like on the oscilloscope?  Have you confirmed that the voltage output of your sensor is referenced to the same ground as the DAQ device?

 

It sounds like the issue you are seeing has more to do with an incompatibility between your sensor and the logic levels required by the digital inputs of the DAQ device.  You have a few options:

 

1.  Use the analog inputs instead.  You can then use the Tone Measurements Express VI to pick out the peak frequency of your input signal:

 

Tone Measurement.png

 

You would want to sample at a high enough rate such that your input signal is not aliased, and sample for a long enough duration (N Samples) to give you your desired resolution in the frequency domain.

 

 

2.  If you would rather use the counters to measure frequency, you would have to amplify your external signal so that it is compatibile with TTL voltage levels.  Filtering may or may not be necessary, but if it is you can refer to the PFI Filters section of the M Series User Manual for more information.  You want the Minimum Pulse Width to be long enough such that no glitches are detected, but short enough such that your signal is still picked up.  M Series devices only have 4 settings (disabled, 2.56 ms, 6.425 us, and 125 ns), and at 100 Hz you'll find that the 2.56 ms setting should be suitable to allow the signal through assuming the duty cycle is not very large or very small.

 

 

Best Regards,

John Passiak
Message 4 of 8
(7,568 Views)

thanks a lot John P, i'll try it this vi config.

 

well, my flow transmiter should give an 0-5 volts signal with frequency between 0 and 100 hz (datasheet here), and the data i need is codified in pulse frequency, the measured voltaje is wrong but frequency on oscilloscope is ok. i attached pics of my signal on oscilloscope measured on transmitter output, measures at daq card input are the same, i connected my transmitter ground to digital ground (im working on ni pci 6221).

 

i tried the  Minimum Pulse Width option with 2.56 ms but now i realized why did'nt worked (voltaje level issues :p), but now my typical noise is 3% of my signal, i think noise won't be a big deal.

 

and i was surprised too about this system could get data acquisition insteand of data timeout error (because of voltaje level's issues), at first test i performed the system made the measures already mentioned, but i realized the ones who made this system attached the signal acquisition line to waterpump's power source (in fact, they attatched all data signal's lines to waterpump's power source ¬¬) and they hid noise effects with waveform's settings, now i fixed this and the system only shows me data timeout error.

 

initially i got confused because if im getting frequency acquisition of milivolts signal i thought daq card's counter input could deal with it, but now i realized it was just noise peak effects.

 

best regards

.:. Pedro Rivera .:.
i love to work and develop on labview, this is real fun!!!
Photobucket
0 Kudos
Message 5 of 8
(7,563 Views)

Hi John,

 


I have created angular encoder and it does count, but my signals do have few transitions after the rising edge which caused incorrect counting. I would like to turn on debouncing filter on PF0, PF1 and PF2 lines (which should solve my problem) but I do not know how to do it in measurement studio(C#).

 

I tried to find solution on net, but with no success. Could you please paste code snippet if you have, or just point me where to look?

 

I used following command to generate angular encoder channel:


CIChannel channel = CIChannels.CreateAngularEncoderChannel("Dev1/ctr0", "AngularPosition", CIEncoderDecodingType.X4, true, 0, CIEncoderZIndexPhase.AHighBHigh, 18000, 0, CIAngularEncoderUnits.Degrees);

And I tried


channel.FrequencyDigitalFilterEnable = true;
channel.FrequencyDigitalFilterMinimumPulseWidth = 0.05;

 

but at the runtime the exception with following error message has been throwed:


"Message"Specified property is not supported by the device or is not applicable to the task.\n\nProperty: NationalInstruments.DAQmx.CIChannel.FrequencyDigitalFilterEnable\nChannel Name: AngularPosition\n\nTask Name:_unnamedTask<1>\n\nStatus Code: -200452"


Device: USB 6210
NI app: Measurement studio

Thanks in advance,


Mikkac

0 Kudos
Message 6 of 8
(7,459 Views)

Hi Mikkac,

 

The digital filtering properties are actually associated with specific channel types.  It looks like the ones you need should be of the form channel.EncoderAInputDigitalFilterEnable (etc.).  You will need to enable the filter and set its pulse width for each of the input channels (A, B, and Z if applicable).

 

Also, I see that you are trying to set a 50 ms filter.  Keep in mind that the hardware only supports a few pre-defined values (mentioned in the user manual).  For the 621x, this is {125 ns, 6.425 ns, 2.56 ms, disabled}.

 

 

Best Regards,

John Passiak
0 Kudos
Message 7 of 8
(7,437 Views)

Thanks John!

0 Kudos
Message 8 of 8
(7,421 Views)