LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

measure angular position using rotary incremental encoder with Arduino

 

Hello!

I'm trying to read pulses from the rotary encoder by using this code but it is showing random garbage values. how can I read values from the encoder by using phases A and B?

 

Is this necessary to have encoder vi to reading the values from it?

 

If yes, kindly provide it if you have any. Thanks!

Download All
0 Kudos
Message 1 of 9
(2,614 Views)

What you posted seems to be a code to read a potentiometer, not an encoder with AB(Z?) signals, so that might be your problem.

 

EDIT:

The code you posted is titled "ANALOG pin read example" and uses what seems to be potentiometer hooked up to +5V, GND and a signal line, which is the analog voltage you are (supposed to be) trying to read.

 

encoder with AB signals would most likely be digital and and would have 2 signal lines (3 if it includes the Z signal) and power lines.

Reading that kind of encoder with a single line analog read would equally result in reading garbage data.

0 Kudos
Message 2 of 9
(2,595 Views)

Thank you for your info!

 

Actually, I am trying to use a rotary incremental encoder using LabVIEW & Arduino. can you kindly guide me on how can I control the encoder?

0 Kudos
Message 3 of 9
(2,568 Views)

You have to use the interrupt pins which they are pin 2 and 3 in Arduino uno. You can use the attached example.

GOOD LUCK

Abdallah Farmalawi
0 Kudos
Message 4 of 9
(2,525 Views)

Hello!

Thank you for the code.

 

I did all the things mentioned in the file. I uploaded LIFA on the Arduino compiler. I used pins 2 & 3. During running code on LabVIEW, the encoder was not showing any result on LabVIEW. the count is not increasing or decreasing when I change the position of the encoder. 

 

Kindly tell me how can I resolve this issue. Thank you

0 Kudos
Message 5 of 9
(2,502 Views)

Hello!

 

I'm trying to read values from the encoder using this code

I used pins 2 & 3. During running code on LabVIEW, the encoder was not showing any result on LabVIEW. the count is not increasing or decreasing when I rotate the knob of the encoder. 

 

Kindly tell me how can I resolve this issue. Thank you

0 Kudos
Message 6 of 9
(2,477 Views)

Why aren't you using LINX?  LIFA is obsolete and was replaced by LINX.

0 Kudos
Message 7 of 9
(2,473 Views)

Hi!

 

can you guide me on how I this LIFA based code into LINX? because it is very difficult to find an encoder block in LINX. Thanks

0 Kudos
Message 8 of 9
(2,448 Views)

If the encoder pulses are coming quickly then an arduino alone using interrupts on A and B wont keep.

 

From my experience, you will need to find a suitable quadrature counter chip and interface to it from the arduino using something like SPI or I2C, to periodically poll for the latest count.

Some chips I have seen have the ability to trigger an interrupt line when a certain count is reached. What is the best approach will depend on the application.

 

0xDEAD

0 Kudos
Message 9 of 9
(2,434 Views)