Lessons and the learning game

Build a tide clock

A wall clock for the sea: the 12 h 25 min tide cycle, a servo hand, a DS3231 for time, and calibration to your port, honest about why it never navigates.

What it teaches

A gentle beginner build in six lessons:

  • The sea's clock: tides in one sentence (two bulges and a turning Earth), the 12 h 25 min 12 s average cycle and why tides come 50 minutes later each day, the rule of twelfths, and coasts with mixed or once-a-day tides.
  • Hand and clock: a servo hand mapped onto the cycle (0 degrees high, 90 low, 180 the next high), a reversed mounting fixed in code, and a DS3231 real-time clock with its temperature-compensated crystal and Unix time.
  • Your port: one high tide from a tide table, the drift of an average over a month, why it is never for navigation, and the finished wall clock.

Open it at /learn/path/build-tide-clock.

The circuit

Tide clock: a DS3231 on A4 and A5 and a servo hand on pin 9, running tideclock. Set the clock chip's start property to try any date and time, and type fast in the Serial Monitor to run an hour every second (now returns to the real time). HIGH_TIDE, PERIOD_S and HAND_REVERSED at the top of the sketch are the settings.

Never for navigation

The clock follows the average semidiurnal cycle. Real tides run up to an hour or so either side of it, some coasts have mixed or diurnal tides, and wind and air pressure move the sea too. Use the official tide tables for anything to do with safety: crossing a causeway, launching a boat, walking a beach.

Troubleshooting

  • The hand is off by tens of minutes: reset HIGH_TIDE from your port's table; do it every few weeks.
  • The hand turns the wrong way: set HAND_REVERSED to 1.
  • The time is wrong: set the DS3231's time once, from a computer, with rtc.adjust().