← Projects
raspberry-pi intermediate 7 days ago ◑ 13 views ◯ 6 min read

Build a Raspberry Pi Aquarium Controller: Dosing Pumps, Temperature Monitoring, and Automated Lighting Schedules

Build time: 6-8 hours
Tools needed: soldering iron, wire strippers, screwdriver set, multimeter, drill (for enclosure mounting)
aquarium controllerraspberry pidosing pumpDS18B20WS2812Breef tankautomationtemperature monitoring
Parts List

Commercial aquarium controllers (Neptune Apex, GHL ProfiLux, and similar) do exactly what this project does — monitor temperature, dose additives on a schedule, and run lighting — but they cost several hundred dollars and lock you into their own app and expansion module ecosystem. A Raspberry Pi with a handful of relay-driven peristaltic dosing pumps, waterproof temperature probes, and an addressable LED lighting rig gets you the same core functionality, fully open, loggable to your own database, and extensible to anything else you want to automate around the tank later (a water level sensor, a leak detector, an auto-top-off system). This build covers dosing pump control with safe failure behavior, multi-point temperature monitoring, and programmable lighting schedules including sunrise/sunset ramping — the feature that separates "lights on a timer" from lighting that doesn't shock fish and corals with an instant transition.

System Overview

The Pi runs a small Python control service that manages three independent subsystems: scheduled dosing pump activation through relay outputs, continuous temperature logging from one or more waterproof DS18B20 probes, and PWM-driven LED lighting with programmable ramp curves. All three log to a local database so you have a history to review if something in the tank's chemistry or temperature drifts — which is often the first sign of a problem well before it's visible by eye.

Difficulty, Time, and Tools

This is an intermediate build — nothing here is electrically dangerous at Pi logic-level voltages, but dosing pump plumbing and probe placement both benefit from care, and a mistake in the dosing logic has real consequences for the animals in the tank.

Dosing Pumps: Safe Failure Behavior Matters More Than Precision

Wire each peristaltic pump through its own relay channel, and run every pump off its own independently timed, short activation window rather than a simple on/off schedule — a dosing pump stuck "on" due to a relay failure or a software bug can dump an entire bottle of supplement into a tank in minutes, which is a far worse outcome than a missed dose. Build the control logic so dosing happens in short, metered pulses (for example, several 1-2 second pump activations spaced apart rather than one long continuous run) and so the software enforces a hard maximum daily volume per pump independent of the schedule — if something causes the scheduler to fire more often than intended, the volume cap is what actually protects the tank. Add a check valve in each dosing line close to the pump outlet to prevent siphoning (gravity or capillary action slowly draining a supplement bottle into the tank between scheduled doses, which is a surprisingly common failure mode with peristaltic pumps that aren't fully self-priming when stopped).

Temperature Monitoring

Wire DS18B20 probes on the 1-Wire bus (GPIO pin plus the 4.7k pull-up resistor) and place at least two probes at different points in the tank or sump if your setup allows it — a single point reading can miss localized heating near a heater element or cooling near a chiller return, and a meaningful temperature discrepancy between two probes is itself a useful early-warning signal of a circulation problem. Log continuously rather than polling only when checked manually, and set alert thresholds (both high and low) that trigger a notification — a push notification service, an email, or even just a loud local alert — well before the temperature reaches a range that's actually dangerous for the livestock, giving you time to intervene.

Lighting: Ramping, Not Switching

Drive the LED strip with PWM through the Pi (via a library like rpi_ws281x) rather than a simple relay on/off — instant full-brightness lighting is more stressful to fish and corals than a gradual ramp, and a sunrise/sunset curve (slowly increasing brightness and optionally color temperature over 20-30 minutes at the start and end of the lighting period, rather than a hard cut) is both better for the tank's inhabitants and more visually pleasant. Program the ramp as a simple lookup table of brightness values against time-of-day rather than trying to calculate it live — it's easier to tune by eye and easier to debug than a real-time formula.

Power Reliability

A tank depends on continuous operation in a way most Pi projects don't — a Pi that crashes or loses power mid-dosing-cycle, or that simply stops logging temperature during a heater failure, turns a monitoring system into a false sense of security. Add a small UPS HAT so brief power blips don't reboot the Pi mid-cycle, and build the control software to resume safely rather than re-running a missed dosing cycle immediately on restart — if the Pi was down for an hour and missed one dose window, the safe behavior is usually to skip that window and resume on the next scheduled one, not to catch up by dosing extra.

Safety and Tank Welfare

Once running, this setup gives you the dosing consistency and lighting realism of a commercial reef or planted-tank controller, with a full history of every temperature reading and every dose logged locally — and the flexibility to add a leak sensor, auto-top-off, or a webcam feed into the same Pi whenever the next "it would be nice if the tank also did this" idea comes along.