Quadrature encoder with a non-NI board

I am attempting use an encoder with a non-NI board (Measurement Computing) and I am unsure how to interface the encoder output from the board with LabView. I have the VIs for the board which allow the board to interface with LabView,. I essentially need a VI to decode the quadrature, the ones in the tutorials were not very helpful or insightful.

Hello Mystery,
Take a look at the section “Velocity and Acceleration Calculations” in this devzone.  While the article itself applies to CompactRIO, the equations used in the above section can help you determine how to convert the counter output into a velocity measurement. 
Does the counter value increase when you rotate the encoder in one direction and decrease when you rotate in the other direction?  This is essentially position measurement.  By knowing the number of ticks per revolution as well as the starting position of the encoder, you can determine the current rotation position.  For velocity, there is a little more to the measurement.  The concept relies on taking a counter measurement in a periodic manner.  Then you can use the number of encoder pulses that have occurred over that period of time to calculate velocity.  The document I linked about shows how to convert the number of encoder pulses over a fixed period of time into RPM which can be later converted into angular velocity.  Hope this helps. 
Regards,
Browning G
FlexRIO R&D

Similar Messages

  • Quadrature encoder with PCI-6259 DAQ board (driver for QNX)

    where can I find any example for connecting Quadrature Encoders with M Series DAQ Boards ?
    The only more or less suitable example I found in nimseries DDK, is
    "Count pulses from an external source using an external signal to control
    the count direction" (nimseries\Examples\gpctex2.cpp).
    But this example is not working correctly with Quadrature Encoders
    (encoders with  two shifted on 90 degrees phases A&B).
    i.e. in case of using this example code I get some extra count while encoder is on vibrant motor
    what means enums
    typedef enum {
           kG0_Up_DownHardware          = 2,
           kG0_Up_DownHardware_Gate     = 3,
    } tG0_Up_Down;
    and
    typedef enum {
           kG0_Encoder_Counting_ModeId          = 1,
    } tId;
    in (nimseries\ChipObjects\tTIO.h) ?
    What initalization procedure I need to work with Quadrature Encoders?
    I have PCI-6259 DAQ device
    and I'm writing programm under QNX6 operating system

    Hello alexey_3269,
    If you want to read a quadrature encoder start with gpctex1.cpp and follow the thread.
    I give you my code:
    BEGIN CODE
    ==========
    boardGpct->G0_Mode.writeG0_Load_Source_Select(tTIO​::tG0_Mode::kG0_Load_Source_SelectLoad_A);
    boardGpct->G0_Load_A.writeRegister(InitialCount);
    boardGpct->G0_Command.writeG0_Load(1);
    boardGpct->G0_Load_B.writeRegister(0);
    boardGpct->G0_Load_A.writeRegister(0);
    boardGpct->G0_Input_Select.setG0_Source_Select(9); //see above for choices, PFI8=9, 100 kHZ=18
    boardGpct->G0_Input_Select.setG0_Source_Polarity(1​); //0=CCW, 1=CW
    //If using 80 MHz timebase
    boardGpct->G0_MSeries_Counting_Mode.writeG0_MSerie​s_Alternate_Synchronization(1);
    boardGpct->G0_MSeries_Counting_Mode.setG0_MSeries_​Encoder_Counting_Mode(3);  //3 for X4 encoder counting
    boardGpct->G0_MSeries_Counting_Mode.flush();
    //Enable Input Pins
    boardGpct->G0_MSeries_ABZ.setG0_A_Select(9);  //PFI8=9,
    boardGpct->G0_MSeries_ABZ.setG0_B_Select(21); //PFI10=21
    boardGpct->G0_MSeries_ABZ.setG0_Z_Select(10); //PFI9=10 
    boardGpct->G0_MSeries_ABZ.flush();
    boardGpct->G0_Mode.setG0_Gate_Polarity(1); //invert=1
    boardGpct->G0_Mode.setG0_Output_Mode(tTIO::tG0_Mod​e::kG0_Output_ModePulse);
    boardGpct->G0_Mode.setG0_Loading_On_Gate(tTIO::tG0​_Mode::kG0_Loading_On_GateNo_Reload);
    boardGpct->G0_Mode.setG0_Loading_On_TC(tTIO::tG0_M​ode::kG0_Loading_On_TCRollover_On_TC);
    boardGpct->G0_Mode.setG0_Gating_Mode(tTIO::tG0_Mod​e::kG0_Gating_ModeLevel_Gating); //kG0_Gating_ModeGating_Disabled
    boardGpct->G0_Mode.setG0_Gate_On_Both_Edges(tTIO::​tG0_Mode::kG0_Gate_On_Both_EdgesBoth_Edges_Disable​d);
    boardGpct->G0_Mode.setG0_Trigger_Mode_For_Edge_Gat​e(tTIO::tG0_Mode::kG0_Trigger_Mode_For_Edge_GateGa​te_Starts_TC_Stops);
    boardGpct->G0_Mode.setG0_Stop_Mode(tTIO::tG0_Mode:​:kG0_Stop_ModeStop_On_Gate);
    boardGpct->G0_Mode.setG0_Counting_Once(tTIO::tG0_M​ode::kG0_Counting_OnceNo_HW_Disarm);
    boardGpct->G0_Mode.setG0_Reload_Source_Switching(t​TIO::tG0_Mode::kG0_Reload_Source_SwitchingAlternat​e);
    boardGpct->G0_Mode.flush();
    boardGpct->G0_Command.setG0_Up_Down(tTIO::tG0_Comm​and::kG0_Up_DownHardware); //kG0_Up_DownSoftware_Down
    boardGpct->G0_Command.setG0_Bank_Switch_Enable(tTI​O::tG0_Command::kG0_Bank_Switch_EnableBank_X);
    boardGpct->G0_Command.setG0_Bank_Switch_Mode(tTIO:​:tG0_Command::kG0_Bank_Switch_ModeGate);
    boardGpct->G0_Command.flush();
    boardGpct->Interrupt_G0_Enable.setG0_TC_Interrupt_​Enable(0);
    boardGpct->Interrupt_G0_Enable.setG0_Gate_Interrup​t_Enable(0);
    boardGpct->Interrupt_G0_Enable.flush();
    END CODE
    ========
    I hope this code is appropriate to you.
    FV1234

  • Troulbe in measurement quadrature encoder with 6601.

    Hi,
    We are trying to measure position with 6601. The frequency of quadrature encoder is from 100Hz to 8MHz. Now, we connet the A,B and Z channel directly to counter . Using the example in CVI, we change the filter to 100ns and use x4 mode. It works perfect at low frequency.
    The problem is when the frequency of encoder is higher than 2MHz, the accuracy decreases greatly. I'd like to know about following:
    1.Can 6601 do the previous task enough? Or I must change to use 6602.
    2.If 6601 is available, is there any way to increase measurement accuracy ?(in software or wire connection )

    Jimmy,
    You would need to specify what type of accuracy you are looking for, which is pretty much dependant on the type of operation you are performing. You could be looking to timestamp your encoder positions or you could also be looking to perform position/angle tracking over time. You could also be performing single point vs. multiple point (buffered) operations. You could mention which one of the CVI examples you are using and that could give an idea of the type of operation you are performing.
    The NI-6601 is able to perform quadrature encoder measurements and the only limitations you can have in regards of frequency are the filtering parameters (if you use filtering) and the actual maximum timebase of the board (20 MHz).
    Please keep in mind that by ena
    bling filtering at 100 ns you are only guaranteeing that pulses with widths of 100 ns or longer are not being filtered out. This limits your encoder phase frequency to around 5 MHz. (Each encoder period has a 50% duty cycle, therefore the pulse duration is half the encoder period). You can refer to the board�s manual for more information on filtering.
    We would have to know the following in order to provide further help:
    a) Type of operation being performed
    b) Specific example you were using
    c) Type of accuracy you were looking for
    d) Range of accuracy you needed on your measurement
    Regards
    Alejandro Asenjo
    Applications Engineer
    National Instruments

  • Troulbe in measuremen​t quadrature encoder with 6601

    Hi,
    Thanks for Ross's help.But I cannot differ 6601's x4 mode from other counter/timer counting mode. In measurement position, what difference between them. And I just want to know whether my application viable.
    We are trying to measure position with 6601. The frequency of quadrature encoder is from 100Hz to 8MHz. Now, we connet the A,B and Z channel directly to counter . Using the example in CVI, we change the filter to 100ns and use x4 mode. It works perfect at low frequency.
    The problem is when the frequency of encoder is higher than 2MHz, the accuracy decreases greatly. I'd like to know about following:
    1.Can 6601 do the previous task enough? Or I must change to use 6602.
    2.If
    6601 is available, is there any way to increase measurement accuracy ?(in software or wire connection )

    >jimmyjimmy2000
    "Hi,
    Thanks for Ross's help.But I cannot differ 6601's x4 mode from other counter/timer counting mode. In measurement position, what difference between them. And I just want to know whether my application viable.
    >>mross>The application is viable. However, the use may be difficult.
    >jimmyjimmy2000
    We are trying to measure position with 6601. The frequency of quadrature encoder is from 100Hz to 8MHz. Now, we connet the A,B and Z channel directly to counter . Using the example in CVI, we change the filter to 100ns and use x4 mode. It works perfect at low frequency.
    The problem is when the frequency of encoder is higher than 2MHz, the accuracy decreases greatly. I'd like to know about following:
    1.Can 6601 do the previous task enough? Or I must change to use 6602.
    >>mross>The 6601 is just as good as the 6602 at 2MHz. Therefore, a 6602 will have the same problem of inaccuracy.
    >jimmyjimmy2000
    2.If 6601 is available, is there any way to increase measurement accuracy ?(in software or wire connection )"
    >>mross>Yes, in the wire connection you can make improvements.
    6601 can count as fast as 20MHz (60MHz with prescaling). The signal is noisy (containing addtional, incorrect information).
    You must use an oscillosope to look at the signal. Look at it when 6601 is counting correctly, and look at it when 6601 is "malfunctioning".
    The counter will increment whenever the signal is high for more than 5 nanoseconds. The conditions for "High" and "Low" signals must be strictly met. If the signal is greater than 0.8V, the counter may increment. The signal must then drop below 2 Volts for a "Low" to be seen.
    This sounds wrong, but is true. The counter is expecting TTL signal conditions (Transistor -Transistor Logic). This specification is very broad.
    A "High" will absolutely be recognised if the signal is greater than 2.0V.
    A "Low" will absolutely be recognised if the signal is less than 0.8 V.
    However, the range from 0.8V to 2.0V is "undefined." This means the counter could increment at 0.8V. It has been my experience that National Instruments TTL will always see 0.8V as a "High." If your noise exceeds 0.8V you will never be able to count accurately.
    The problem will be solved when your encoder signal is read cleanly by the 6601. This is why I gave you the URL for US Digital in the previous answer. The circuits they sell can help to clean up the counter signals. You will have to see what works best, since I don't exactly understnad you application. If the noise is very bad, you may wish to use the Encoder to Binary Number circuit. There will be no noise in the reading of a binary number. Since your encoder may run as fast as 8MHz, you must be sure the circuit you choose is also this fast.
    The other solution is to eliminate the noise which is causing the counter to trigger falsely. THis can be a very interesting problem to solve. Please look a this NI link:
    Field Wiring and Noise Considerations for Analog Signalsv
    http://zone.ni.com/devzone/conceptd.nsf/webmain/01​F147E156A1BE15862568650057DF15?opendocument
    Follow these instructions very carefully.
    Also, this book is helpful to explain noise and how one may reduce it.
    From Amazon.com you can get Grounding and Shielding Techniques, by Ralph Morrison.
    http://www.amazon.com/exec/obidos/ASIN/ 0471245186/104-3492923-2811911
    Be very careful how you wire the circuits. Try to use only one ground point.
    The worst source of noise can be the motor and drive that spins the encoder. Be particularly careful in wiring this apparatus. A simple solution can be to use an air powered motor insted of an electric motor.
    Good luck,
    Mike Ross

  • 6602 quadrature encoder with c code

    I need to implement a quadrature encoder on the 6602 board usinng c language.
    I found some good function, for example  DAQmxBaseCreateCIAngEncoderChan, but i think this function is only for DaqmxBase,
    is there some similar function for Daqmx, or have i to do it myself?
    From where can i start?
    Thank you in andvance
    There are 10 kinds of people. Those who understand binary notation, and those who do not.

    Solved my problem.
    I installed the daqmx version on CD and it was old.
    Now i installed the new version daqmx 9.0 , that i toke from the site.
    This version has the function i need  DAQmxCreateCIAngEncoderChan,
    it compiles , now i have only to attach my encoder.
    Thank you lo stesso
    Message Edited by blacksocket on 02-08-2010 05:32 AM
    There are 10 kinds of people. Those who understand binary notation, and those who do not.

  • 15 T quadrature encoder with NI 9401

    Hey,
    I have a 15 T encoder  with 1024 pulse/rev and I have it hooked to a 9401 daq to measure angular displacement. I was having issues with the signals reaching the threshold value of .8 V for the daq so I ran channels A and B through a bang bang control circuit. Now, the daq reads the signals, but only counts up. I scoped the channels and it looks like the pulses are not 90 degrees out of phase. I removed the channels from the circuit and they are still perfectly in phase. Is there a good way to get labview to add a 90 degree phase delay to only one channel? I'm running a two-channel pulse count with no Z channel.
    Thanks a ton,
    Wyatt

    Problem solved, but now there is noise from the wind tunnel affecting the encoder signal. They are not wired to the same power source though and I'm sure it isn't vibrations from the wind tunnel because the noise occurs even when I drive the motor at 1Hz.

  • NI 6602 measure quadrature encoder with two signal edge sepearation

    Is it possible to improve the position measurement for X4 encoders,
    that the measurement starts at start trigger and stops at the stop
    trigger signal like the normal two signal edge seperation measurments.
    Everything I tried don't works. Does anyone have an idea. Thank You
    for Your trouble.

    Hello Yong,
    You have no wait time within your for loop.  This means that the loop will execute as fast as possible, but not at a constant rate.  To acheive a more constane rate, try inserting a Wait Time of 1 ms.  This will get you a loop with a 1 kHz rate.
    How fast is your PWM Signal?  It may be that you are missing some two edge measurements while waiting for the loop to iterate.
    I suggest merging your error clusters out of the DAQmx Read.vis.  Right now, you are just clearing out any errors.  Let me know if you start returning any errors once you have done this.
    Regards,
    Sean C.

  • Programming quadrature encoder

    I'm trying to program a incremental optical encoder with nidaqmx 7.4, with C#, using the PCI-6071e card. I want to measure position, velocity, and acceleration.
    As per the "How Do I Use a Quadrature Encoder with My Data Acquisition Board?" document, channel A of the encoder is connected to ctr0_source, channel B is connected to DIO6, and index is connected to ctr1_source.
    I'm trying to run the the MeasAngularPositionBuffered_Cont_ExtClk example. However, an exception is thrown when calling myTask.CIChannels.CreateAngularEncoderChannel.
    The messagebox says "Selected physical channel does not support the measurement type required by the virtual channel you are creating. Create a channel of measurement type that is supported by the physical channel, or select a physical channel that supports the measurement type"
    Also, there is an option in the example program to enable the Z index. How does that program know which channel to read the index pulse?
    I'm new at data acqusition, so any other hints regarding optical encoders are appreciated.
    Thanks,
    Gerry

    You also may be able to measure position using the "Count Edges" measurement with an external direction control. This may be enough for your purposes. Just bear in mind that quadrature encoders typically give off noisy signals, so you might have to build an external circuit to clean up the input signals. Let me know if you need more information on doing this with your E Series device.
    gus....

  • Using PCI-6025E with quadrature encoder.

    Hi,
    i'm presently trying to figure out if i can use the PCI-6025E Card to count up/down with a quadrature encoder with no additionnal hardware. I know my answer lies in a document called "Using Quadrature Encoders with E Series DAQ Boards document " but it is not presently available on the ni website.
    Can any1 either confirm me that i can do this or send me the document?
    Thank you,
    Max

    This link seems to confirm that you can
    Link
    Randall Pursley

  • Tuning an optical encoder with a linear actuator

    Hello everyone!
    I am trying to get an optical encoder (5 lead single ended, incorperated into an Ultramotion D2 series linear actuator) to read the position of the linear actuator's position to 4 decimal figures precision (0.0001), and the DAQ I am using is NI cDAQ 9121 with 2 channels. I decided to use the 65 mV configuration. The encoder has ground, channels A and B, index and 5V leads, of which I have omitted using the index and channel B. Channel A is connected to the AI+. The linear actuator has a scaling of 20,000 steps per revolution and a movement of 4mm per revolution (point to point configuration of the stepper motor drive ST5-S, by Applied Motion). 
    I am not sure if the above configuration is suitable, but I am limited to the current equipment. I have coded the program using LabVIEW 2014 and, while it seems to give a good estimation of the displacement to the nearest 1 mm,  it is not recording the fractions and counts anything that is 1mm or less as simply 1.
    My question is actually threefolds:
    1) How can I tune the encoder to read the exact measurement to the nearest 0.0001 accuracy?
    2) Am I using an appropriate configuration for the leads?
    3) If the problem is not one of the above, could it be something concerning the DAQ software settings and/or the code itself?
    Thanks for your advice in advance!

    Hey kmhijazi,
    Here I share the most general documentation about using encoders with DAQ devices:
    Using Quadrature Encoders with E Series DAQ Boards
    http://www.ni.com/tutorial/4623/en/
    Then, here’s a second resource where you can find more details that you can adjust to improve the measurement (i.e the Decoding type, which will however depend on your encoder specifically):
    Encoder Measurements: How-To Guide
    http://www.ni.com/tutorial/7109/en/
    And, here you will find how to create a test task in NI MAX to try changing these parameters and test if these improve your accuracy.
    Connecting Quadrature Encoders to a DAQ Device
    http://www.ni.com/getting-started/set-up-hardware/data-acquisition/quadrature-encoders
    I hope this can help.
    Regards,
    >>Daniel C.

  • Does Stop task reset a quadrature encoder counter?

    I am using an M-Series PCI-6280 board, with one of its onboard counters wired as a quadrature encoder.
    1)I start the counter task, take a set of measurements with the counter, and then stop the task.
    2) The encoder which the encoder counter is monitoring continues to output quadrature encoder signals into the PCI board's counter.
    3) I start the task again, and perform another set of measurements.
    Which of the following occurs?
    Upon starting the task again, the counter's previous value was wiped and the measurements taken in (3) start at 0 counts. 
    The counter keeps the value it had before it was stopped and subsequently started, and the measurements in (3) cumulate on top of the measurements taken in (1). 
    The counter keeps the value it had before it was stopped, continues to increment/decrement position in (2) even after the task is stopped, and when the task is started in (3) the counter value is cumulative with the quadrature encoder pulses in (1) and (2). 
    Thanks in advance for the help. 
    Solved!
    Go to Solution.

    Hello acmap,
    In this case The behavior will be the following:
    Upon starting the task again, the counter's previous value was wiped and the measurements taken in (3) start at 0 counts.
    However, you can specify the initial count value of the counter on the Initial Count terminal of the DAQmx Start Task VI, so it doesn't have to start at zero, and you can implement the behavior described in your second option.
    Daniel

  • Using a Quadrature Encoder as a clock at best precision possible

    I would like to use a Quadrature encoder as a clock for analog data acquisition. Currently, I am using only one line of the encoder and the clock "ticks" when the line goes high. This is only one quarter of the precision the quatrature encoder is capable of, since it can count from both lines when they go either high or low. I was wondering if I can get the counter to send a pulse everytime it increments and use that pulse train as my clock. This would increase my analog data acquisition frequency four fold.

    Hello,
    It is not going to be possible to count both rising and falling edges with a single counter. You could route the A phase and B phase of your encoder to different counters to capture the different edges on the signals, but that will not help you in using this encoder as your clock source. What you may want to invest in is a quadrature clock converter. You can find more information on this at the following tutorial:
    Using Quadrature Encoders with E Series DAQ Boards
    Best,
    Jared A

  • Encoder and E-series DAQ Board

    Hello!
    I am connecting a Quadrature Encoder to a PCI-MIO-16E-4 DAQ board.  The board is now called a PCI-6040E.  I am wondering how exactly to connect the Encoder to the DAQ board.  Direction is not necessarily that important, but it would be cool if the DAQ board could tell when the direction changed.  On the board are an out, gate and clock.  I don't know what to put where???  Please help me???
    Thank you,
    Tiffany Bierly

    CTR0 :
    A --> CTR0 SRC (pin 37)
    B --> P0.6 (pin 16)
    CTR1 :
    A --> CTR1 SRC (pin 42)
    B --> P0.7 (pin 48)
    See chapter 4 of this document for more details about using quadrature encoders with series E DAQ boards.

  • Measuring distance using quadrature encoder

    I am currently doing a project that requires the positioning and characterization of TV signals. As such, the position of the TV receiver is one  important variable that i have to measure. I am required to automate the measurements and data logging using a PC/notebook. I have purchased a 2-channel HEDS-9000 quadrature encoder with 2000 CPR & the HEDS6120 codewheel - both from Avago Tech, to be interfaced with the notebook/PC. My idea is to get a TTL-to-RS232-to-USB converter to interface with the PC, so that i can feed the output from the encoder to the PC. However, i dun have much idea on how I can use LabView to interface the encoder and the PC. Can anyone offer some valuable advice?
    Btw, the encoder module consists of 5 pins - Vcc, GND, CH.A, CH.B, with one pin not used.
    Thanks !!

    Hi,
    I think one of the best and reliable options that should meet your needs is a bus-powered USB-M-Series device like the USB-6210.
    The USB-6210 is a multifunction data acquisition device with 16 analog inputs, 4 digital inputs, 4 digital outputs and 2 counters. Each of the counters can interface directly to the quadrature encoder signals of your HEDS-9000.
    It's very easy to use this device with the NI-DAQmx API for position measurements in LabVIEW. In fact there are some shipping examples that you can use for getting started.
    I hope this helps,
    Jochen Klier
    National Instruments Germany
    Message Edited by Jochen on 02-09-2007 09:18 AM

  • Quadrature Encoder measurements with PXI-6143 S-Series DAQ

    Has anyone used a S-series PXI-6143 DAQ to take encoder position measurements? I believe there are 2 counters available, if you have any examples of how to access and read from these counters it would be greatly appreciated.

    Hi Bentup,
    Measuring a quadrature encoder on your device is actually going to be a bit different than on an M series device.  The STC-2 chip, which is used in the M series, allows for A and B inputs specifically for encoder signals (used in the Angular Encoder task).  The original STC-1 chip which is used in E series and most S series boards (including your 6143) does not have these same inputs.  Instead, you may must a Count Digital Events task (taking advantage of the up/down line of the counter).  The Angular Encoder task is not supported on STC-1 devices.
    The article that lab_boy linked earlier actually mentions how to use an encoder with an E series device once you scroll down a bit (here's the link again).  This same procedure should apply to your S series--connect the A output of your encoder to the source of the Counter (this is the signal that you are counting).  Connect B to the up/down line of the counter (P0.6 and P0.7 for counter 0 and 1 respectively). 
    The downside with this method is that it is more susceptible to vibrations or noise on the encoder lines. If this is a problem for you, you can look into an external encoder conditioner like the one mentioned in the article.  I hope this helps!
    Best Regards,
    John
    John Passiak

Maybe you are looking for

  • Issue with VS project - Report has remapped fields

    VS 2005, Crystal XI R2 We recently upgraded a VS project using Crystal reports. The database has changed, with table name and field name changes. We used the "set datasource location" to remap the table names and fields. Reports run fine as stand alo

  • A/c determination -kofk

    hi, in case of make to stock/project sales etc -a/c determination will happen based on KOFK ctype for which posting will happen to FI & CO i want to know what value exactly gets posted to controlling Pl suggest

  • No reqmts/caps exists or not relevant to finite shceduling

    Hi All, I am getting above warning message if click on  capacity tab in process order. I have maintauned finite scheduling tick all reources in which is applicalbel for this process order. also i am getting information message Capacity availability:

  • PC Companion and Outlook 2010 calendar sync error

    Hi there I am using PC Companion 2.10.174 and Outlook 2010 (14.0.6129.5000) and a Xparia T with Android 4.1.2 (Build 9.1.A.1.140) Contact Sync runs without problems. But  when I try to sync my Outlook Calendar with the phone, an error occurs The logf

  • SQL - UNPIVOT

    Hello All, I'm trying to get unpivot and pivot to work and can't quite wrap my head around it. I created a test table which contains DAY, TYPE, DB_ID. In short the backup schedule for a database instance. Here is my SQL and output. select b.day_abbre