How do you find when to switch gears in a car?

I’m learning more about transmission so that I can implement a nice gearbox into my car. I understand mostly everything, like how to find the amount of torque, engine RPM, plot a torque curve, etc.

But, I’m still kinda confused on one thing.

How do I calculate to find out when to switch gears up and down?

Without doing something tedious like having to explicitly write each gear’s max speed? That would be a last resort, because there is definitely some calculation that does this already that I’m missing.


Well after some google searching I found how automatic cars shift gears

An automatic transmission uses sensors to determine when it should shift gears, and changes them using internal oil pressure

So I don’t really know how you would put this into code you might be able to do it but I can’t really think of a way a the moment
A good placeholder would be to just shift the gear up or down at a high or low Engine RPM(I believe that’s what most games do)

I know it’s supposed to be shifted up at a certain RPM aka when it gets close to redlining (is that the right terminology?), but I don’t know how to calculate that RPM for each gear (without having to explicitly set it). That’s what I’m trying to figure out

It really depends on how you want the car to drive. This is one of the things that changes when you switch a car’s drive mode. Since if you want the most fuel efficient car you would want to shift up a gear between 2,000 and 2,500 RPMs to keep the engine doing as little work as possible.

But say you are looking to accelerate as much speed as possible you would set those RPMs to be much higher before switching gears to get more power from the engine. Usually in this scenario you are shifting at very high RPMs (4000+) and possibly right as your engine reaches it’s highest safe operating RPM. (I think this is what redlining is referring too?) It makes sense to do this to get the best acceleration because the lowest gears on your car offer the best torque.

This would probably be the best way to make a predictable shifting system is you can save different driving “profiles” in a dictionary and saving a the target RPM to switch gears for each driving type if you are interested in adding that.


So the shift RPM is supposed to be the same (well if it works good enough) on each gear? I thought that it was different RPM shift points for each gear. If I can just use one number though and it works good enough, that’s fine, I don’t really need to calculate optimal shift point unless it’s easy to

Thanks for the info.

Yes, if you want you can keep track of how much the accelerator is being pushed, how fast the car is moving, RPMs, etc. to get a much more accurate time to shift but the majority of determining when to shift is usually the engine’s RPMs. If you want a really simple way to check when a car should need to shift it would be saving RPM values depending on the set drive mode of the car.

Also usually if someone wanted a vastly different shift times they could change the car’s drive mode to adapt to that driving style. Basically sports mode will set that threshold to be much higher to benefit from the higher torque in lower gears but the drawback is you are keeping your engine at a higher operating speed so it uses more fuel.

1 Like