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:
- Temperature: a DS18B20 water probe on pin 7.
- Heat: a solid-state relay (the DC SSR-25DD) on pin 5, switching a lamp standing in for the heater from its own battery pack.
- Light: a 16 LED WS2812 bar on pin 6.
- Time: a DS3231 clock.
- Water level: a level sensor on A0, powered from pin 4, and a relay on pin 8 running a top-off pump.
- Feeding: a servo feeder on pin 9 and a FEED button on pin 2.
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:
- Temperature: the DS18B20 and the tropical band.
- Heater control: a thermostat and its safeties.
- Lighting cycles: sunrise to moonlight.
- Water level: auto top-off with limits.
- Feeding: a scheduled feeder with a guard.
- Project: a reef night and day: the whole tank.
Every step but the last is checked against the running circuit.