How a petrol engine turns fire into motion, one stroke at a time. A crankshaft drives the piston through the four strokes of the Otto cycle — intake draws in the fuel-air mix, compression squeezes it, the spark fires and the power stroke is forced down, then exhaust pushes the burnt gas out — two full turns of the crank for one power cycle. Flip the switch from one cylinder to an inline-four and watch four cylinders share one crankshaft, firing 1-3-4-2 so a power stroke lands every 180° — that is why more cylinders run smoother. Beside the animation, the same cycle traces its loop on a pressure-volume diagram, and the thermal efficiency η = 1 − 1/r^(γ−1) climbs as you raise the compression ratio. It all runs on your device.
You are in the Physics lab.
What the pistons, the colours and the firing order are telling you.
Start with a single cylinder. Follow the piston through one full cycle — two turns of the crank, 720°. The label names the stroke and the colour of the gas changes with it: intake is blue as the piston drops and the left valve opens, compression squeezes the charge with both valves shut, power flashes orange as the spark fires at the top and the gas is forced down, and exhaust pushes the burnt gas out through the right valve. Only the power stroke does work; the other three set it up.
Switch to the inline-four. The four cylinders share one crankshaft but are staggered by 180° of crank, so at any instant they are all on different strokes — read the four colours across the row. They fire in the order 1-3-4-2: cylinder 1, then 3, then 4, then 2, each 180° after the last. Look at the crank throws below: pistons 1 and 4 rise and fall together and 2 and 3 together, but each pair is always in opposite strokes — when 1 is on power, 4 is on intake — which is what balances the engine.
A single cylinder fires just once every 720° — one push, then three strokes of coasting on the flywheel, so it lurches. In the inline-four a new power stroke begins every 180°, four times per cycle, and they overlap end to end. The Power pulse readout shows which cylinder is firing right now; watch it hand off 1 → 3 → 4 → 2 so the crank is never without a push. That continuous torque is why engines with more cylinders feel smoother.
A crank turns the piston's push into rotation, four strokes feed one power stroke, and the Otto cycle ties it to thermodynamics.
Intake: the piston drops with the intake valve open, pulling in fuel and air. Compression: both valves shut and the piston rises, squeezing the mixture. Power: the spark ignites it and the hot, high-pressure gas slams the piston down. Exhaust: the exhaust valve opens and the rising piston pushes the burnt gas out. Then it repeats — one cycle every two crank turns.
The piston only moves up and down, but a connecting rod links it to an offset pin on the crankshaft, converting that straight-line push into rotation — the crank-slider drawn here. A single cylinder delivers just one power stroke per 720°, so the flywheel has to carry it through the gaps. An inline-four puts four cylinders on one crankshaft, offset by 180° and firing 1-3-4-2, so a power stroke overlaps every 180° and the torque never drops out — more cylinders, smoother running.
Idealised, each cylinder follows the Otto cycle on the PV diagram: adiabatic compression, constant-volume combustion, adiabatic expansion, constant-volume exhaust. Its area is the net work, and its efficiency is η = 1 − 1/r^(γ−1) with γ ≈ 1.4 for air — higher compression ratios burn the fuel more effectively, which is why raising the ratio here lifts the efficiency, up to the point where the fuel would knock.
Teaching or blogging about engines or thermodynamics? You can embed this simulator on your own site free — one line of code, no sign-up.