Since the Stirling engine is a closed cycle, it contains a fixed mass of gas called the "working fluid", most commonly air, hydrogen or helium. In normal operation, the engine is sealed and no gas enters or leaves the engine. No valves are required, unlike other types of piston engines. The Stirling engine, like most heat-engines, cycles through four main processes: cooling, compression, heating and expansion. This is accomplished by moving the gas back and forth between hot and cold heat exchangers. The hot heat exchanger is in thermal contact with an external heat source, e.g. a fuel burner, and the cold heat exchanger being in thermal contact with an external heat sink, e.g. air fins. A change in gas temperature will cause a corresponding change in gas pressure, while the motion of the piston causes the gas to be alternately expanded and compressed.
The gas follows the behavior described by the gas laws which describe how a gas's pressure, temperature and volume are related. When the gas is heated, because it is in a sealed chamber, the pressure rises and this then acts on the power piston to produce a power stroke. When the gas is cooled the pressure drops and this means that less work needs to be done by the piston to compress the gas on the return stroke, thus yielding a net power output.
When one side of the piston is open to the atmosphere, the operation is slightly different. As the sealed volume of working gas comes in contact with the hot side, it expands, doing work on both the piston and on the atmosphere. When the working gas contacts the cold side, the atmosphere does work on the gas and "compresses" it. Atmospheric pressure, which is greater than the cooled working gas, pushes on the piston.
To summarize, the Stirlingengine uses the temperature difference between its hot end and cold end to establish a cycle of a fixed mass of gas expanding and contracting within the engine, thus converting thermal energy into mechanical power. The greater the temperature difference between the hot and cold sources, the greater the potential Carnot cycle efficiency.
Small demonstration engines have been built which will run on a temperature difference of as little as 5 °C, e.g. between the palm of a hand and the surrounding air, or between room temperature and melting water.
For example see the Video Stirlingengine from our Low Temperature Stirling engine GT02.