Nano tank ATO / Water change controller

Aqua_expert19

New member
I figured I would add this here even though I no longer have salt tanks. Maybe it will help someone.

First off I'd like to say the warnings that I'm not responsible for hurting yourself or your property if you follow this guide, this is just what I did.


So I have been looking for a top off for my Mr Aqua Low Iron crystal shrimp tank and nothing off the shelf did it for me. They were either too bulky, not safe enough and most flowed way too fast for what I was looking for. So I decided to build a simple one using an Arduino Nano V3, 2 optical sensors off of amazon and an aqualifter (~1.5gph) .



first here is a really simple schematic of what I did. To get the AC input and Output I just bought a $2 extension cord at the hardware store and cut and spliced it. The 3 leds are for status lights. Each green one is for if the sensor reads water or not. If ON then no water is touching the sensor. The red is for if power to the pump/relay is active.

R0CC7Wp.png



Next you cant have a small custom ATO with a bad bracket. This bracket is used for glass that is ~0.200" thick. For my rimless cube this is perfect. I added drill holes on the back to put 1/4-20 plastic screws in to really lock it in place. But they aren't necessary . The small holes in the center are to route 3/16's hard tubing for the fill port.

4aHqScz.jpg

QKyYjNL.jpg

66mjb7q.jpg

STJKhqJ.jpg


All of this got Jammed into a small project box with a grommet on the side.

dHuL9BA.jpg



I bench tested it for a while before putting it on my tank. Its made so the pump wont turn on until 15mins has passed since power on or the last time the pump ran. This means it wont run for super short bursts 10000x a day and that when I want to do water changes I just unplug it and I get 15mins to drain before it fills it back up. Since its for CRS I wanted it to be pretty slow and the aqualifter does a great job of that.



Things I wish I added and can in the future if it really bothers me is:
  • A button for waterchanges so it turns on the 15min delay without power cycling.
  • Then on my 180 gal I have a float safety on my for my reservoir so if its empty it doesnt keep just pumping nothing
 

Aqua_expert19

New member
Here is my code, its not the most efficient but it works and didnt take long to do.
Copy Below this line***


const int ato1Pin = A6;
const int ato2Pin = A7;
const int ato1LEDPin = 4;
const int ato2LEDPin = 3;
const int pumpLEDPin = 2;
const int relayPin = 6;
long delayTime= 900000; //15min in millis

unsigned long relayDelay =0;
unsigned long timer=0;
long timeCompare;

int ato1Value = 0;
int ato2Value = 0;
int pumpONBool =0;

void setup()
{
// initialize serial communications at 9600 bps:
Serial.begin(9600);
pinMode(6, OUTPUT);
}

void loop()
{
ato1Value = analogRead(ato1Pin);
ato2Value = analogRead(ato2Pin);

Serial.print(pumpONBool);
Serial.print(" ");
Serial.print(relayDelay);
Serial.print(" ");
Serial.print(timeCompare);
Serial.print(" ");
Serial.print(timer);
Serial.print(" ");
Serial.print(ato1Value);
Serial.print(" ");
Serial.println(ato2Value);

//* sensor logic **
timer = millis();

if (ato1Value >800)
{
digitalWrite(ato1LEDPin,HIGH);
ato1Value=1
}
else
{
digitalWrite(ato1LEDPin,LOW);
ato1Value=0;
}

if (ato2Value >800)
{
digitalWrite(ato2LEDPin,HIGH);
ato2Value=1;

}
else
{
digitalWrite(ato2LEDPin,LOW);
ato2Value=0;
}


// * TURNING ON PUMP **


if(timer-relayDelay >=delayTime)
{
while(ato1Value ==1 && ato2Value==1)
{

ato1Value = analogRead(ato1Pin);
ato2Value = analogRead(ato2Pin);
digitalWrite(pumpLEDPin,HIGH);
digitalWrite(relayPin,HIGH);
pumpONBool =1;
relayDelay = millis();
}
}

if ( ato1Value ==0 || ato2Value==0)
{
digitalWrite(pumpLEDPin,LOW);
digitalWrite(relayPin,LOW);
pumpONBool =0;
}

//max value of millis rerolled over. ~49 Days so nothing weird happens
if( millis() >= 4294967200)
{
relayDelay=0;
}

}
 

Aqua_expert19

New member
This is perfect for my new tank! How reliable have you found the sensor?

Well that was part of my reason I ran 2 of them. It seems to be pretty sensitive and my tank hasnt changed water level since I put it on so it must be working pretty well.

I think if I was to make a V2 I would add a second output for a second pump then you could choose topoff or Waterchange and add a button to turn it off for how ever long it takes to do thw water change. If you want to make it and you have any questions feel free to ask. I think I have less than $50 total in it.

Also if you measure your glass and its a different size I can mod the file for you!
 

A.T.T.R

Active member
One thing I’m thinking of is adding to the code a moving average of avg run time and avg daily run time and shut it down if it runs for more then 1.5x avg (assume that means something is very wrong). Other then that looks like I’m setting my 3D printer back up.
 

Aqua_expert19

New member
One thing I'm thinking of is adding to the code a moving average of avg run time and avg daily run time and shut it down if it runs for more then 1.5x avg (assume that means something is very wrong). Other then that looks like I'm setting my 3D printer back up.

Yea thats not a bad idea at all. I dont have a good way to log it easily to figure it out you could also limit running to 15mins per day or something as I cant imagine (on my 8g) that I would need 1G of water evap. On my other tank I have a float on the bottom of my Reservoir so it doesnt run if its out of water. My temp fluctuations a ton in that room between 68* and 84* so I will get different evap rates anyway.

I want to make a PCB for this to add a bunch of parts and make it all pretty. But then again its working really well and I'm lazy. Post what you end up doing code wise and we can keep a rolling update for anyone else.

One thing to note is I kept the height of the optical sensor lower than the plastic on the inside of the tank. Some printed materials can be toxic so I wanted to keep the plastic out of the water.

I'm just glad someone might use it or find it helpful, I debated posting it for that reason.

Thanks!
 

A.T.T.R

Active member
It is going to be a few months before I even get to this. I’m
Just starting the tank now.


And I swore to myself no diy this time. That lasted a whole week.
 
Top