Week 7

Final completed Product

Video Demonstration

 

 

 

 

Fish tank parameters & final features

Dimensions

Acrylic housing for tanks: 360mm x 260mm

Main Tank: 35cm x 18cm x  26cm

Whole setup:

Features

For the purposes of our simulation, we aim to create a suitable environment for zebrafishes to thrive in.

  • Homeostatic system, fish tank will always stabilise the conditions of the fish tank to match the suitable living conditions for the fishes
    • pH levels hover between 6.8 to 7.5
    • TDS values hover between 350 to 550
  • Failsafe design. Pumps are coded to prevent pumping out water when clean water tank is empty – when there is no water available to refill the tank.
  • Non-intrusive.
  • Little human input required
    • Owner only needs to refill the clean fish tank ,empty waste tanks and top-up his chosen neutral regulator into the dispenser.
  • IoT ThinkSpeak online data collection
    • Allows users to monitor the conditions of their fish tanks.

Why are there no fishes?

In order for us to conduct this experiment with live zebrafish, we had to gain approval from the NTU-IACUC committee and would have to shift the entire tank to designated zebrafish facilities. This would be too troublesome. As such, we chose to conduct simulations instead to showcase how our system would react to changes in pH and TDS values.

Code

current code

Future considerations/improvements

We note that though our system has the potential to reduce water wastage during fish tank water changes, we still dispose away the waste water. As such, one improvement that could be worked upon is to turn our product into a closed system where the waste water is recycled back into the fish tank after undergoing the necessary filtering and water treatment.

Week 6

Completed PCB BOARD

Completed PCB Board connections

Key Issues & Findings:

  • We solved the issue of the metal connections below the relay and Arduino touching the PCB board by inserting PCB connectors onto both the PCB and the relays.
  • One of our biggest hurdles was trying to solder all the components together.
    • At times, some of our components could not work properly as we did not solder them onto the PCB board securely and this led to us resoldering the components multiple times
    • Moreover, we failed to provide isolation for some of the pins on the PCB board, resulting in the pins being connected to the entirety of the GROUND layer of our PCB.
    • This resulted heat dissipation on these pins, making it hard for us to melt the soldering metal onto the pins and connect our components.
  • Overall, our PCB is now functional and has allowed us to compact our components together in and greatly reduce the number of wires required for our product.

 

pH calibration

Calibrating pH sensor at pH = 7

BEFORE CALIBRATION

AFTER CALIBRATION

 

Key Issues & Findings:

  • One issue we faced throughout the development of our product is pH calibration
    • There were times where our pH readings just became very off and as such there was a need to recalibrate our sensors often.
    • We suspect this is due to the sensors being taken in and out of water tanks often.
  • To attempt to solve this, we first conducted a 2 – point pH calibration at pH level 4 and pH level 7.
  • We then decided that we should leave the pH sensors in the water tank throughout and never take them out unless absolute necessary.
  • Through this, we were able to ensure that the pH of our sensors did not fluctuate rapidly and were about +- 0.1 pH away from the true readings.

Week 5

PCB board issues

Key issues & findings:

  • Unfortunately, when we received our PCB board, we are unable to use them immediately.
    • From Fig 1, we noticed that due to some metal connections on the bottom of our relay module, we cannot directly connect it onto our PCB board.
    • From Fig 2, we noticed that the relay module we are using now is also too big for the to connect it using the ‘through-holes’ of our PCB

Housing for fish tank

 

Acrylic to place Clean & Waste water tank

Key findings & issues:

  • We designed a 380 x 260 mm acrylic house with 2 levels.
    • On the top level, we will be placing the Clean & Waste water tank. This is done to place the water level of the waste tank over the 80% water level of the fish tank and prevent the ‘siphon-effect’
    • On the bottom level, we will be placing the electronic components to prevent them from being exposed to water and risk them being damaged.

Week 4

3d Prints

Key findings & issues:

  • Whilst running tests on our system, our sensors were rarely upright as dip them into the water.
    • This is detrimental to our set-up especially since this will cause the water levels read off by the float sensor to be inaccurate.
    • Hence, we decided to implement a Sensor Housing which will aid us in keeping our sensors upright and make our set-up more reliable.
  • The Clean Tank Sensor Hub helps facilitate easy removal of the clean & waste water tanks without the need to dismantle the electronics.
  • LCD housing allows us to more easily fixate the LCD onto the fish tank.

 

Siphon Effect

KEY IDEA: Water flows from HIGH pressure to LOW pressure.

Siphon Effect diagram

Key issues & findings:

  • Whilst we were testing our system, we found that the siphon effect occurs and water is continuously pumped out of the fish tank into the waste-water tank even after the water pump has been switched off.
    • This is because, when the pump turns on and fills up the water pipe, the pipe cannot be emptied out as by doing so it will be creating a vacuum
      • Since water travels from a region of higher pressure to lower pressure this vacuum will not be able to exist and water will not be able to ‘separate’ and empty out the pipe
    • As such, water will continuously flow out until the pressure at the start of the pipe = pressure at the end of the pipe
  • To prevent this ‘siphon effect’, we must ensure that pressure at the end of the pipe is always greater than the pressure at the start of the pipe.
    • This allows for water to stop flowing when the pump is turned off and no external force allows for water to flow.
    • To achieve this, we must place the waste water tank at a higher position than the fish tank.

 

Week 3

No longer using Sd card

 

Text File which SD card stores data

Key Issues & findings:

  • Initially we planned to use an SD card to help store and monitor fish tank conditions and parameters over an extended period of time.
    • However, as seen from the image above, the SD card will only store this data in a text file and it will be up to the user to figure out how to interpret and plot this data himself
  • Hence, we decided to remove the SD card feature and find out another way (ThingSpeak) for the user to be able to access his data and have it displayed without the need for him to put in any effort.

 

THINGSPEAK COMMUNICATION

ThingSpeak Mainpage

Key Issues & findings:

Field 1 ~ Graph displaying TDS of fish tank over-time. Data is taken in every 25 seconds.

Field 4 ~ Real-Time pH of fish tank

Field 5 ~ Real-Time pH of clean tank

  • Initially we planned to use an SD card to store information which the user can then use to plot a graph for himself and study the changes in both pH and TDS of the system over time.
    • However, we felt that this method over-complicates the steps the user needs to take just to study the parameters of his tank. This has led us to opt towards using ThingSpeak instead and capitalise on the IoT feature of our Arduino Uno Wifi Board.
  • Advantages of ThingSpeak:
    • ThingSpeak eliminates the need for the user to make his own Graph to plot his data. ThingSpeak can automate the plotting and recording of data for the user.
    • There is no need to remove a SD card in order to obtain analyse the parameters. The system only requires Wi-Fi connection.
    • ThingSpeak allows us to a ‘Change Water Indicator’ which tells the user when to fill up the clean water tank with water.
    • Lastly, the user has access to ThingSpeak even when he is away from the fish tank, allowing him to monitor the parameters without being physically near the fish tank.

 

PCB Board design

Key issues & findings:

  • We are attempting to design a PCB board to combat the amount of wires required to connect our entire system.
  • The goal is to create a cleaner and more sleek product in the end with less dangling wires and allow for our electronics to be tucked away neatly.

Week 2

Reverse Engineering Dispenser

 

Key issues & findings:

  • Dismantling the Fish feeder was relatively easy as well as finding out what to connect to our arduino set-up
    • We were able to get the feeder to turn on and off with the use of a relay which we could then use as a way to dispense our chemical powders and treat the tap water.
  • Our initial plans were to find the time required for the dispenser to dispense the correct amount of regulator in the Clean Water Fish Tank. However, as the dispenser rotates it does not dispense the same amount of regulator each in each revolution. This results in the dispenser require a range of different timings in order to dispense the right amount of regulator
    • To offset this, we will instead be monitoring the TDS values of the Clean Water Tank instead. Once the clean water tank reaches a suitable TDS value, we will switch off the dispenser.
    • To account for the varying amount of regulator dispensed, we will be accepting a range of TDS values which the Clean Water Tank will allow.

Float Sensors

 

Key issues & findings:

  • To combat the spike in TDS and pH values when using the water level sensor, we have purchased a float sensor which does not take in the conductivity of water in order to give us a reading of water levels.
  • Instead, the float sensor acts as a ‘switch’ – it gives off only 2 readings which are ‘HIGH’ and ‘LOW’.
    • ‘HIGH’ = High water level
    • “LOW” = Low water level
  • The buoyant portion of the sensor located in between the shaft will float on the water surface and transmits either a ‘HIGH’ reading or ‘LOW’ reading depending on its position on the shaft.
  • We place these float sensors onto the Clean Water Tank and Main Fish Tank
    • Main Fish Tank
      • ‘HIGH’ reading + Dirty water conditions = Pump water Out
      • ‘LOW reading’ + Dirty water conditions = Stop pumping water out
    • Clean Water Tank
      • ‘HIGH’ reading + water is treated = Pump clean water into main water tank
      • ‘LOW’ reading = Stop pumping clean water into main water tank

MESSY WIRING

Our current wiring management is very poor and we really need to find a way to better manage it. If we continue to work with such wiring, it will lead to even more problems down the road such as water spillage risks since they are all quite exposed and also, we may forget where the wires are suppose to connect in relation to the other wires.

WEEK 1

System 1

Brief video overview of System 1

Key issues & findings:

  • Water Removal Stage conditions:
    • pH > 6.8 or TDS > 300 and water level sufficiently high.
  • The Water Sensor available to us at this point of time is unsuitable to be used for our final product
    • As seen in the video, It records a value of 500 – this is the value indicating the proportion of water level  sensor immersed in the water, a value of 500 signifies that about half the sensor is immersed in the water. Hence a longer water level sensor is required.
    • However, even with a longer water level sensor, the water level sensor still poses some issues. When the sensors (pH & TDS) are plunged in the same water body as the water level sensor, we notice that the values start to spike up. The water level sensor produces some ‘noise’ raising the values of pH and TDS displayed to higher than their actual values.

 

Changing LCD BUS

Brian soldering wire to change address bus of LCD

 

Key issues & findings:

  • When trying to place 2 LCDs onto the same SDA and SCL connection via parallel wiring and I2C connection, we notice that only 1 LCD would produce correct results. The other LCD would display random characters.
    • To overcome this, we decided to change the address bus of the 2nd LCD to be 0x26. This allowed for information to be sent to different address buses and allow for us to display different readings onto the 2 LCDs.

dismantling fish feeder.

Key issues & findings:

  • We want to turn the automatic fish feeder into an automated regulator dispenser for our Clean Water Tank.
  • Dismantling it is key as we did not want it to be battery operated. Rather, we want it to be powered by the arduino and be able to receive information by the arduino on when to pump out the regulator
    • Upon dismantling we found that there were 2 main wires (Red and Black) powering the motor of the feeder. We deduce that these wires must be rewired and connected to our arduino instead in order to power it and get it to dispense upon receiving information by the arduino.

Week 0

Cardboard Modelling

Click the images to enlarge the pictures and find out more about our design process.

Key findings of cardboard model:

  • The model allowed us to better visualise the dimensions required of our project – dimensions can be seen upon clicking on the pictures.
  • There is a need for the user to be able to dismantle and remove either the clean tank or waste water tank.
    • To facilitate this we prototype a housing to contain the 2 tanks which includes a flap and a hub. The intended aim is to provide the user with a means to easily remove the sensors and pumps from the tank without the need of unplugging them. This should be done solely by lifting the flap upwards.

Sensor code

Code for pH Sensor:

 

#include<Wire.h>

#include <LiquidCrystal_I2C.h>

#include <Adafruit_GFX.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

#define SensorPin 0 // the pH meter Analog output is connected with the Arduino’s Analog

unsigned long int avgValue; //Store the average value of the sensor feedback

float b;

int buf[10],temp;

void setup()

{

pinMode(13,OUTPUT);

lcd.init();

lcd.backlight();

}

void loop()

{

for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value

{

buf[i]=analogRead(SensorPin);

delay(10);

}

for(int i=0;i<9;i++) //sort the analog from small to large

{

for(int j=i+1;j<10;j++)

{

if(buf[i]>buf[j])

{

temp=buf[i];

buf[i]=buf[j];

buf[j]=temp;

}

}

}

avgValue=0;

for(int i=2;i<8;i++) //take the average value of 6 center sample

{

avgValue+=buf[i];

float phValue=(float)avgValue*5.0/1024/6; //convert the analog into millivolt

phValue=3.5*phValue; //convert the millivolt into pH value lcd.setCursor(0, 0);

lcd.print(“pH Val:”);

lcd.setCursor(8, 0);

lcd.print(phValue);

delay(500);

digitalWrite(13, HIGH); 

delay(300);

digitalWrite(13, LOW);

}

Code for TDS Sensor:

#include<Wire.h>

#include <LiquidCrystal_I2C.h>

#define TdsSensorPin A1

#define VREF 5.0 // analog reference voltage(Volt) of the ADC

#define SCOUNT 30 // sum of sample point

int analogBuffer[SCOUNT]; // store the analog value in the array, read from ADC

int analogBufferTemp[SCOUNT];

int analogBufferIndex = 0 , copyIndex = 0;

float averageVoltage = 0, tdsValue = 0, temperature = 25;

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()

{

Serial.begin(115200);

pinMode(13,OUTPUT);

lcd.init();

lcd.backlight();

pinMode(TdsSensorPin,INPUT);

}

void loop()

{

static unsigned long analogSampleTimepoint = millis();

if(millis()-analogSampleTimepoint > 40U) //every 40 milliseconds,read the analog value from the ADC

{

analogSampleTimepoint = millis();

analogBuffer[analogBufferIndex] = analogRead(TdsSensorPin); //read the analog value and store into the buffer

analogBufferIndex++;

if(analogBufferIndex == SCOUNT)

{

analogBufferIndex = 0;

}

}

static unsigned long printTimepoint = millis();

if(millis()-printTimepoint > 800U)

{

printTimepoint = millis();

for(copyIndex=0;copyIndex<SCOUNT;copyIndex++)

{

analogBufferTemp[copyIndex]= analogBuffer[copyIndex];

averageVoltage = getMedianNum(analogBufferTemp,SCOUNT) * (float)VREF / 1024.0; // read the analog value more stable by the median filtering algorithm, and convert to voltage value float

compensationCoefficient=1.0+0.02*(temperature-25.0); //temperature compensation formula:

fFinalResult(25^C) = fFinalResult(current)/(1.0+0.02*(fTP-25.0));

float compensationVolatge=averageVoltage/compensationCoefficient; //temperature compensation

tdsValue=(133.42*compensationVolatge*compensationVolatge*compensationVolatge – 255.86*compensationVolatge*compensationVolatge + 857.39*compensationVolatge)*0.5; //convert voltage value to tds value

lcd.setCursor(0, 0);

lcd.print(“TDS:”);

lcd.setCursor(0, 1);

lcd.print(tdsValue,0);

lcd.setCursor(10, 1);

lcd.println(“ppm”);

}

 

}

int getMedianNum(int bArray[], int iFilterLen)

{

int bTab[iFilterLen];

for (byte i = 0; i<iFilterLen; i++)

{

bTab[i] = bArray[i];

int i, j, bTemp;

for (j = 0; j < iFilterLen – 1; j++)

{

for (i = 0; i < iFilterLen – j – 1; i++)

{

if (bTab[i] > bTab[i + 1])

{

bTemp = bTab[i]; bTab[i] = bTab[i + 1];

bTab[i + 1] = bTemp;

}

}

}

if ((iFilterLen & 1) > 0)

{

bTemp = bTab[(iFilterLen – 1) / 2];

}

else

bTemp = (bTab[iFilterLen / 2] + bTab[iFilterLen / 2 – 1]) / 2; return bTemp;

}