The history of the combustion engine
From humble beginnings to the engines we know today
First a trick question: which came first - the steam engine or the internal combustion (IC) engine? Don't worry if you thought 'steam' because it's the most common answer. The reality is obviously not quite so straightforward or I wouldn't be using up your bandwidth to explain it to you.
The first use of steam to propel something was Hero's 1st century (60AD) Aeophile Steam Turbine but it was more of a toy than an actual engine. Essentially a sphere full of water with a couple of nozzles in it, users would light a fire under it and as the water boiled, steam came out of the nozzles and made it spin. It was fun to watch, and today's health-and-safety execs would have marvelled at the dangerousness of it, but at its root, it was a toy and nothing more.
So internal combustion (IC) engines vs. steam - dates please. Well work started on IC engines around the turn of the 16th century, finishing late in the 17th century which was when steam power was starting to show a lot of promise. So much so in fact that IC was just abandoned. Abandoned I tell you! The fools. Well, in fairness, once you see how they worked, it's easy to understand why. At the time, the only half-decent fuel was gunpowder and it wasn't so much the explosion that caused the piston motion as the resulting vacuum from it. The idea was simple. Stuff a piston in the top of a tube, explode gunpowder at the bottom of it to suck up all the oxygen, and the resulting vacuum would cause a pressure imbalance on the piston so that atmospheric pressure would suck it down into the cylinder. Hence these engines were called atmospheric engines. The first attempt at making one of these was in 1673 by Christiaan Huygens. Nice idea but it only worked once and then you needed to refill the cylinder with gunpowder. So it had a single non-repeating cycle and the materials of the day weren't really up to the job of withstanding that sort of strain.
Newcomen Steam Engine
So as this mess was going on with gunpowder, Watt's steam engine and the Newcomen Steam engine were operating on the same principle but using steam instead. As the steam condensed to water, it contracted, creating the vacuum and once again, atmospheric pressure was used to push a piston into a cylinder. The advantage with using steam was that it could be created outside the cylinder and injected when necessary making this a repeatable process. So rather than the one-shot deal of Huygen's engine, these ones could run as long as there was a fresh supply of steam. For 150 years or more, this is how all engines were until piped gas supplies started to become commonplace.
Skipping merrily through the timeline to 1860, Belgian Jean Joseph Etienne Lenoir took out a patent on the first practical, working gas engine. He was the first person to succeed in making an IC engine that ran reliably and stably. Rather than the one-shot gunpowder idea, natural gas was injected into the cylinder and ignited by a travelling flame front to create the explosion which ate up all the oxygen. (the flame came from a permanent gas flame outside the cylinder that was sucked into it at the appropriate moment to ignite the gas). Again the resulting vacuum caused the piston to be sucked back into the cylinder creating the power stroke. Lenoir's engines ran up to 20hp in power and between 1860 and 1865 over 300 of these engines were built.
Otto and Langen
In 1864 Nicolaus August Otto and Eugen Langen founded a gas atmospheric engine factory called Deutz (which famously employed Wilhelm Maybach and Gottlieb Daimler). In Paris during the 1867 world exhibition, Otto and Langen began to demonstrate their success. Their engine ran 30% more efficiently than Lenoir's and sold about 5,000 units until 1877 making it the first mass-produced engine. The continous up-down motion of the piston was converted to rotary motion for the first time by the use of a rack and pinion and clutch. The rack was attached to the piston and as it travelled up and down, it spun the pinion gear on a one-way clutch resulting in every other stroke being a power stroke. A flywheel maintained momentum between power strokes and with the exhaust gasses being expelled by the downward motion of the piston, this was very close to the 4-stroke engine cycle we know today.
The Otto Cycle
Otto demonstrated the first true 4-stroke cycle in 1876 after giving up active management of Otto & Langen and going back to an 1861 design of his own. Rather than relying on the atmospheric imbalance to provide the power stroke, he instead turned the initial explosion into the power stroke and used the flywheel to help maintain momentum and return the piston down the cylinder. He replaced the rack and pinion with the connecting rod and crank to improve efficiency and remove slack from the mechanical transfer of the power from the piston to the flywheel. His design had four strokes to complete one entire cycle. The first stroke sucked gas into the cylinder. The second compressed it. A live flame front was introduced to detonate the gas resulting in the third (the power) stroke as the piston was expelled from the cylinder. The spinning flywheel forced the piston back into the cylinder in the fourth stroke, expelling the spent gasses and readying the mechanism for the cycle to begin again. Et voila, as the French would say, a four-stroke engine.
Otto patented his engine with patent number 365,701. Unfortunately, despite him being the first person to build a working four-stroke engine, Aphonse Beau de Rochas had already patented the idea (if not the design) in 1862 despite having never made such an engine himself. In 1886, Otto's patent was revoked. He did have other patents though and they were worded and enforced so well that many other designs were tried to get around the 4-stroke patent. Notably, the Atkinson engine was a 6-stroke engine with the extra 2 strokes being used to scavenge and clean the cylinder. Nevertheless, Otto's name stuck and that buzzing little beauty in your car today is the result.
Article researched at the Anson Engine Museum in Poynton, England. It's a bit out of the way but it's well worth a visit if you're into this sort of thing. Which I am. Obviously.