Lessons and the learning game

Build an aquarium controller

A reef tank controller on an Uno: water temperature, a safe heater, a sunrise-to-moonlight day, auto top-off and a feeder that cannot overfeed.

Safety first

Real aquarium heaters are mains appliances in water. Use listed heaters with their own thermostat, give every cable a drip loop, and never put a hand in the tank with anything plugged in. This course simulates only the low-voltage side: the heater is a 6 V lamp behind a solid-state relay.

The controller

Every lesson opens on the same wiring:

The catalog lists this course on an ESP32-C3. It is built on the Uno.

How it works

Temperature. Most tropical fish want 24 to 27 C. The DS18B20 reads in sixteenths of a degree.

The heater. On under 25.0 C, off over 25.5 C. Over 28 C it latches off; a probe reading -127 (lost) or 85 (not yet converted) is no heat; and 30 seconds of heat without 0.2 C of warming latches it off too.

Light. A 30 minute sunrise from 08:00, the day in white with blue, a 30 minute sunset from 19:30, three hours of dim blue moonlight, then darkness, all worked out from the clock every pass.

Top-off. Under 20 mm the pump runs until 30 mm, for 15 seconds at most; over 38 mm is high water. The sensor is powered only while it is read, so its copper does not corrode, and its curved response is turned back into millimeters in the sketch.

Feeding. Half a turn of the servo is a portion, at 08:30 and 18:30 or on FEED, never more than twice a day.

The course

Build an aquarium controller gets there in six lessons, each a sketch on the same wiring:

  1. Temperature: the DS18B20 and the tropical band.
  2. Heater control: a thermostat and its safeties.
  3. Lighting cycles: sunrise to moonlight.
  4. Water level: auto top-off with limits.
  5. Feeding: a scheduled feeder with a guard.
  6. Project: a reef night and day: the whole tank.

Every step but the last is checked against the running circuit.