Roboclaw - encoder readings are inconsistent based on direction of movement

Questions about using encoders with the Roboclaw product line
Post Reply
raghu_n
Posts: 2
Joined: Sun Mar 01, 2020 7:09 pm
Roboclaw - encoder readings are inconsistent based on direction of movement

Post by raghu_n »

I am using a Roboclaw 2x7A motor controller to control a linear actuator (Progressive automation). The linear actuator works without issues with regards to extending and retracting and the roboclaw commands are executing fine without issues. I am having problem with reading the encoder value from the roboclaw, particularly, only when the linear actuator is extending the arm. Here are the details.

I running the Roboclaw through an Arduino Mega. I am using the simple ReadEncM1 function to read the encoder values while the arm is being extended and retracted. I zero the Encoder values using the ResetEncoders() function (before starting to move the arm) so that I can observe the encoder values change.

When the arm is retracting, the encoder values are increasing linearly in the positive direction and the action is reliably repeatable. I believe I am getting the right values. The encoder values also increase at a slower pace (3-4 times slower as compared to the extension action).

When the arm is extending, however, the encoder values start at some negative value (not consistent, can be random, like, -245 or -560), increase towards zero (although not linearly) and then increase in the positive direction.
For example, the values can go like: -245, -238, -211, -204, -210, -221, -199, -184, .... -9, -1, 0, 4, 9, 12, 20, 28 ...

I have tried to look for some sort of pattern in the set of values, but I am just not able to find it. Basically, when the arm is extending, I just cannot use the encoder values.

I have tested this using the Basic Motion software as well and I seeing the results with the encoder reading. When the arm retracts, the encoder values are increasing in a nice linear fashion, slowly. When extending, there is sequence of negative values and then the positive numbers increase.

I am using quadrature encoder option; Connect both the output encoder wires from the linear actuator to the pins marked EN1. I have tried having only one of the pins connected, but it does not change the encoder values. I have checked the output from the linear actuator (hall effect sensor output) and the waves are nice square waves in both the encoder outputs. There are supposed to be 3500 pulses/inch moved.

Is there anything I am doing wrong?

Thanks.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Roboclaw - encoder readings are inconsistent based on direction of movement

Post by Basicmicro Support »

Most linear actuators use linear pots as encoders. If that is the case I would say there is something wrong with your wiring possibly or the linear pot is bad. Sanity check the measurements with a oscope.

If it is using quadrature encoders then the signals are most likely bad. Some quadrature encoders need pullups to function correctly. WIthout them Roboclaw may try to interpret what it gets but at best it will be inacrurate.

Always sanity check your signals when you are seeing odd behavior.

Analog signals should move smoothly and not jump when chaning directions. They should also be from 0 to 2v maximum.

Quadrature signals should be solid square wave signals and be a minimum of 2v on the high signal and no more than about .4v on the low signal. Anything outside that the Roboclaw will misinterpret.

Post Reply