Clockwork. Clockwork refers to the inner workings of either mechanical devices called clocks and watches (where it is also called the movement) or other mechanisms that work similarly, using a series of gears driven by a spring or weight.

A clockwork mechanism is often powered by a clockwork motor consisting of a mainspring, a spiral torsion spring of metal ribbon.  Energy is stored in the mainspring manually by winding it up, turning a key attached to a ratchet which twists the mainspring tighter.  Then the force of the mainspring turns the clockwork gears, until the stored energy is used up.  The adjectives wind-up and spring-powered refer to mainspring-powered clockwork devices, which include clocks and watches, kitchen timers, music boxes, and wind-up toys.

History
The earliest known example of a clockwork set-up is the Antikythera mechanism. This device functioned as a geared analogue computer after its creation during the first-century BCE timeframe, being somewhat astrolabe-like, and had been designed for calculating astronomical positions and particularly listing eclipses. Recovered from a Greek shipwreck a long while after its creation, its nature was a mystery after its initial rediscovery due to various points of damage. There are many other accounts of clockwork devices in Ancient Greece, even in its mythology, and said mechanism itself is sophisticated enough to indicate a significant history of lesser devices leading up to its creation.

At some point, this level of sophistication in clockwork technology was lost or forgotten in Europe, and only returned when brought from the Islamic world after the Crusades, along with other knowledge leading to the Renaissance. Clockwork finally recovered the equivalent of pre-Roman technological levels in the 14th century.

As in Greek mythology, there are ambitious automation claims in the legends of other cultures. For example, in Jewish legend, Solomon used his wisdom to design a throne with mechanical animals which hailed him as king when he ascended it; upon sitting down an eagle would place a crown upon his head, and a dove would bring him a Torah scroll. It's also said that when King Solomon stepped upon the throne, a mechanism was set in motion. As soon as he stepped upon the first step, a golden ox and a golden lion each stretched out one foot to support him and help him rise to the next step. On each side, the animals helped the King up until he was comfortably seated upon his throne.

In ancient China, a curious account of automation is found in the Lie Zi text, written in the 3rd century BC. Within it, there is a description of a much earlier encounter between King Mu of Zhou (1023-957 BC) and a mechanical engineer known as Yan Shi, an 'artificer'. The latter proudly presented the king with a life-size, human-shaped figure of his mechanical handiwork (Wade-Giles spelling):

The king stared at the figure in astonishment. It walked with rapid strides, moving its head up and down, so that anyone would have taken it for a live human being. The artificer touched its chin, and it began singing, perfectly in tune. He touched its hand, and it began posturing, keeping perfect time...As the performance was drawing to an end, the robot winked its eye and made advances to the ladies in attendance, whereupon the king became incensed and would have had Yen Shih [Yan Shi] executed on the spot had not the latter, in mortal fear, instantly taken the robot to pieces to let him see what it really was. And, indeed, it turned out to be only a construction of leather, wood, glue and lacquer, variously coloured white, black, red and blue. Examining it closely, the king found all the internal organs complete—liver, gall, heart, lungs, spleen, kidneys, stomach and intestines; and over these again, muscles, bones and limbs with their joints, skin, teeth and hair, all of them artificial...The king tried the effect of taking away the heart, and found that the mouth could no longer speak; he took away the liver and the eyes could no longer see; he took away the kidneys and the legs lost their power of locomotion. The king was delighted.

Other notable examples include Archytas's dove, mentioned by Aulus Gellius. Similar Chinese accounts of flying automata are written of the 5th century BC Mohist philosopher Mozi and his contemporary Lu Ban, who made artificial wooden birds (ma yuan) that could successfully fly, according to the Han Fei Zi and other texts.

By the 11th century, clockwork was used for both timepieces and to track astronomical events, in Europe. The clocks did not keep time very accurately by modern standards, but the astronomical devices were carefully used to predict the positions of planets and other movement. The same timeline seems to apply in Europe, where mechanical escapements were used in clocks by that time.

Up to the 15th century, clockwork was driven by water, weights, or other roundabout, relatively primitive means, but in 1430 a clock was presented to Philip the Good, Duke of Burgundy, that was driven by a spring. This became a standard technology along with weight-driven movements. In the mid-16th century, Christiaan Huygens took an idea from Galileo Galilei and developed it into the first modern pendulum mechanism. However, whereas the spring or the weight provided the motive power, the pendulum merely controlled the rate of release of that power via some escape mechanism (an escapement) at a regulated rate.

The Smithsonian Institution has in its collection a clockwork monk, about  high, possibly dating as early as 1560. The monk is driven by a key-wound spring and walks the path of a square, striking his chest with his right arm, while raising and lowering a small wooden cross and rosary in his left hand, turning and nodding his head, rolling his eyes, and mouthing silent obsequies. From time to time, he brings the cross to his lips and kisses it. It is believed that the monk was manufactured by Juanelo Turriano, mechanician to the Holy Roman Emperor Charles V.

Overview

The stored amounts of energy used by a given piece during its operation is often housed within it; this frequently happens via a winding device that applies mechanical stress to an energy-storage mechanism such as a mainspring, thus involving some form of escapement. In other cases, hand power may be utilized. The use of wheels, whether linked by friction or by gear teeth, to redirect motion, gain speed, or involve torque, is typical; many clockwork mechanisms have been constructed primarily to serve as visible or implicit tours de force of mechanical ingenuity in this area. Sometimes, clocks and timing mechanisms are used to set off alarm noises or trigger explosives as well as to otherwise activate some other entity.

Examples
The most common examples are mechanical clocks and watches. Other uses, most but not all obsolete, include:
 Wind-up toys – often as a simple mechanical motor, or to create automata. These may be either key-wound, as were many 20th-century model trains, or a simpler pullback motor.
 Most photographic camera leaf shutters use a clockwork mechanism not unlike that of wristwatches to time the opening and closing of the shutter blades.
 Mechanisms to turn the lens of lighthouses before electric motors.
 Mechanical calculators, used before small electronic calculators became available in the 1970s. Relatively small calculators were used, for example, for companies' financial calculations. 
 Mechanical computers, much more complex and larger than mechanical calculators, such as Babbage's difference and analytical engines.
 Astronomical models, such as orreries whose history spans hundreds of years.
 Music boxes, which were very popular during the 19th century and at the beginning of the 20th.
 Almost all musical record-playing phonographs (gramophones) built before the 1930s.
 Hand-powered electrical equipment, such as a clockwork radio, where an energy-storing spring accounting for much of the size and weight of the device rotates a much smaller electric generator; such equipment is very popular where batteries and mains power (house current) are scarce.

See also

Clock of the Long Now
Clockwork philosophy
Clockwork universe
Friedrich von Knauss
Jens Olsen's World Clock
Mainspring
Movement (clockwork)
Windup radio

References

Timekeeping components