04-02-2024 12:19 AM
Hello,
I am using an Incremental Encoder for which I am able to read the three pins (Phase A, Phase B and Phase C) of it and I am plotting the pulses. Now I wanted to calculate the angular speed of it.
I am not able to understand that, based on the three signals how I shall proceed to calculate its angular speed.
Pls: 1. If you have any test example LabVIEW Code of Incremental encoder, please do share.
2. I am using IEH3-4096 Encoder (Per channel 1024 resolution) of Faulhaber with SbRIO-9627 in LabVIEW.
Solved! Go to Solution.
04-02-2024 01:47 AM - edited 04-02-2024 01:52 AM
Hi rishab,
@rishab_kr wrote:
I am using an Incremental Encoder for which I am able to read the three pins (Phase A, Phase B and Phase C) of it and I am plotting the pulses. Now I wanted to calculate the angular speed of it.
I am not able to understand that, based on the three signals how I shall proceed to calculate its angular speed.
Angular speed is given by the reciprocal of of the pulse duration…
So you need to measure the duration of the pulses: I recommend to use the FPGA to count the time in ticks for each pulse.
This will work with just one pulse train…
To improve readings you should analyze A and B signals as they give you better resolution (4×, atleast for position measurements). You could measure the duration between each edge of both signals. (For speed measurement the resolution might be worse as there are shorter pulse durations for the same tick duration.)
What is "Phase C" of your encoder? Typically this is the zero pulse, which is useful for position measurements. For speed measurement you typically don't need it…
04-02-2024 02:13 AM
Thanks for your quick response,
Okay, so I have to count the times in ticks for each pulse (in the FPGA Target).
Yes, In the documentation it is being used to measure the index so it can be excluded as of now. (I am taking about phase C).
I am new to LabVIEW; can you provide an example for it. I am trying for it but unfortunately not able to understand concept to count the pins.
04-02-2024 02:37 AM - edited 04-02-2024 02:38 AM
04-02-2024 07:46 AM - edited 04-02-2024 07:47 AM
I tried this code, and I rotated the encoder. So, 0 and 1 values were showing as an output. So basically, what this code is doing? So, what I am understand is I need to count the high (for phase A) and high (for phase B), then I need to subtract it. (please correct if I am wrong) and do some calculations with the resolution.
04-02-2024 08:03 AM - edited 04-02-2024 08:04 AM
Hi rishab,
@rishab_kr wrote:
So basically, what this code is doing? So, what I am understand is I need to count the high (for phase A) and high (for phase B), then I need to subtract it. (please correct if I am wrong) and do some calculations with the resolution.
The shown code looks for edges in the boolean signal (using an XOR).
You need to add some timing in your loop so you get a defined iteration time: iteration time × count gives a duration!
Why do you think you need to subtract pulse durations of A and B signal? Your diagram doesn't show any subtractions…
(Hint: you need to count duration between edges of A and B when you want to improve position measurement resolution.)
04-02-2024 12:54 PM
I tried out something based on our discussion, please correct me if it does not make any sense to you.
04-03-2024 03:49 AM
I think it does not make any sense. I am still working on it.
04-03-2024 09:26 AM - edited 04-03-2024 09:39 AM
You are reading the A+, B+, and Z+ outputs.
An encoder works by creating pulses (A & B) a number of times per revolution. Some encoders, as in your case, have a Z pulse that only occurs when the encoder rolls over at the revolution mark. This if turning in the same direction will produce a pulse for every complete revolution of the encoder.
You need to understand how many pulses per revolution occurs in your encoder. Usually it is included in the part number as a -1000 to imply one thousand (A & B) pulses per revolution.
Now the encoder needs to differentiate between forward and reverse rotations. This is accomplished by following the pulse direction:
A & B will pulse high and low 999 times in one direction before another Z pulse occurs for a 1,000 pulse encoder. If it is a 1000 pulse encoder, each A or B pulse will occur every (360 degrees / 1,000 pulses) = 0.36 degrees. Using the A/B sequences can improve that resolution by a factor of 4 which can detect movement down to 0.09 degrees.
In your case, the IEH3-4096 Encoder is a 1024 pulse per revolution encoder with 4096 total steps (1024 * 4). It would offer the smallest resolution down to 0.087890625 degrees per step. A step is one step in the AB sequence above. Only a single pulse for either A or B occurs during the 4 steps.
04-04-2024 12:45 AM
I understand that A and B channel will give pulses whereas Channel C will give single pulse in a revolution. when you are talking about number of pulses in a revolution you are taking A&B combinedly.
I understand the four conditions are useful to determine whether it is rotating in Clockwise or anticlockwise direction.
I am attaching one code; can you check whether it is making sense to you. (Correct me if it is required).
Thanks for your time.