Tracking Steps with Incremental Encoder: ABZ Signals, 360 Pulses/Revolution, and Count Limit Issue

Question:

Hello everyone, I am currently integrating an incremental encoder with ABZ signals and 360 pulses per revolution (equivalent to 1440 counts per revolution) into my medical device to replace the manual encoder wheel. The device features 2 footplates that move in steps through a linkage system, with each revolution representing one stride consisting of 2 steps (1 right and 1 left). My objective is to track the total number of steps taken. Previously, I calculated the total counts (EncoderPosition) and divided by 720 (counts in half a revolution for one step). However, I encountered an issue where the count would reach 46, then abruptly change to -46 before counting back down and repeating the cycle. This behavior is likely due to the sensor module being limited to a maximum count of 32767, causing it to reset back to 0 after reaching this value. I have included the relevant code snippet for reference. If anyone has suggestions on how to address this issue within the count limit, I would greatly appreciate your input. Thank you!

Top Replies

It's important to specify the PLC you are using to address the issue of the high-speed input lacking a minimum of a 32-bit register. Consider utilizing a word integer type rather than a double integer for better functionality. One workaround is to add a double (unsigned) word when reaching 32767 and resetting the encoder register to ensure a maximum value of 4294967295 is maintained.

The B&R X20CP0843 unit features a unique counter system when paired with the X20MM4455 motor module, offering 16-bit functionality. The EncoderPosition variable is of INT type. Will this approach provide real-time updates for my step counter? Currently, I am able to increment up to 46 steps before it switches to -46 and repeats. By updating a new double word register (referred to as TotalEncoderCounts) every 46th step, I hope to track the total steps accurately. Although I currently calculate live steps by dividing ActualPosition by 720, the TotalEncoderCounts only updates when ActualPosition is at full capacity, hindering my ability to accurately track live progress.

Although I haven't personally implemented this solution, we encountered a similar issue involving a 16-bit word and pack counts being read into a SCADA system. The function block was locked, preventing us from changing the data type to a 32-bit double word. To work around this, I utilized a change of value on the 16-bit word in the PLC, adding it to the 32-bit word and then resetting the 16-bit word. This ensured accuracy even if the counts were faster than the PLC scan time. For example, if both the 16-bit and 32-bit words started at 0, and the PLC detected a change in the 16-bit word from 0 to 2 (assuming multiple pulses per scan), it would add 2 to the 32-bit word and reset the 16-bit word. This method helped maintain accuracy in the counts.

To enhance the efficiency of your system, make sure to compute the delta of the module's counter during each scan and store the data in a dedicated long integer variable.

Is there a Set or Reset function for encoder inputs in a PLC? The A-B at HCSE inputs offer a feature to set the encoder count to a specific value, such as when a hoist passes a HOME sensor. During my experience working on a hoist, I set the count to approximately 2150 each time it passed the sensor while traveling southbound. This adjustment was necessary to ensure accurate positioning, especially since the sensor was located about 1/3rd of the way down the track. Keep in mind that setting the count correctly is crucial, as even minor discrepancies in calibration can result in significant measurement errors. If this adjustment is made successfully, the encoder count will be updated every time it reaches 000.

Great to see you're integrating a digital encoder to your device! And yes, the behavior you're observing could indeed be caused by exceeding the unsigned 16-bit integer limit of 32767. A possible solution is to track when your counter is nearing the maximum value, then manually reset or rollback to zero before it causes an overflow. However, this would mean you have to keep track of those resets elsewhere and then add them to your total counts calculation. Alternatively, you could decide to switch to a larger data type which can accommodate larger values, so you wouldn’t need to perform such reset. Use of a 32-bit integer could suffice for your application.

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

To add a comment, please sign in or register if you haven't already..   

Frequently Asked Questions (FAQ)

FAQ: 1. What type of encoder signals are being used in the setup?

Answer: - ABZ signals are being used in the setup, where A and B are quadrature signals and Z is the index signal.

FAQ: 2. How many pulses per revolution does the incremental encoder have?

Answer: - The incremental encoder has 360 pulses per revolution, which is equivalent to 1440 counts per revolution when considering the quadrature signals.

FAQ: 3. How are steps defined in the context of the device's movement?

Answer: - Each revolution of the encoder corresponds to one stride, consisting of 2 steps (1 right and 1 left) due to the device's footplates moving in steps through a linkage system.

FAQ: 4. What issue was encountered with the count tracking system?

Answer: - The count would reach 46, then abruptly change to -46 before counting back down, likely due to the sensor module being limited to a maximum count of 32767 and resetting to 0 after reaching this value.

FAQ: 5. How was the total count of steps calculated initially?

Answer: - The total counts (EncoderPosition) were divided by 720 (counts in half a revolution for one step) to calculate the total number of steps taken.

FAQ: 6. Are there any suggestions on how to address the count limit issue?

Answer: - Suggestions on addressing the count limit issue within the sensor module's limitation would be appreciated.

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’