devol.dev

Gear ratios

A gear ratio calculator that only prints a number answers a question nobody actually asked. The real question is: which way does the output spin, how much slower does it turn, and how much harder does it push. All three answers are sitting right there in the tooth counts, and watching an actual gear train turn makes them obvious in a way the arithmetic alone does not.

Compound gear reduction

Watch a gear train think

The input gear spins at a fixed reference speed. Change the tooth counts and watch how the rest of the train responds: bigger gears turn slower and push harder, and every mesh flips direction. The input runs at 100 rpm the whole time; everything else is relative to that.

Ratio
Output speed
Torque gain
Power kept

Bigger gear, slower and stronger

Every gear on the train shares the same tooth size, so a gear’s size is set entirely by its tooth count: more teeth means a bigger circle. Two meshing gears turn at speeds inversely proportional to their tooth counts, so the small gear always spins faster than the big one it drives. That is the whole trade a gear ratio makes: speed for size, in both directions at once. Nothing else is happening.

Every mesh flips direction

Watch gear A and gear B spin opposite ways. That is not a special property of this particular pair, it is true of every external gear mesh there is: the driven gear always turns opposite to its driver. Turn off the second stage and the output is gear B, spinning backward from the input. Turn the second stage back on and the output is gear D, spinning the same way as the input again, because the second mesh flips it right back. A third stage would flip it again. Direction is not something to solve for separately; it falls straight out of how many meshes the power passes through.

The shaft in the middle

Gear B and gear C never touch. They do not need to: they are fixed to the same shaft, so they always turn together, at the same speed and the same direction, whatever that happens to be. That shared shaft is what makes a compound gear train genuinely two ratios instead of one large one. Gear A sets how fast the B-C shaft turns, and that shaft’s speed, not the input’s, is what gear C hands off to gear D.

Losses compound, they do not add

Every real mesh loses a little power to friction between the teeth. Set that loss at 4% per mesh and the instinct is to expect a two-stage gearbox to lose about 8%. It actually keeps 0.96292.2%0.96^2 \approx 92.2\% of the power, a 7.8% loss, close enough here that the difference barely matters. Push the same idea to four stages and the gap between “add the losses” and “multiply what survives” stops being a rounding error:

ηoverall=ηmeshn\eta_{overall} = \eta_{mesh}^{\,n}

Four stages at a respectable 96% each keep only 0.96485%0.96^4 \approx 85\% of the power, not the 84% naive subtraction suggests, and nowhere near the 96% a single-stage intuition would guess. Every extra reduction stage added to hit a speed target is also a small tax on the torque actually delivered at the end of the line.

The code

The train’s ratio, direction and efficiency, in C++, the same arithmetic the animation above runs on every frame:

struct Stage {
    int driver;  // driver tooth count
    int driven;  // driven tooth count
};

// Reduction ratio of one mesh: driven teeth per driver tooth. Greater than
// 1 means the output turns slower and harder than the input.
double stageRatio(const Stage& stage) {
    return static_cast<double>(stage.driven) / stage.driver;
}

// Stage ratios multiply down a compound train.
double overallRatio(const std::vector<Stage>& stages) {
    double ratio = 1.0;
    for (const auto& stage : stages) ratio *= stageRatio(stage);
    return ratio;
}

// Every external mesh reverses rotation sense, so the last gear turns with
// the input after an even number of stages and against it after an odd one.
int directionSign(int stageCount) {
    return stageCount % 2 == 0 ? 1 : -1;
}

// Losses compound multiplicatively, not additively: three stages at 96%
// each hand on 0.96^3, about 88.5%, not the 88% that subtracting 3 lots of
// 4% would suggest.
double overallEfficiency(int stageCount, double perMeshEfficiency) {
    return std::pow(perMeshEfficiency, stageCount);
}

struct Output {
    double rpm;
    double torque;
};

// The ratio is purely kinematic and does not depend on efficiency; a lossy
// gearbox still turns the output shaft at the speed the tooth counts
// predict, just with less torque to show for it.
Output outputAtSpeedAndTorque(const std::vector<Stage>& stages, double inputRpm,
                               double inputTorque, double perMeshEfficiency) {
    const double ratio = overallRatio(stages);
    const int stageCount = static_cast<int>(stages.size());
    const double direction = directionSign(stageCount);
    const double efficiency = overallEfficiency(stageCount, perMeshEfficiency);

    return {
        (direction * inputRpm) / ratio,
        inputTorque * ratio * efficiency,
    };
}