# Calculating how many degrees for each encoder pulse

See this image:

Imagine the big circle is something like a wooden 500mm diameter circle, and the small one is a 30mm knob with a 20ppr encoder on it. When we spin the big one, the small one spins too by friction or wtv.

How can I know how many degrees the big circle has moved if the encoder moved 1 pulse?

I am talking about the maths, not the code.

Circle circumference = 2 x Pi x R, yes?
R = 1/2 D
What's so hard?
Large circumference divided by small circumference x pulses/revolution.

Here is a non-trig way of how I look at it.
The large wheel circumference is 500 * Pi or 1570.796 mm, divided by 360 gives 4.363 mm per degree.
The small wheel circumference is 30 * Pi or 94.248 mm, divided by 20 gives 4.712 mm per pulse.
The small wheel turns 4.712 mm per pulse, so does the large wheel turn 4.712 mm.
(4.712 - 4.363) / 4.363 = 0.08.
So with every pulse the large wheel moves about 1.08 degrees at its circumference.

I imagine there are plenty of people on here that use trig every day and can probably roll out a precise formula. The trig I learned too many years ago has never been used, so I fell back on this clunky method. I hope I'm not too far off...

If the problem of dividing one diameter or radius into another is too difficult for you to solve, simply rotate the big wheel one revolution, and count the encoder pulses.

Big wheel degrees per pulse = 360/pulses

No need to calculate the circumference of each wheel.
Just use the ratio of the diameters. (The value of π used in each circumference calculation cancels out).

No of degrees moved for one pulse = (360°/20) x (30/500) = 1.08°

wokcz:
Imagine the big circle is something like a wooden 500mm diameter circle, and the small one is a 30mm knob with a 20ppr encoder on it. When we spin the big one, the small one spins too by friction or wtv.

How can I know how many degrees the big circle has moved if the encoder moved 1 pulse?

I am talking about the maths, not the code.

There have been several other posts on the math, but for any of them (except possible reply #3) to be correct, the following have to be true:

• The shape and dimensions of the wheels are known exactly. The 30 mm knob is a mathematically perfect circle whose diameter is exactly 30 mm. Same goes for the 500 mm circle, except with "30" changed to "500".
• There is zero slippage between the wheels. Absolutely none whatsoever.

If your goal is to use the encoder on the small wheel to precisely determine the position of the large wheel, then your approach is almost certainly misguided. Any physical imperfection will introduce errors.

Even if the experimental approach (the one in reply #3) is used, again, any inconsistency (a slight wobble in either of the wheels, for example) will likely introduce errors.

To make a long story short, this is one of the reasons why gears exist.

Or toothed belts.