# Control testing

Hey everyone. I am new to creating robotic controls using sensors - the digital encoder. I was wondering if anyone knew how to obtain the number of counts that a digital encoder gives through one rotation of a motor shaft so that I can find the “distance per count” constant for our program. Also our encoder is a 4x if that has any play on anything.

Also I wish to use the encoder as a sensor for a PID loop to control the rotational angle of a shaft. Recently I had learned of motor control profiling and I was wondering if any one could explain how this works as well as how to program it. Much thanks!

PS: I’m using LabView and Java

The easy way to get distance per count is to:

• Add a readout of the raw encoder value (essentially set distance per count = 1)

• Layout a tape measure

• Push your robot slowly 5 or 10 feet (or if it’s an arm measure the rotation)

• Divide count readout by inches pushed to get distance per count in inches.

• Repeat to verify
You can calculate the value by knowing:

• The number of counts per revolution of your specific encoder (all transistions for 4x)

• gear reduction through transmission starting at the encoder mount point (not necessarily matched to the motor shaft rotation)

• sprocket reduction between the output shaft and the wheel

• The wheel circumference
*]Verify as before with a tape measure, readout, and pushing the robot a known distance

Thanks! I tried to test to see if we could just get feedback from the encoder and I noticed something odd: the rate of the Encoder Get was 0 even though I was reading a change in the distance output. What might be causing this?

The rate might be too slow to register, but it could be this known bug (there’s a solution at the very end).

Thanks! I wont be able to test the code till the 28 (Thanksgiving break…) but I think the off season update should solve the problem.

Also what are some ideal rates to set for minimum rate? The encoders are plugged into the 2010 KOP

AndyMark gear boxes - I’m not sure of their rpm. Thanks!

You can look the model up to find out its specs from US Digital. I recall the model used being http://www.usdigital.com/products/encoders/incremental/rotary/kit/e4p It says on the website max RPM

is 60,000 mechanically constrained. Count per revolution of the model appears to also factor in determining the actual RPM
with examples of 360CPR =10,000 and 100CPR = 36,000