But this will still be wrong if it cable/wire gets wrapped… but it may not cause an issue in practice.
I see what you are saying and I think I see the confusion. It is important to keep in mind that the PWM signal is not telling the motor to “move” a particular distance it is telling the motor to apply an amount of torque. We can tell the motor to “pull harder” and “pull less hard”. With the encoder in place we check to see if the encoder is giving us the reading we want for our target position and then tell the motor to pull harder or less hard until the encoder moves to where we want it to be.
Understood… but it’s calculating that initial torque value based upon a certain mmPerRot… and my initial concern was that if that’s way off, it will result in a large error at start, maybe even to a point it throws the sled not keeping up error…
But, I think now, that if we just adjust the encoder steps correctly to match the encoder’s rotation, all will work… assuming the wrapping of the cable on spool doesn’t cause an issue as mmPerRot will be off. I hope I’m making sense.
I might need to be clearer on this point. If, for instance, the mmPerRot of the “spool” is 63.5 mm and the mmPerRot of the pinch roller is 6.35 mm (to make math simple) and it’s a 2K ppr quad encoder (8K steps/rotation) then we need to set the encoderSteps to 8K * (63.5 mm / 6.35 mm) = 80K. That’s probably way too high, so a lower ppr encoder is needed to get into a range the arduino can handle. That’s what seems nice about the capacitive encoders from CMI; their ppr setting can be programmed (or adjusted via dip switches depending upon the model).