From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

counter of pulses from an incremental rotary encoder on Arduino digital I/O

hello, I am trying to count pulses of the encoder connected on Arduino UNO digital pin 3 with Labview 2011.
I am able to see 0 and 1 status changing in 'Value' indicator, and display the waveform chart correctly,
but I do not know how to count the total number of pulses (rising or falling edges).
This test with shift register is not working. Should it be an event structure, looking at the changing of status HIGH-LOW on digital pin 3?

Thank you

George

Download All
0 Kudos
Message 1 of 14
(15,442 Views)

Hi,

 

There might be a problem in your code due to an uninitialized shift register. Every time you run your code the shift register would store a value from previous executions of the VI and pass it to the while loop. To avoid that right click on the input terminal of the left shift register and select Create » Constant and set the constant to zero. That way every time you  run your code your count will start from zero and not the previous value of the count. 

When you run the code do you see the "Numeric" indicator change value?

For future reference, please post Arduino related questions to the LabVIEW Interface for Arduino community page.

Sev K.
Senior Systems R&D Engineer | Wireless | CLA
National Instruments
0 Kudos
Message 2 of 14
(15,406 Views)

Hello, thank you for the suggestion, I added it. This is also a general Labview question, even if I am using an Arduino HW platform now for testing.

I know there are counters on specific pins of DAQ boards, but I am trying to do the same 'via software' on a standard digital IO pin. Is there any function detecting a change of state HIGH-LOW and sending the output to an indicator? I could not find it in the relevant palette.

0 Kudos
Message 3 of 14
(15,397 Views)

Hi,

 

You can use an event structure to detect a value change on an indicator connected to your digital read function. Every time that value changes an "event" will be triggered. You add specific code inside the event structure that will be executed every time this event occurs. Have a look at this tutorial for more details. Also, you might find this example helpful as well.

Sev K.
Senior Systems R&D Engineer | Wireless | CLA
National Instruments
0 Kudos
Message 4 of 14
(15,374 Views)

Dear all

 

I am starting wok with arduino uno and labview.

Now I'm trying to work with an encoder  http://www.dfrobot.com/index.php?route=product/product&path=47_110&product_id=634#.UKFvEuTtRgg

Now I can control the motor with http://www.dfrobot.com/index.php?route=product/product&product_id=69#.UKFv1-TtRgg.

 

My problem now is the encoder, I can read the pulses, but seems something is rong. When motor turns on and with a very slow speed the pules are not constants, seems the arduino don have speed enought to get the pules in right time (or the connection between the pc and arduino).

 

Can some one help me? I put in attach my first program to control a Dc motor with encoder.

 

Best regards

 

CPalha

0 Kudos
Message 5 of 14
(14,622 Views)

Dear all

 

I move this question for the arduino forum.

 

Best regards

 

CPalha

Message 6 of 14
(14,616 Views)

Hello my friend.

Have you solved this problem about the late of the sing reading betwen Labview and arduino?

I`m trying to do exactaly the same projet, so, I'm having the same problem.

Please, help me anyway!

 

thansk a lot.

 

lincolnfox@gmail.com

0 Kudos
Message 7 of 14
(13,923 Views)

Hi

 

Please see this post

 

https://decibel.ni.com/content/thread/15442?start=15&tstart=0

 

 

I give up from the encoder, I use a magnetic switch and 2 magnetic pieces attached to the moter axle. So I have 2 pulses per revolution.

 

CPalha

0 Kudos
Message 8 of 14
(13,916 Views)

hello such, any consultation with arduino is better than consult in the next group, also find, documentation, examples

 

https://decibel.ni.com/content/groups/labview-interface-for-arduino

0 Kudos
Message 9 of 14
(11,820 Views)

add other useful links, greetings

 

NI LabVIEW Interface for Arduino Toolkit - 

http://sine.ni.com/nips/cds/view/p/nid/209835

 

 

Getting Started With the LabVIEW Interface for Arduino

http://vishots.com/getting-started-with-the-labview-interface-for-arduino/

 

 

0 Kudos
Message 10 of 14
(11,819 Views)