Encoder velocity

I am having troubles measuring the velocity of my linear encoder with PCI-6220 card.  I have read examples that used dx/dt, but I cannot seem to get that to wok-- when I wire that output to a gauge, I get "0".  I have also tried using shift registers to store previous data for position & time stamp to calculate changing position / changing time, but the problem with that is I get a lot of NaN & inf values randomly occuring admidst getting velocity readings that are appropriate. 
Thanks!

Hello Paolinooo,
To get an understanding of how to program an encoder task with the NI-DAQmx VIs and your PCI-6220, I would recommend taking a look at the DAQmx shipping examples found within the LabVIEW Example Finder by going to Help > Find Examples.  The encoder measurement examples can be found under DAQmx > Counter Measurements > Position.  Also, you can search the online example program database, found at www.ni.com/examples. 
Travis G.
Applications Engineering
National Instruments
www.ni.com/support

Similar Messages

  • Quadrature encoder, velocity

    Hi,
    I am using DAQ 6062E, with BNC 2120. I have a quadrature encoder, and I need to get the position, and velocity. I have modified BNC2120_Quadrature_Encoder vi from NI. I can compute the velocity (delta position/time loop) easily, however this is not very accurate. I need to have a high accuracy velocity, and I think I have to use the second counter to measure the frequency of channel. However, I am not able to calculate the velocity with this method. I have attached my vi. I appreciate if somebody can help.
    My encoder is connected to CTR Source 0 (PFI8), and UP_DOWN (P0.6)
    I have connected CTR Source 0 (PFI8) to CTR 1 Gate (PFI4)
    Thanks!
    Attachments:
    try encoder_with frequency.vi ‏58 KB

    I get reasonably accurate velocity from quad encoders by connecting the source of my counter to the internal 20MHz clock then gating said
    counter with my index pulse(Z) or either A or B, depending on the speed at which I am running. This will give you a count of time between
    revolutions if gating with Z, or it will yield time between X degrees if gating with A or B.

  • Encoder velocity + min and max of velocity

    Hello!
    I use incremental encoder and PCI-6220 card. I need to measure angular position and angular velocity of shaft (rotation angle of shaft is from -80 to + 80 degrees (there is no complete revolution). For measuring angular position I am using DAQ Assistant (encoder is for position measurement) (see attached file LabView 7). But I do not know how to measure angular velocity of shaft and also maximum and minimum values of velocity (of course minimum value of velocity have to be zero, because rotation is clockwise and counterclockwise)
    Sergey

    My attachment
    Attachments:
    ENC.vi ‏48 KB

  • Incremental encoder, velocity, position and direction

    hi,
    A incremental encoder(With channel A and B)
    I know that the velocity is proportionate with the frequence of the pulses and we can find the position with a simple edge count. But it's a bit difficult to find out the rotating direciton even if the principe is very evident.
    are there any exemples for these kinds of application?

    PCI-MIO-16E-1 --> DAQ-STC --> see paragraphs concerning DAQ-STC in this
    file
    Unfortunately I have never used a SC-2345. But after a short overview of its specifications, it seems that you will need one SCC-FT01 to connect the A channel to the counter source and the other to connect B to the auxiliary line that will set the direction. See schematic in the file mentionned above. So your hardware will allow you to take this measurement.
    See this example to see how to configure a DAQ-STC counter for position measurement.
    1) Simple event counting
    2) Up/down counting. Direction is given by hardware --> auxiliary line of the counter (DIO6 for counter 0 and DIO7 for counter 1)
    3) Start the counter
    4) Read periodically the counter value
    5) Reset the task when finished
    Don't be troubled by the BNC-2120. Use your SC-2345 instead. Obviously you will need to adapt the number of encoder pulses/rev to suit your encoder.
    Add a shift register to store the position from one iteration to the other and compute the difference to determine the direction.
    If you want to add the velocity, than you have two options :
    1) If the accuracy must not be very high, then you can compute it (delta position / loop time).
    2) If you need high accuracy, then it will necessary to use the second counter to measure the frequency of channel A. In order to avoid errors due to vibrations it is recommended to use the LS7084 in this case.
    As you can see here, there are 3 methods to measure a frequency.
    Obviously, the examples will not work with your DAQ-card because the 660X is a NI-TIO type counter.
    If you want to measure the velocity at the same time than the position, then you will need to use the first method (Inverse period measurement) because the others will need 2 counters. (your card has only 2 counters and one is already used for the position measurement).
    There is an example of period measurement for DAQ-STC that ships with LV (Measure Period (DAQ-STC).vi).
    1) Single period measurement
    2) Source specification --> internal timebase
    3) Gate specification --> channel A
    4) Start task
    5) Wait for one pulse on Gate. I recommend to add a timeout to not enter in an endless wait if there is no pulse.
    6) Read number of pulses of the internal timebase.
    7) Check if counter overflow
    8) Reset task
    You will need to combine both examples in one vi.
    I hope this is clear enough to help you.

  • Incremental Encoder Velocity VI Help

    Howdy Everyone,
    I am currently working on a project that requires me to get the velocity of an incremental encoder with 2 channels A and B. I already have the counts for A and position but I still did not find any VI that calculates velocity. I am currently using a Wireless Data Aquistion System "WLS-9163" with NI-9215 module.
    Any help would be really appreciated.
    Thanks.
    Mechanical Engineer

    Velocity is:
    Actual Sample - Previous Sample / Sampling Rate.
    1.Create Channel: CI - Position Linear Encoder
    2. The sample rate can be set using the Sample Clock Vi. One of the inputs is Rate.
    3.Use Counter 1DBL 1Chan N Samples in order to set the number of samples read.
     This way you'll get an array with "position values" sampled using the specified rate (at 2.). So you have to compute:
    pos[i] - pos[i+1] / rate  =>> velocity
    Paul
    PS: Sorry for VIs in German but I think it's easy to find them also in English, in DAQmx

  • Stepper Axis Encoder Problems

    I have a NI 7344 board controlling a servo motor and stepper motor each with their own seperate drives. I am having issues with the stepper encoder output while running in closed-loop mode. When running the stepper in velocity mode the measured velocity according to the motion card is about 15% of what the actual velocity of the stepper.
    The encoder position counts however, do update at the correct rate. If I connect the same encoder output to another axis and set that as a servo axis the encoder velocity is measured correctly (I've done it simulataneously and the servo axis displays the correct velocity while the stepper axis does not). I have verified that the stepper and encoder counts per revolution are correct and every relevant encoder setting is correct.
    Anybody have any ideas?
    Thanks

    The velocity reporting for steppers in NI-Motion 6.1.2 can be slightly incorrect at low step speeds with 733x and 734x boards because of a fixed point calculation error - this is ONLY a reporting error and the steppers WILL move at the correct speed. This has been fixed with NI-Motion 7.0.
    The Primary and Secondary feedback channels can no longer be set in MAX starting with NI-Motion 7.0, however, they can be set through the Motion API in LabVIEW, CVI, etc. This change was made to reduce the complexity of the interface in MAX.
    Hopefully this explains better the behavior of what you were seeing.

  • Understand​ing velocity control on 9505 FPGA VI

    I was able to quickly use the 9505 Servo Drive example to do closed loop position control on the FPGA but I'm having trouble with figuring out how to modify the code to support velocity control (which I need for a different axis).  I'm trying to make my modifications on the FPGA VI itself rather than on the RT Softmotion side.
    Here are the issues I'm having:
    If I use the PI Velocity Loop with my Velocity and an arbitrary control setpoint velocity, I can see the velocity stabilizes (motor output looks uniform) but I can't correlate it with the velocity setpoint other than a bigger number is faster.  Velocity (from the Encoder loop) seems to readback in values of just 0-2 on my FPGA VI (I don't fully understand the units but I see my position change on my encoder readback in thousands of counts per second).  Why are they so different/how do I scale my encoder velocity correctly?
    Using just the shipping 9505 Servo Drive example (position control), how do I set the velocity of a move from within the FPGA code (in interactive mode)?
    Solved!
    Go to Solution.

    I was able to get my velocity readings to match my velocity setpoints when using velocity control mode by increasing my Timer Config.Target Period and  Encoder 'calls per sample encoder' from 2000 to 40,000.  Now my velocity readback is +/- 1 of my velocity setpoint for my drive range.  This makes sense to me now - if you read the encoder to quickly it hasn't accumulated enough points to accurately calculate the velocity.  It was in the documentation but I didn't fully understand it.
    So now I'm down to one question - (from last post):
    I still don't understand how to set the velocity of a move if I'm using position control (out of the box example) from within the FPGA code (on the 9505 example).  Is the best way to do this just to limit the 'Current Output Range' depending on the max velocity requested?  The NI Softmotion RT VIs and Express VIs are able to set 'Velocity' but I'm really unclear what that the SoftMotion RT VIs are actually doing in terms of interacting with the FPGA code.  Can you explain how that works?

  • Encoder data into a PD closed control loop

    Hey, basically for our current project, we have to create a program that will run through a cRio for a buggy, the buggy has 2 motors of maximum 12V supply. The bugggy must travel a certain distance, 8m, over an uneven distance and end up at a particular end point.
    we are currently trying to create a a closed loop control system with a ramp input, then a Proportional Derivative system to alter the error from the encoders, which record the actual speed of the wheels.
    However we are unsure about how to go about creating this in labview or simulate this as we do not have access to the actual practical equipment at the moment, any help or links to guides about how to go about this or general help would be greatly appreciate, feel free to ask any questions if i have I can be clear about anything anymore, but we are really struggling atm.

    Thanks for replying,
     Basically we arent using a control and simulation loop anymore as it was proving to be too advanced for what we need to do. We arent using any toolkit in particular, however our vi is within a case structure, the attached folder is the vi that we have created so far.
    The simulated signals are to represent the encoder velocity values that we will obtain. If you can help us with any of the following it would be of great help:
    1. We currently a ramp input to simulate the acceleration at the start but are unsure on how to keep a constant velocity after the maximum velocity is reached and to have a deceleration at the end.
    2. We are unsure if what we have as P controller will actually minimise the error between desired velocity and actual velocity
    3. We dont have a stop condition, it has to travel a known distance, can this be worked out from the data gathered from the encoders and a stop condition created?
    We have access to the majority of applicable toolkits, shown in the attached photo.
    Any guidance would be greatly appreciated.
    Attachments:
    buggy control algorithm.vi ‏65 KB
    Tool pallette.png ‏39 KB

  • How to connect an angular encoder to NI9401 for velocity?

    I have an angular encoder connected to a NI9401 daq. I put line A of the encoder to one of the digital inputs and the same with line Z (line B is not conected because direction is not relevant). However I'm having a hard time trying to get the velocity because I haven't been able to count the pulses and all the examples that I have seen they use counter that the NI9401 doesn't has.
    Can anyone help me????

    Hello,
    What system do you have the NI 9401 module in … a compact DAQ or a compact RIO?  Please provide this information.  If you have the NI 9172 compact DAQ chassis, then placing the NI 9401 module in slots 5 or 6 will give you access to the counters on the back plane of the chassis.
    NI cDAQ-9172 User Guide and Specifications
    Samantha
    National Instruments
    Applications Engineer

  • Czech characters encoding problem in RTFTemplate with Velocity engine

    Hi,
    I am trying to use your RTFTemplate project but I have trouble displaying Czech characters in the generated RTF document. Instead of characters like �čř� I get only questionmarks ????. I thought that this could be related to setting a wrong encoding in the velocity.properties file, so I set it to windows-1250 (support for Czech characters) but it didn�t help. Do you have any idea, what could be the problem? If this is not the right place to ask such question, please let me know about a better one.
    Thank you for your time,
    Ivo Jansky

    Hi Jason,
    Indeed I had contacted the provider and informed them about the encoding problem and the fact that passing the parameter http_content_charset had no effect on the sent back encoding.
    They have taken into account my request and have changed the encoding used during the request to the HOOK_URL.
    Thanks to all of your for your help.
    Regards,
    Jerome.

  • Use incremental rotary encoder to measure the absolute position and velocity

    Hi all,
    I faced a problem by using incremental rotary encoder to measure the absolute position of the rotation. 
    I'm not using NI-Daqmx but NI-motion module. In NI-motion module, I use read encoder position.vi to read the position of the encoder. 
    However, the readings is in incremental form. I'm doing the feedback control, so I need the absolute position and velocity.
    Is there any functions or vi in the labview that can be used to transform the information of incremental encoder to the absolute one?
    Thanks
    Jun Wong

    Jun,
    1. The incremental encoder provides incremental position. After switching on the encoder power the encoder counts upwards or downwards. For the absolute position you need the index (R or I) signal. I don't know which type of incremental encoder you have but there should be A, B and (I or R) signals. The index signal should reset the counter to zero setting this way a pseudo-absolute-position (which is lost after the first switch of). Most of the motion controllers have a mode, just after switch on, in which the controller search for the Index. This mode is called Homing. 
    2. Velocity. It's very simple. You sample the position with a fix sampling clock. Let's say: 10kHz. The speed is: (Actual Position - Previous Position) / Sampling Period. Pos[n] = 10.000inc, Pos[n-1] = 9.900inc. Speed = 10.000 - 9.900 / (1/10kHz) = 1.000.000 inc/sec. If one increment is 0.0001mm then the speed is 100mm/sec.
    Paul 

  • How to find the velocity of an incremental encoder

    , i'm using RE22I encoder which can give upto 8192 counts per revolution, i have A,B,Z signals I'm using an fpga as a controller please help me.
    how to find velocity of the encoder using these signals i'm having a sysytem clock in the fpga will it be useful.
    Solved!
    Go to Solution.

    Start by looking at the information on Wikipedia on Rotary Encoders and an NI white paper on encoders.  These articles will give you a basic understanding of the encoder and the signals it produces.
    With appropriate decoding you can get the direction and a pulse each of the 8192 points on your encoder.  If the shaft can reverse direction (even vibration over a single point while mnearly stationary), the full decoding should be used.  If the data is only of interest while the shaft is rotating in one direction and the speed does not go near zero, a simpler decoding can be used.  Decoding a quadrature encoder is a good way to learn how to use a state machine.  The A and B signals can exist in only four possible combinations, but the possible transitions make things interesting.
    Defining the deconding is a purely logical exercise and coding it in LabVIEW as a state machine is straightforward.  There are examples, Desing Patterns, or Project Templates (depending on your LV version) which come with LV to help you get started.
    USing the A and B channels you can update your velocity calculation 8192 times per revolution.  Using Z you only get one update per revolution. Which you use may depend on your application.  The Z pulse also is useful to define a position reference for phase angle measurements.
    Lynn

  • Position, Velocity, Acceleration From Single Encoder, With TDMS Logging

    I'm still a fairly new user when it comes to Labview.  I started to feel comfortable enough to check out TDMS data logging and I'm kicking myself for not using it earlier.
    That said, I am currently reading angular position from an encoder, and estimating it's velocity and acceleration from the sampling rate & encoder resolution.  I'm using an FGV to do all the calculations and I've fine-tuned it to be as accurate as I would like.
    What I would like to do is implement TDMS logging that records position, calculated velocity and acceleration with the Log and Read option of TDMS.  I'd like these to be synchronized with the encoder reads, and I would like them to be handled by a single DAQmx Read vi.  As far as I can see though, you can only read the position information from the encoder.  I tried to drill down into the DAQmx Read.vi to create a modified version so that I could eploit the TDMS logging, but the subvi uses a call library function vi that currently is beyond my abilities. 
    I've been in MAX and I can't create any additional outputs for velocity and acceleration.  It seems like MAX takes enough information to create approximations from the sampling clock and resolution of the encoder.  Why doesn't it (or if it does, how do I implement it).

    What hardware are you using for reading the encoder? I have recently completed a similar project where the encoder was connected to a counter that was triggered by the counter increasing, so that it would only read on new positions, this worked reasonably well and seems like it should work well for your case.

  • Encoder position to velocity

    I am a beginner DAQ user and am trying to use a PCI-6110S to measure the velocity of rotation of a quadrature encoder. i am able to monitor the position change, but do not know what time component i can use to convert the position to velocity and acceleration. pls advise.

    Hi ALL,,
    i've seen the link that u give to me..
    As my picture below..
    I've gotten a position value in single sample..
    When
    i use your advice(it's a N sample method that is formed in array and of
    course it uses sample clock method by ither counter)
    So how can i easily develop RPM(velocity) value by its position? and even i get fixed time interval i can't..
    ~my optocoupler just has 2 output:
    TTL signal and ground 
    Any comment would be appreciated..Thank
    Ariawan. 

  • Velocity Measurement from FPQuad-510 encoder pulse counter

    Hi, I have a quad-510 quadrature encoder counter and a 1024pulse/1rotation encoder. How can I read or calculate angular velocity(accurately and without much delay) from encoder readings?
    Is there a special vi or another algorithm (other than derivative.vi) that could help?
    Thank you.

    Caner,
    What do you see listed for the status of the velocity channels in MAX?
    Also check your channel configuration to make sure you have an appropriate range set.
    Regards,
    Simon
    Message Edited by Simon H on 02-02-2007 06:50 PM
    Attachments:
    MAX_CTR.png ‏26 KB
    MAXDataConf.png ‏11 KB

Maybe you are looking for

  • Configuring Windows XP to use IIS w/ Kerberos

    I need to build a Windows XP SSO solution using IIS 5.1 with Integrated Windows Authentication using Kerberos protocol. IIS will then pass the request over to another application which will need to use a Kerberos JAAS module to authenticate the respe

  • Editing business components

    Hello guys, how can edit my business components ?? lets say i have added a new column to the table in database and i've made a new foreign key with another table, what is the best way to update these changes to my entities and view objects ? am using

  • Request Reverse posting

    Hi Friends, I would like to know the functionality of Request Reverse posting which is available in Monitor tab. How is it use ful for us? whats the the significance of Request Reverse posting? Thanks in advacne, Chandu.

  • 2 different  tables   in the main window with same internal table data

    Hi All, can we have 2 diffterent  tables with same internal table data into its work area in the main window.Is it possible or we will get any run time error.? is it like having 2 nested loop with same internal table ? ex : loop at itab1 into wa_itab

  • [asr9k] wrong XFP type

    hi, CSC: has anyone seen this behavior where a 10G XFP shows as both ER and ZR when you use different commands (see below) in an asr9000? RP/0/RSP0/CPU0:XXXXXXXX#sh int Te0/X/0/0 TenGigE0/X/0/0 is down, line protocol is down  [snip]   MTU 1514 bytes,