The Planted Tank Forum banner
1 - 3 of 3 Posts

·
Registered
Joined
·
286 Posts
Discussion Starter · #1 · (Edited)
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.



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.









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




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:
  1. A button for waterchanges so it turns on the 15min delay without power cycling.
  2. 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
 

·
Registered
Joined
·
286 Posts
Discussion Starter · #2 ·
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;
}

}
 
1 - 3 of 3 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top