# Encoder and number of revolutions

6 years 5 months ago #29530422 by maha
hello,
if I have a Roboteq SDC21xx.
and I set the Encoder configuration to the following:
setconfig(_EPPR, 1, 200)
which change the configuration to make the motor produce 200 pulses per revolution.

Now, I want to have how much the motor traveled exactly.
what i will do is the following:
getvalue(_ABCNTR, 1)
if the number coming from the above line is 800 for example.
then what i will do is, i will divide it by 4 because (1 pulse = 4 counts).
so it'll be 200. Now this is the number of pulses (200).
I should divide the number of pulses (200) by 200 in order to get the number of revolutions right?
because i set it to 200 PPR.
am i correct? please correct me.

if i set it to 100 PPR then i should divide it by 100 and so on, in order to get the exact number of revolutions of the motor shaft????

thank u

Note** just to make my question clear.. is this the right way to know how many revolutions did the motor do.. and the PPR thing is it correct or not?

6 years 5 months ago - 6 years 5 months ago #29530423
As stated, the number of counts made in 1 full revolution turn divided by 4, will give you the pulses used.

6 years 5 months ago #29530424 by maha
so if i divided the number of counts by 4 and got the pulses used.
how should i get the number of revolutions from the pulses?

6 years 5 months ago #29530427
1 Full revolution is the actual count. So if 1 full revolution is say 24 counts, then every 24 counts, is 1 revolution.

6 years 5 months ago #29530428 by maha
how should i know how many counts in one revolution i dont get what u r saying

6 years 5 months ago #29530429 by maha
should i make one revolution and see how much counts i got? if this true then each time i'll get different count depending on how much speed i provided to the motors. right?

6 years 5 months ago #29530430
Go to the "run" tab.

Set up a channel in the bottom right area and select counter 1 or enc counter 1. This will read back the absolute encoder value. If power up for first time, this value will be 0.

If the encoder value is currently 0 and the motor is not moving, then it stays at 0 and you have a reference point of the motor shaft (Either memorize the location of the shaft or mark it on the motor). If you manually rotate the shaft of the motor 1 full turn 360 degrees in either direction, it will give you a count.

So if you do 1 full 360 degree rotation of the shaft and wind up with say 24 counts, then that means 24 counts(1 pulse - 4 counts; therefore 24/4) or 6 pulse are used to make 1 full turn on the motor shaft.

So if you spin the motor for a while and get 24000 counts in your absolute encoder count value, then you divide that by 24(24 counts = 1 full turn), then this means that the motor has made 1000 revolutions or 6000 pulses.

6 years 5 months ago #29530431 by maha
but are you sure that no matter how fast i rotated the shaft.. the value will always be the same?
if i tried it twice and in each time i spin the shaft with a different speed manually. will always get the same number of count? if i of course reset it to zero in the second time.