His family had a long-standing professional interest in machinery and engineering, and even before moving to Ayrshire, the Reverend Stirling had been working on ideas for a new type of engine. He was also aware of the dangers posed by steam-driven machinery and the frequent explosions that occured during their use in coal-mines and factories. He wanted to create a safer alternative.
His engine was unique because it was driven by the heating and cooling of gas (most commonly just air). As the gas is heated it expands, and is then cooled and contracts. This expansion and contraction drives the engine. Crucially, the gas can be heated by anything from solar power to any type of fuel, and the heating takes place from outside the engine - this is a significant difference to the internal combustion engines we are so familiar with today. Its other characteristics are that it is extremely energy efficient with very low to zero by-products. Stirling patented his so-called 'Heat-Economiser' in 1816/17, but the technology never fully reached its potential and was all but forgotten. The term 'Stirling Engines' which includes all engines of this type, was coined around a hundred years later. Intriguingly, these engines were being developed by Stirling at a similar time to the other fossil-fuel powered, high-polluting engines like the steam engine. Perhaps the world would have been a very different place if Robert Stirling's patent had been the front running technology.