DIY auto top off – arduino Optical ATO

Evaporation and increased salinity levels is one of the fastest ways to crash your tank.. An ATO, auto top off or technically an osmolator will automatically add freshwater back in to your tank to keep the water level constant and compensate for evaporation.

Since a fancy auto top off can cost 100-200$ I decided to make my own extremely accurate version for a fraction of the cost.

Rather than using just a standard float valve (which can fail) I went with an optical water level sensor, which is very accurate and detects when water touches the top of the sensor. I also added a float valve as a backup.



The microprocessor will only activate the pump of both sensors are not detecting water. If either one senses water the filling sequence is skipped

I also added a Hold switch to the box. When this switch is hit the arduino goes into a loop of blinking the LED as a reminder to turn it back on. This Hold mode will be useful when doing water changes.


I may add a third safety of only running the pumps for so many second per fill. But this is dependant on if I do micro topoffs 24h/day or hair have the ATO check every few hours or at times I’m not around.



I need some form of a 6 pin connector but came up short and decided to go with a DB9 connector as they are cheap and readily available.(null)



Once i soldered the sensors on to my wire i covered the last half of the wire all the way down to the sensors  in heat shrink to seal it up and have a nice black wire to blend in with the back of the tank.(null)




Motor on the left,  12V power in the bottom right. DB9 connector for the sensors and USB in case i want to adjust the programming at a future date.

I found a thin acrylic rube which was about the size of an airline. This allowed me to use an airline holder as my mount.  The beauty of this method is i can very easily raise and lower it to set my water level.






Once i fill the tank ill trim the rod to about the level of the tank. to clean things up.  I do love the simplicity and adjust-ability of this method of mounting it.



Side view of the sensors in the tank. I plan on keeping the water level slightly below this overflow into the pump chamber. This should minimize nose 🙂



  • Hi,

    Nicely done !
    I found your website when looking for an alternative solution to my dead Tunze osmolator.
    Do you have some electronics schemas and example of code in order to realise this project ?

    Thanks in advance,

  • Thank you. Unfortunately my laptop froze on me before i saved the code of the current version. I have had a number of requests to build one for other so ill likely order a ton of parts and make some to sell.. at which point ill re-write the code 🙂

    I also found an awesome new sensor that can check the level through the glass. so the next version may just mount on the back of the glass keeping everything out of the tank.

  • Hi–Where can I find/order the optical sensor that you used for this system? Thanks!

  • Deven I am trying to build a DIY auto top off like you have built. I have scoured the internet and not found much information on these projects. Yours looks just like what I would like to build. Could you please send me detailed information on how you put yours together, the electronics schemas. I would greatly appreciate any information you could send me so I can build my own.

  • Would also like to know about the optical sensor. Thanks!

  • Bought this optical sensor fron ebay, item #400934780805. Tested it and works good, now just need the sketch, or I can probably create one when I have the time.

  • I am trying to create the same but without ARDUINO (as I havent tried it and dont want to complicate)
    I have the following
    1) magnetic float (item #281866719818)
    2) optical sensor (item #400934780805 )
    3) Electric Solenoid Valve Normal Closed 12v (item #271754139788)

    I am looking for a CONTROLLER that can hook those 3 together and a 12v power supply

    The use case is simple – When water drops below the level of the 2 sensors, activate the Solenoid valve to open the water flow, once one of the contact points (magnetic float or optical) is wet or shut close the Solenoid valve .

    Where can I find such a controller or an applicable solution?

  • without arduino you wont be able to do timing as a backup but you could do a basic one by using the float or optical sensor signal to trigger a relay.. the relay output would connect power your solenoid.

  • IF you want it to only work if both sensor agree.. wire them in series.. When float switch is on,. it gives power to optical sensor.. then use optical sensor to trigger relay.

    You will need a 5v relay for the optical sensor. so 5v for relay/optical sensor and 12v for your solenoid. So 2 power sources.. or use a single 12v source then get a LM7805 or some form of 5v regulator to get away with one power cord

  • Thanks for the response for the power adapter will be connected to a timer so no worries there, and what I am trying to do is

    1) once the optical sensor is dry – the Solenoid valve is open to let water in
    2) once its wet the flow stops
    3) in case the optical fails and water continues to flow up the magnetic float will cut the power

    honestly, I still dont understand how to do this, I want to use just a single 12v power cord. can you point to the ebay / amazon items to buy? thanks!

  • Hey… I am looking for an optical continuous water level sensor, so I can manually adjust the different min and max values, when to switch on water pumps. I have a shallow tank with 40mm height.

    Any good input, suggestions – very welcomed!

    Thank you in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *