$USD
  • EUR€
  • £GBP
  • $USD
PROJECTS ArduinoGravity

How to Make An Automatic Water Changing System

DFRobot Jul 06 2017 3010

It was difficult to raise chicks and small fishes when I was little.

I always think that it is impossible for me to raise a lovely aquatic animal in my life. Proposed by one of my friends, I decided to make an automatic water change system.

This simple system detects water quality through simulation Gravity: Analog pH Sensor / Meter Kit For Arduino and Gravity: Analog Turbidity Sensor For Arduino, and supplies and drains water through the submerged pump and solenoid valve. Thus, it is very suitable for me.

 

Component

 

Implementation of all module functions

 

Water supply

Water supply is the easiest link in the whole system. Here I used the Immersible Pump & WaterTube.

Place the pump body in the container filled with clean water, and place the water pipe in the fish tank. The clean water will be easily supplied to the fish tank only after power-on.

There is a minor problem. The water pipe often moves during water supply. So I design this. 


 

The water pipe will not move after fixed in this way.

The model picture of fixing part is as shown below. Interested friends may refer to it.

 

Water draining

I spent much time on water draining.

After the liquid is filled in a U-shaped pipe structure by use of applied force of liquid level height difference, place the end with high opening into the container filled up with liquid. Then, the liquid in the container will continuously flow out from the opening at the lower position through siphon.
 

The physical principle is that, two containers have different liquid level height; after the liquid in such two containers is connected, the motion trend of same liquid level will be maintained, i.e., the resultant force borne by the flowing liquid will turn downward, so the liquid will flow to the lower location.
 

Generally, the fish tank is placed on the table, so I only need to place a bucket (or other container) on the ground and then use a pipe to connect it.

After the water draining has been realized successfully, I add a solenoid valve. The switch will be turned on after power-on and shut down after power shutdown. Then, you may drain the water as you wish.


 

Notice:

1. The water pipe shall have small diameter, because we raise some small fishes, and the large-diameter pipe will absorb the small fishes out of the tank.

2. It is recommended to buy the solenoid valve with the minimum capacity on line (9V or 12V), not only saving power but also having little noise. It is not necessary to use a larger capacity.

3. For water draining based on siphon principle, first of all, there must be water in the water pipe connecting both containers. I suck lightly with my mouth when the whole system start operating.

If you think it’s dirty, you may buy a manual air extraction device on line. The water will be pumped by squeezing here with your hand as shown in the figure below.

 

2. Automatic detection of PH value and turbidity value

PH value and turbidity value shall be selected as the indexes for water changing. The PH value fluctuation of water in the fish tank shall not exceed 0.2,i.e., the water quality change shall be controlled within 1.6 times for each water changing. If so, it is all right to change 1/2 water with the same temperature. If not, less water changing volume is allowed.
 


I decide to only change about one tenth to one twelfth of water each time. However, this water changing frequency must be high, i.e., water needs to be changed when the PH value and turbidity value detected do not conform to the specification. By estimation, the water needs to be changed three or four times a day. Such frequency is not high.

 

3. Display

I use I2C 16x2 Arduino LCD Display Module.


 

 

Water level balance test

This problem needs to be explained separately. Although we have realized automation of water draining and supply, we cannot keep the water level balance under this automation, because water draining and supply speeds are different. The speeds are set during production. Thus, I need to figure out how to measure the water draining and supply speeds, and then modify their operating duration accordingly to reach the water level balance.

I test as follows:

Firstly, I inspect my fish tank capacity visually, about 15L. One tenth water is changed every time, i.e., 1.5L. By rounding off, I decide to use 2L water to carry out the test.

I do not have a measuring cup, so I decide to use disposable cup with the capacity of 250 ml.


2L water means 8 cups of water. I use the disposable cup above to pour water in the bucket above for 8 times. Then, I start testing the water supply speed:
 

While water supplying, I start using the stopwatch on my mobile phone for timing. At last, the water supply time calculated is as follows:
 

Then, I test the water draining speed:

I

In the meantime, I also record the water draining time as follows:


 

so...

Water supply time: 1.01.71=61.71S

Water supply speed: 2000/61=32.41ml/s

Water draining time: 3.56.20=236.20S

Water draining speed: 2000/236.20=8.47ml/s

 

 

CODE

#include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x20,16,2);// #define TurbidityPin A0// #define PHPin A1// #define Supplywaterpin 11// #define Drainwaterpin 12// float Turbidityval;// float PHval;// void setup() {  lcd.init();//                      lcd.backlight();//  pinMode(Supplywaterpin, OUTPUT);//  pinMode(Drainwaterpin, OUTPUT);//  Serial.begin(9600); // } void loop() {   getTurbidity();//   getPH();//     if (Turbidityval<4.06  || PHval<7.0  ||  PHval>8)//   {    delay(10000);    getTurbidity();//    getPH();//    if(Turbidityval<4.06  ||  PHval<7.0  ||  PHval>8)//    {    Serial.print("change water");    Drainwater();//    Supplywater();//    lcd.clear();    lcd.setCursor(0,0);    lcd.print("change water");    delay(20000);//    Supplywater_end();//    lcd.setCursor(0,0);    lcd.print("change water");    delay(56000);//    }     else    {        Serial.print("   no change ");        lcd.clear();        lcd.setCursor(0,0);        lcd.print("no change");        Drainwater_end();//        Supplywater_end();//        delay(8000);//      }      } else    {        delay(10000);//    } } void getTurbidity()// {   Turbidityval=analogRead(A0)/1024.0*5.0;   Serial.print("    Trubidity value: ");   Serial.println( Turbidityval);//   lcd.setCursor(0,0);   lcd.print("Turbidity:");   lcd.setCursor(12,0);   lcd.println(Turbidityval);  }   void getPH()// {  PHval=analogRead(A1)/1024.0*5.0*1.45;  Serial.print("    PH value: ");      Serial.println(PHval);   lcd.setCursor(0,1);   lcd.print("PH:");   lcd.setCursor(12,1);   lcd.println(PHval);  }    void Supplywater()//  {    digitalWrite(Supplywaterpin, HIGH);    }      void Drainwater()//  {    digitalWrite(Drainwaterpin, HIGH);    }      void Supplywater_end()//  {    digitalWrite(Supplywaterpin, LOW);    }      void Drainwater_end()//  {    digitalWrite(Drainwaterpin, LOW);    }

Detailed explanation has been added. I believe you can understand mostly. However, I want to make some explanations on the following point:         

“if (Turbidityval<4.06  || PHval<7.0  ||  PHval>8)// if the turbidity sensor output is less than 4V or PH value is less than 6.5
 

{
   delay(10000);

getTurbidity();//turbidity reading

getPH();//PH value reading

if(Turbidityval<4.06  ||  PHval<7.0  ||  PHval>8)// turbidity and PH value still meet water changing conditions”

Why are there two “if statements” above?

Because a fish passes by the turbidity sensor carelessly or fish feed is scattered near the turbidity sensor which will cause transient turbidity.

We certainly know the water is not truly turbid. However, the machine does not know, so we need to let the machine know.

Thus, I add this line of codes. The equipment will determine the water is turbid if detecting the water is remained turbid within 10 s. (Fishes must have eaten up the feed in a location within 10s)

For water draining and supply time, I plan limit changing volume at high frequency, so each water supply time is only 20 s, and the water draining time shall be 20*3.8=76 s.
 

 

Finished product


 

It can raise all miraculous small animals which are not seen in temperate zone countries or only exist in deep sea.

REVIEW