LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Encoder speed and orientation on NI 9401 in cDAQ-9172

Solved!
Go to solution

Hello, I've acquired a ni 9401 module for my cDAQ-9172 and it's now installed in slot five to connect a dual channel encoder. Channel A is connected to pin 14 and channel B to pin 17 and the encoder is powered by 5v dc.

I want to mesure the speed and if possible the orientation of rotation.

To do this I started with the VI in attach, that can count the total of pulses in the encoder.

My question is, how can I change the DAQmx Create Channel to Frequency, and the DAQmx Read to Counter Pulse Freq 1 Chan 1 Samp, to calculate the actual encoder speed and orientation?

0 Kudos
Message 1 of 7
(5,172 Views)

Hello Quintino,

 

Thank you for posting on NI Forums.

 

For any counter issues, I suggest you to check out the LabVIEW examples (Help-> Find Examples), in Hardware I/O, DAQmx, Counter Measurements, you should find different frequency measurements, depending on the range of the frequency you expect from your encoder.

 

The layout of your VI could actually suit, you just have to change the label (under the sub-vi box) of the polymorphic VIs "Create Channel" and "Read" to CI Frequency and Counter DBL 1Sample.

As an example I modified your original VI.

 

Regards,

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

Message 2 of 7
(5,114 Views)

Can you please send me your example Vi saved for LabView 2009, since we havent upgrade our systems yet.

Thank you for the help.

Regards.

 

André Quitnino

0 Kudos
Message 3 of 7
(5,105 Views)

Thank you for help Eric, but I still have a problem to read the speed with the encoder.

Like you told me, I've changed the DAQmx Create Channel to CI Freq and the DAQmx Read to Counter DBL 1Samp, and with a perfect quadrature signal in the pin 14, and the ground in pin 1, with the signal between 0V and 5V, the result of the speed is always changing, and I don't know why, and what to do to solve this problem.

The NI 9401 module is installed in slot 5.

The results I'm having are on a picture in attachment with the VI.

I'll be glad for your help.

Thank you once again.

 

André Quintino

ISR - UC

Download All
0 Kudos
Message 4 of 7
(5,046 Views)
Solution
Accepted by Quintino

Hi Quintino and sorry for not having answered quickly.

 

Your VI works perfectly fine for low frequencies with me. If you want to measure pretty high frequencies (>1kHz), you might need to check how a 2 counters measurement works. You'll find an example enclosed (lv2009). Just plug the signal to the source of one of the counter (ctr0 for instance) and set the counter control to ctr0 on the VI. Use a divisor not too high (4 is fine). I have been able to measure up to 1MHz signal on my board.

 

If the unstability problem is still happening after that, try to make a measurement with a Low Frequency Generator and 1 counter to check if the problem comes from the system (it should be).

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

Message 5 of 7
(4,963 Views)

Hi Eric.

Once again, thank you very much for the help.

I think I finally did it. The Vi is reading the speed witch I think is right, but there's some oscilation.

I've connected only the signal A from encoder to pin 14 on the NI-9401, and the pin 1 to ground. The signal B is not connected right now because I only have one NI-9401 on a cDAQ-9172, so only one counter.

The VI you just send me, is calculating the speed (frequency), witch I divid by 200 because those are the pulses per revolution of the encoder, but I can see a little of oscillation on the speed measured (see picture in attachment).

For now, my question is if is possible to improve the measurement, and how?

Thank you.

 

André Quintino.

 

P.S. - Note that in the picture in attachment, the speed is the one measured by the VI you just send me. The encoder was running at 1524RPM witch are 25,4Hz. Since the speed in the graph is multiplied by 200 (the pulses per revolution of the encoder), this result in a measurement of 5080 witch is the average number by the graph.

0 Kudos
Message 6 of 7
(4,951 Views)

Hi Eric,

 

I've implemented your large-range, 2-counter code into our application, but I am having trouble determinging the axes' units. I understand that the X-axis (labeled "Temp") is pulses from an encoder, but what is the Y-axis (labeled "Amplitude"), perhaps it is pulses/sec? 

 

Thanks!

 

Mark

0 Kudos
Message 7 of 7
(3,067 Views)