Book of Knowledge · Category I, Chapter 1 · 1206
The castle water-clock: twelve hours by day, twelve by night
In this clock an hour is not always sixty minutes. On a midsummer day each hour of daylight lasts about 72 minutes and each hour of the night about 48, yet doors open, falcons drop balls on cymbals and musicians play exactly on the hour, all from one tank of water draining at just the right speed. Cut it open in 3D and see how.
What it looks like
This is the very first machine in al-Jazarī's book, and his translator Donald Hill calls it “probably the most complex of his designs”. The outside is a house about twice the height of a man, some 12 spans square (Hill: about 10 feet square and 11½ feet high). In its doorway stands a screen about 5½ spans wide and 9 spans high. Across the top run twelve double doors; below them, twelve single doors all of one colour. A golden crescent travels along a ledge under the doors. Below are two niches with brass falcons, each with a vase and a cymbal, twelve glass roundels in a semicircle, and five figures: two drummers, a cymbalist and two trumpeters. Above it all, half of a turning Zodiac disc 5 spans across shows six signs, with the sun and the moon on it.

The problem: unequal hours
In al-Jazarī's time the day had twelve hours and the night had twelve, whatever the season. He designed for the “fourth region” of latitude, where the longest day lasts 14 hours 30 minutes, so on that day each daylight hour is about 72½ minutes long and each night hour about 47½. Yet one tank must drain completely in the 14½ hours of daylight, and again in the 9½ hours of that night.
The float chamber: a steady head
- The reservoir: a copper tank seven spans tall holding 145 kayl of water (Hill: about 4 cubic feet, roughly 113 litres), with a float on the surface.
- The tap near its base feeds a small float chamber.
- As the level rises, a float pushes a cone-shaped plug into the tap and shuts it; as water leaves, the plug drops and the tap opens.
- So the level in the chamber hardly moves: a steady head of water held by feedback, the same idea as the float valve in a cistern. Hill calls it a closed loop.

The flow regulator
From the chamber the water goes to the regulator, a brass disc 1½ spans across that turns inside a fixed ring marked with the twelve signs of the Zodiac. The outlet is drilled through a piece of onyx about 4½ fingers from the centre. Turn the disc and the hole rises or falls: a higher hole has less head of water above it and flows more slowly. Each day the pointer is set to the sun's degree in the Zodiac; at night it goes to the opposite degree.

Float, wheel and cart
As the reservoir drains, its float sinks five and a half spans. A string from the float runs over a pulley in the roof to a wooden wheel 3½ spans across, which therefore makes half a turn. On the same axle a second wheel pulls a cart along a shelf behind the screen, also 5½ spans. The cart carries the golden crescent along the ledge outside: Hill notes that (3.5/2) × 3 1/7 is almost exactly 5½.

Every hour: doors and falcons
Each time the crescent passes a door, a rod on the cart knocks a peg off its hook. A figure drops into the upper doorway, opening its two leaves; the plate on its back knocks a weight that lets the lower door turn over and show a different colour. A string from the figure lifts an iron blade, and two bronze balls of 40 dirhams roll through channels into the heads of the two falcons. Heavier now, each falcon leans forward on its balance rod, raises its wings and drops its ball onto a cymbal, “and the sound is heard from afar”.

The musicians
The water from the outlet falls on a dished plate whose pipe fills one part of a three-part trough in three hours. At the sixth, ninth and twelfth hours a weight falls from a figure's back and lifts a valve: the water pours onto a wheel with scoops, and pegs on its axle beat the drummers' and cymbalist's arms. The water then fills a sealed vessel and drives the air out through a flute, “believed to come from the two trumpeters”, before a siphon empties it.

At night
A lamp burns inside the house. The big wooden wheel is half solid and half an inner disc completed by an iron ring, so as it turns it uncovers the twelve glass roundels one by one. Each roundel shows “a light like a barleycorn” that grows until it is full: one hour of the night. Above, the Zodiac turns, carrying the sun, and the moon in its phase.

Quick test: higher or lower?
On midsummer night the tank must empty in 9½ hours, not 14½. Should the outlet hole go higher, or lower?
Show the answer
Lower. More head, faster flow. On the longest day the pointer sits at the first point of Cancer, with the hole at the very top; that night it turns to Capricorn, at the bottom.
No formula: he tested
Al-Jazarī did not work out the divisions with a formula. He built a design he credits to Archimedes (a semicircle with twelve equal signs) and found it “did not work correctly except for one day”, the first day of Cancer. Two other designs failed too. So he calibrated by experiment: he widened the onyx hole with copper wire and emery, measured the water hour by hour, and engraved each sign where the flow came out right. Hill explains why the old designs failed: the flow follows the square root of the head, not the head itself, and day length does not follow the simple pattern they assumed. His calculation puts Gemini at about 20°, Taurus at 26°, Aries at 26° on the dial.
Myth-check: the first programmable computer?
You may read that the castle clock was “the earliest programmable analog computer”. But its program was a servant. At sunrise and sunset he poured the water back into the reservoir, moved the regulator's pointer, rehung the figures, reloaded the balls and reset the sun and moon by hand. Al-Jazarī even writes that the servant “makes haste”. What is real, and remarkable, is the engineering: a float that holds the level steady on its own, and a regulator tuned by experiment for every day of the year.
Watch the film
0:00An hour is not always sixty minutes0:25Title0:36The first machine in the book1:00The problem: unequal hours1:17The reservoir1:24The float chamber: feedback1:40The flow regulator1:56Float, wheel and cart2:13Every hour: the doors2:24The falcons2:33The musicians and the flute2:51Night: twelve roundels2:59Quick test3:28No formula: he tested3:56Myth-check: the first programmable computer?4:20Which machine next?4:25Outro
Questions & answers
What is al-Jazari's castle water-clock?
It is the first machine in al-Jazari's Book of Knowledge of Ingenious Mechanical Devices (1206), Category I, Chapter 1: a house about two men tall with a screen of doors, a moving golden crescent, two falcons that drop balls onto cymbals, twelve glass roundels that light up at night, five musician figures and a turning Zodiac, all driven by water.
Why did it need to change speed every day?
In al-Jazari's time the day was divided into twelve hours and the night into twelve, whatever the season. At his latitude (about 36°) midsummer daylight lasts 14½ hours, so each daytime hour was about 72½ minutes and each night hour about 47½. The same tank of water therefore had to empty in 14½ hours by day and 9½ hours by night.
How does the flow regulator work?
A float chamber keeps the water level steady: as it rises, a float pushes a conical plug into the tap from the reservoir and shuts it. The water leaves through a hole drilled in onyx near the rim of a brass disc. Turning the disc raises or lowers the hole: a higher hole means less head of water and a slower flow. Each day the pointer is set to the sun's degree in the Zodiac, and at night to the opposite degree.
How did the clock open a door every hour?
As the reservoir drains, its float sinks 5½ spans and turns a wooden wheel half a turn through a string over a pulley. A second string pulls a cart 5½ spans along a shelf behind the screen; the cart carries the crescent outside and a rod inside that knocks a figure's peg off its hook every hour. The falling figure opens the upper doors, flips the lower door and releases two balls for the falcons.
Was it really the first programmable computer?
No. That label appears in popular histories and websites, but the clock held no program: every sunrise and sunset a servant poured the water back, moved the regulator's pointer, rehung the figures, reloaded the balls and reset the spheres by hand, as al-Jazari describes in Section 10. What is remarkable is the engineering: a self-regulating float valve and a regulator calibrated by experiment for every day of the year.
Is the 3D model exact?
No. It is a reconstruction from al-Jazari's text and Donald Hill's notes. Many sizes come from the text (12 spans square, a screen 5½ by 9 spans, a 7-span reservoir, 3½-span wheels, a 5-span Zodiac), but the setting, colours, some positions and the speed of the action are illustrative.
Sources
- Ibn al-Razzāz al-Jazarī, Kitāb fī maʿrifat al-ḥiyal al-handasiyya (The Book of Knowledge of Ingenious Mechanical Devices), 1206, Category I, Chapter 1. English translation and notes: Donald R. Hill, 1974, pp. 17–41 and 241–245.
- On the “programmable computer” label: History of Information. Background: “Al-Jazari's Castle Water Clock” (Muslim Heritage); Ismail al-Jazari.
- The 3D model is a reconstruction from al-Jazarī's text and Hill's notes; the setting, several positions, the colours and the speed of the action are illustrative.
Your turn
Which machine should we rebuild next?
The peacock basin, the musical boat, the wine-servers? Tell us on YouTube.