Hero (device 27)
An illustration of Hero's device 27, which employs two piston and cylinders as a sort of mechanical pump designed to eject water from spout M' for the purpose of putting out fires. [2]
In engineering, piston and cylinder is a mechanical device for either creating a vacuum or containing a volume of fluid capable of expansion or contraction through the action of heat, comprised of a "cylinder" shape, closed at one end, and an adjustable "piston", fitted air-tight to the shape of the cylinder, but adjustable.

Overview
In c.230BC, Ctesibius is said to have invented the piston and cylinder:

“It is said that Ctesibius invented the piston and cylinder before 200BC.”
— Richard Kirby (1956), History of Engineering (pg. 154)

In c.55AD, Hero, in his Pneumatics, a summary of device inventions made by Ctesibius and others before him, detailed his so-called “device 27”, characterized as a “fire engine”, as follows: [2]

“The siphons used in conflagrations are made as follows. Take two vessels of bronze, ABCD, EFGH (see: figure), having the inner surface bored in a lathe to fit a piston, like the barrels of water-organs, KL, MN being the pistons fitted to the boxes. Let the cylinders communicate with each other by means of the tube XODF, and be provided with valves, P, R, such as have been explained above, within the tube XODF and opening outwards from the cylinders. In the bases of the cylinders pierce circular apertures, S, T, covered with polished hemispherical cups, VQ, WY, through which insert spindles soldered to, or in some way connected with, the bases of the cylinders, and provided with shoulders at the extremities that the cups may not be forced off the spindles. To the centre of the pistons fasten the vertical rods SE, SE, and attach to these the beam A' A', working, at its centre, about the stationary pin D, and about the pins B, C, at the rods SE, SE. Let the vertical tube S' E' communicate with the tube XODF, branching into two arms at S', and provided with small pipes through which to force up water, such as were explained above in the description of the machine for producing a water-jet by means of the compressed air. Now, if the cylinders, provided with these additions, be plunged into a vessel containing water, IJUZ, and the beam A' A' be made to work at its extremities A', A', which move alternately about the pin D, the pistons, as they descend, will drive out the water through the tube E’ S’ and the revolving mouth M'.

For when the piston MN ascends it opens the aperture T, as the cup WY rises, and shuts the valve R; but when it descends it shuts T and opens R, through which the water is driven and forced upwards. The action of the other piston, K L, is the same. Now the small pipe M’, which waves backward and forward, ejects the water to the required height but not in the required direction, unless the whole machine be turned round; which on urgent occasions is a tedious and difficult process. In order, therefore, that the water may be ejected to the spot required, let the tube E' S' consist of two tubes, fitting closely together lengthwise, of which one must be attached to the tube XODF, and the other to the part from which the arms branch off at S'; and thus, if the upper tube be turned round, by the inclination of the mouthpiece M' the stream of water can be forced to any spot we please. The upper joint of the double tube must be secured to the lower, to prevent its being forced from the machine by the violence of the water. This may be effected by holdfasts in the shape of the letter L, soldered to the upper tube, and sliding on a ring which encircles the lower.”

In 1632, Galileo, in his Two New Sciences, presented his illustration and explanation for his vacuum measuring device (see: Galileo vacuum device) for measuring the force of the vacuum.

Piston and cylinder
A timeline snippet of German engineer Otto Guericke's c.1650 attempt to make a vacuum in a beer keg using a suction pump device (left) to his later use of a piston and cylinder apparatus to which he attached a vacuum bulb, and thereby was able to make the piston go down, to the great powerful effect of being able to lift several thousand pound of weight (see: Schott diagrams).
Guericke
In c.1650, Otto Guericke, after reading Galileo's
Two New Sciences, began to employ a piston and cylinder like suction device for the purpose of drawing, at first liquid, namely liquid out of a beer keg, then air, namely air out of the Magdeburg hemispheres, in aims to prove the existence of vacuums in nature. [1]

To visually show the effect of a vacuum, in efforts to disprove Greek philosopher Aristotle's c.350BC supposition that "nature abhors a vacuum", Guericke designed a piston and cylinder, as labeled adjacent, and conducted various demonstrations to demonstrate its power of the weight of the atmosphere. The air cylinder a was about twenty-inches high and fifteen-inches wide, having its sides perfectly even and parallel, which could be fixed firmly in a vertical position by the ring s. The piston, p, q, r, was made to fit exactly inside of the cylinder, p being of iron and q wood, and the rounded head r, formed of hard oak, had a grove on its edge which was filled with flax or hemp.

To demonstrate the power or strength of the vacuum, the piston was let into the cylinder, and its iron handle was passed through the ring of the arm o, shown below, in such a manner that it could move freely up and down through the whole height of the cylinder and at the same time be preserved in a straight line. In a first experiment, the piston was positioned at the bottom of the cylinder the stop-cοck x was closed. In this arrangement, the joint efforts of twenty or more men could not raise the piston more than halfway up. The men, in effect, were not just pulling on the piston, but the weight of a column of atmosphere 62-miles high. [1]

Thermodynamics
The piston and cylinder, together with the vacuum pump, also invented by Guericke, led to the formulation of the various gas laws, beginning with the work of Robert Boyle and Robert Hooke, as formulated in Boyle's law (1662), culminating later in the ideal gas law (1834), the design of the first steam engine by French engineer Denis Papin (1690), the first working steam engine by English engineer Thomas Savery (1698), and the initiation of thermodynamics as a subject, in 1824, by French engineer Sadi Carnot, in his Reflections on the Motive Power of Fire, a treatise on heat engines in general.

See also
Engine development timeline
Schott diagrams
Timeline of thermodynamics

References
1. (a) Wilson, George. (1849). “On the Early History of the Air-Pump in England”, The Edinburgh New Philosophical Journal, (pgs. 330-54).
(b) Galloway, Robert L. (1881). The Steam Engine and its Inventors. London: MacMillan and Co.
2.
Hero. (c.55AD). Pneumatics (translator: Bennet Woodcroft). Taylor, 1851.

TDics icon ns