We research and compare products using published specifications, features and owner feedback. When you buy through our links, we may earn a commission. As an Amazon Associate I earn from qualifying purchases. Learn more›

Arduino Auto Top Off: A Step-by-Step Build Guide for Reef Tanks

Learn how to build an Arduino auto top off system for your reef tank, from wiring and float switch to code, calibration and common fixes.

Updated November 2026

An Arduino auto top off (ATO) system uses a small microcontroller to keep your reef tank’s water level steady by adding fresh water when evaporation drops the level. In this guide you will learn the parts you need, how to wire a float switch and pump safely, how to load and calibrate the code, and how to test the system before you trust it overnight. A well-built Arduino ATO can replace a daily manual topping-off routine and help keep salinity stable.

How an Arduino Auto Top Off Works

The basic logic is simple. A sensor watches the water level in a reservoir or sump, and the Arduino reads that sensor and decides when to run a pump. When the level drops to the low point, the Arduino switches on a pump that moves freshwater from a RO/DI reservoir into the display or sump. When the level returns to the high point, the pump shuts off. Most builds use a float switch or a level sensor with two thresholds, so the system never runs continuously and never runs dry.

Shopping for one? See our guide: 6 Best Aquarium Auto Top Off System Picks for Reef Tanks (2026).

Because the Arduino is only a controller, the quality of the sensing and the pump hardware matters as much as the code. A reliable build depends on a sensor that will not stick, a pump rated for continuous use with fresh water, and a fail-safe that cuts power if something goes wrong.

Parts and Tools You Will Need

Before you start, gather everything in one place. Most hobbyists build around an Arduino Uno or Nano, a relay module, a low-level float or reed switch, a small submersible or inline pump, a freshwater reservoir, and a power supply that matches the pump voltage.

  • An Arduino board (Uno or Nano class) with USB cable and the Arduino IDE installed on a computer
  • A relay module rated for the pump’s voltage and current, with flyback protection if it is a bare relay
  • Two float switches or one dual-level sensor, rated for saltwater exposure if mounted in the sump
  • A low-voltage pump designed for freshwater use, with a discharge tube and check valve
  • A reservoir for RO/DI water with a lid, and a secondary float to prevent reservoir dry-run
  • An enclosed power supply sized for the pump and the Arduino, plus a fuse or breaker
  • Silicone sealant, heat-shrink tubing, drip loops, a multimeter, and a small enclosure for the electronics

Step 1: Plan the Layout and Water Levels

Start with a sketch of your sump or tank. Decide where the high-level and low-level sensors will sit. The gap between them determines how much water the system adds each cycle, so a common starting point is a 1 to 3 cm band. Too narrow and the pump will cycle constantly. Too wide and the water level will swing more than you want.

Mount the sensors above the lowest safe level for your return pump and keep them out of the main flow of the sump, where bubbles and turbulence can cause false readings. Place the reservoir and pump where a short, straight run of tubing will reach the display, and keep the pump below the reservoir when possible so it does not need to lift water far.

Step 2: Wire the Sensors and Relay

Wiring the Float Switches

Most float switches are simple normally-open or normally-closed contacts. Wire one side to a digital input pin on the Arduino and the other side to ground, then enable the internal pull-up resistor in code. This way a closed switch reads LOW and an open switch reads HIGH, and a broken wire will read as an open circuit rather than causing unexpected pump runs.

Wiring the Relay and Pump

Connect the Arduino output pin to the relay control input, the relay power to 5 V from the Arduino or a separate supply, and the pump circuit through the relay contacts. Keep mains-voltage wiring completely separate from the low-voltage logic side. If you are not comfortable working with mains power, use a pump that runs on low voltage through a DC supply and keep the relay on that circuit.

Use a fuse or breaker on the pump line, and add a drip loop to every cord so water runs away from the connectors rather than into them.

Step 3: Load and Customize the Code

Open the Arduino IDE and write or load a sketch that does four things: reads the level sensors, debounces them so brief surges do not trigger the pump, runs the pump only when the low sensor is active and the high sensor is not, and enforces a maximum run time as a safety limit. A typical maximum run time is 60 to 120 seconds per cycle. If the pump runs longer than that, the sketch should shut it off and log or flash an error light.

Add a debounce delay of a few seconds on each sensor reading. Without it, sloshing water can create rapid on-off cycling that wears out the pump and relay contacts.

Step 4: Calibrate the Levels

With the sensors installed and the pump disconnected from the display, fill the sump to your target level by hand and confirm the high sensor reads as expected. Lower the water slowly and confirm the low sensor trips at the right point. Adjust the mounting height of each sensor, not the code, whenever possible, because physical placement is more reliable than software offsets.

Once the thresholds are correct, reconnect the pump and run a dry test first with the outlet pointed into a bucket. Measure the volume delivered per cycle so you know how much water is added each time.

Step 5: Test Before Going Live

  1. Power the system with the pump unplugged from the sump and confirm the relay clicks on and off as the sensors change state.
  2. Run a full cycle into a bucket and confirm the pump stops at the high sensor, not just at the timer limit.
  3. Test the failure modes: unplug the low sensor, let the reservoir run low, and confirm the system stops rather than running dry.
  4. Watch the first two or three real cycles in the tank and check the water level and salinity after each one.

Common Mistakes

  • Using a sensor not rated for saltwater. Corrosion can cause false readings or shorts.
  • Setting the level band too narrow. This leads to constant pump cycling.
  • Skipping debounce. Surge and bubbles will trigger the pump falsely.
  • No dry-run protection on the reservoir. A pump running empty can burn out quickly.
  • Mixing mains and low-voltage wiring carelessly. Keep connections enclosed and labeled.
  • Trusting the system without a backup. Keep a secondary high-level alarm or a basic check of the water level in the tank.

Tips for a Reliable Build

  • Put the controller in a sealed box and keep it above the splash zone.
  • Label the sensor cables so you can replace them without tracing wires.
  • Log the number of pump cycles per day. A sudden jump often signals a leak or a sensor problem.
  • Clean float switches and pump impellers on a regular schedule, since salt and algae buildup can cause sticking.
  • Use RO/DI water in the reservoir and check its conductivity periodically, so you are not adding contaminants automatically.
  • Arduino Uno R3: A widely supported, well-documented board that is easy for beginners to program and expand. View on Amazon
  • Songle SRD-05VDC relay module: A common, simple relay board that works well for switching a small pump from a microcontroller output. View on Amazon
  • Tunze Osmolator 3155: A commercial ATO if you prefer a finished system to compare against your build, though it is not an Arduino product. View on Amazon

FAQ

Can I use an Arduino for a saltwater sump?

Yes, as long as the electronics stay out of the water and only the sensors and pump touch the sump. Keep the Arduino and relay in a sealed enclosure above the water line.

What pump should I use for an Arduino ATO?

Choose a pump rated for continuous freshwater duty with a flow rate suited to your sump size. Many hobbyists use a low-voltage submersible pump with a check valve to prevent backflow.

How often should I calibrate the system?

Check the levels weekly for the first month, then monthly. Recalibrate whenever you change the sump level, the sensor position, or the pump.

Why does my ATO keep cycling on and off?

Usually the level band is too narrow, the sensor is affected by surge or bubbles, or the debounce delay is too short. Widen the band or add debounce.

Is an Arduino ATO safe to leave running overnight?

It can be, if you have a maximum run time, a dry-run protection on the reservoir, and a backup high-level alarm. Test every failure mode before relying on it.

Do I need a relay if the pump is low voltage?

Usually yes, because most microcontroller pins cannot supply enough current to drive a pump directly. A relay or MOSFET driver is the safer choice.

Should I consult a professional for mains wiring?

Yes. If you are not confident wiring mains voltage, have a licensed electrician or experienced hobbyist check the installation before you run it unattended.

Conclusion

A well-built Arduino auto top off keeps your reef’s water level steady and reduces daily maintenance. The keys are reliable sensors, clean wiring with proper protection, sensible code with debounce and run limits, and thorough testing before the system runs unattended. Take your time with calibration and failure testing, and the system will serve your tank for years.

Caleb Morgan

About Caleb Morgan

Caleb Morgan is part of our editorial team and reviews and edits our reef & saltwater aquariums guides, checking product details against manufacturer specifications and owner feedback.

About the author

Caleb Morgan
Caleb Morgan

Caleb Morgan writes reviews and buying guides for My Reef Aquarium.