Introduction: Simple Arduino Controlled Aquaponic System

This instructable covers certain aspects of building an aquaponic system. I use an arduino micocontroller to regulate the frequency of system cycling. 

If you an to build an aquaponic system, other instructables, blogs, books should be consulted prior to building. I recommend the following sources:

Aquaponic Gardening: A Step-By-Step Guide to Raising Vegetables and Fish Together by Sylvia Bernstein
http://www.amazon.com/Aquaponic-Gardening-Step-By-Step-Vegetables-Together/dp/086571701X/ref=sr_1_1?ie=UTF8&qid=1385936625&sr=8-1&keywords=aquaponic

http://www.backyardaquaponics.com/

The functionality of the final product is quite simple but effective. Further work will be done to expand the features of the system including logging temperature and other environmental indicators. 

Step 1: Plan the System

Before you begin building you need to determine a few parameters which will help you select appropriate tank/pump and grow bed sizes etc.

Your driving criteria maybe fish yields, plant yields, space limitations or other. Decide what kind of requirements you need to fill and base your design around those. For my system, it was simply to be an experiment as a pre-cursor to a larger system.

From reading around, here are a few rules of thumb that help determine the relative size of components (I have not followed all the guides):

Brow beds
Should be 300mm deep. This is driven by root zones. 
Water levels should cycle between keeping the bottom 50mm always flooded and the top 50mm always dry. This helps promote different environments within the grow media that helps to establish a diverse ecosystem.
To effectively filter the water, the total volume of all the grow beds should be twice that of the fish tank.
If grow-bed area becomes large, may need to consider multiple inlet points for nutrients.

Fish tank
Fish stock ratio of 1kg of mature  fish / 40-80 Liters of water.
minimum 460mm depth
minimum 190 litres
A higher surface area of the fish tank encourages gas exchanges to occur.
Should provide shade/shelter for fish to hide from predators/other fish.

Sump
the sump should be large enough to hold the volume required by the grow bed plus the depth to the top of the pump impeller plus some margin to prevent the pump from being run dry.

*I chose to use a sump in my system to help compartmentalise things. Some systems may have water being pumped direct from the fish tank. Intuitively, I think this would be quite stressful for the fish. I also prefer the idea of manipulating the water chemistry in the sump to form a buffer for any chemical swings to the fish tank.

Pump
To choose the right pump you need to understand that the head pressure determines the rate of flow for a given pump. The relationship is defined by the pump curve which should be displayed on the box/datasheet of the pump.

For our purposes, I didnt spend too much time selecting a pump I chose a cheap small pump marketed for use in backyard ponds. It is more that sufficient for what I wanted it to do. However, If you want your system to push the boundaries of energy efficiency it will be necessary to do more research into the pump. A video series in the link explains the fundamentals of how pumps work and how a pump graph explains their capacity.

http://www.youtube.com/watch?v=2HF_Z64OfQE

Other considerations for the pump:
25% duty cycle - pumps are typically designed to be operated for short periods. This may be described as a 'duty cycle' a duty cycle of 25% means the pump is only running for 15 minutes every hour maximum. Running longer than the recommended duty cycle may cause the pump to fail early.



Step 2: Materials / BOM

One of the most important things to keep in mind is to buy food safe components and materials.

Be weary of the following toxic materials that may seem attractive:
non-food safe PVC glues
DWV drainpipe (PVC like pipes)

I recommend polypropylene components where possible which are used frequently in irrigation and are relatively cheap when compared to their PVC equivalents. That being said, many of the components used in my system are PVC.

The PVC components do not need a high pressure rating. The ones used in my system are class 12 and class 18 because these were what was available. Lower rated fittings will be fine for this application and are much cheaper.

When you buy your components, consider buying extras of common fittings so that you can experiment and dont need to go to the hardware store every time you are missing a small component.

Full BOM

Principal Components
Pump
Grow bed
Fish tank
Sump tank
Stand

Bell Siphon
25mm polypropolene tank fitting
1 off. 25mm female threaded fitting
1 off. short length* ~100mm length of pvc pipe.  note that this length is critical in determining the top level of the water during the flood cycle.
1 length off 50mm PvC pipe
1 off. 50mm Pvc endcap

Media Filter
90mm PVC pipe
90mm end cap

Outlet Pipe
1 off. 25mm male threaded fitting
1 off. 25mm 90 deg elbows
2 off. short lengths of 25mm pvc pipe to join fittings
2 off. 25mm 90 deg elbows
1 off. 25mm 'T' fitting
1 off. 25mm female threaded adapter
2 off. 25mm threaded male to 19mm barbed hose fitting (poly propylene)
2 off. 25mm end caps
2 off. 25mm pvc pipe cut to 200mm (depends on width of your grow bed)
various short lengths of 25mm pvc pipe to join fittings

Overflow Pipe
1 off. 50mm polypropolene tank fitting
1 off. 50mm female threaded adapter
Chicken wire

Electronics
Arduino
ATX power supply
Relay Kit
Enclosure

Step 3: Electronics Enclosure

For the electronics enclosure I chose a cheap sheet metal tool box from the local hardware store. It cost me $10 and does the trick.

The box is used to house the following components:
The micro-controller (Arduino)
The ATX power supply
Mount for the external 240v enclosure 
Mount the face plate for external keystone interfaces.

I was lucky that the box was the right dimensions to hold an ATX power supply nicely. The pump I selected was a 'plug in' 300 watt submersible pond pump. thus, the switch the pump on and off it was necessary to build a relay controlled power outlet.

Below is a block diagram of the electronics components

External 240v enclosure
Warning: this step contains use of mains power. if you are not confident handling mains power please do not attempt this part of the project.

The alternative is to buy an off the shelf solution such as https://www.adafruit.com/products/268 which removes the need for this step.

this was my first time using mains power in an electronics project and taking precautions such as:
use an RCD device.
earth the enclosure.
never energise the 240v part of the circuit when the sub-enclosure is open

I bought the following kit off ebay http://www.ebay.com.au/itm/K006-relay-board-module-5v-for-Arduino-PIC-Atmel-TTL-10AMP-mains-/221319906349?pt=UK_Computing_Other_Computing_Networking&hash=item3387b1c42d&_uhb=1

https://www.sparkfun.com/tutorials/119

The external GPO enclosure is the largest that can be bought for one outlet.
The faceplate also came with a switch so you can de-energise the outlet regardless of the state of the relay.

I would recommend extending the LED on the relay board and finishing it into the face of the main enclosure to help troubleshoot/diagnose any problems.
This is a riser box with a GPO and switch faceplate. I cut a rectangular hole underneath the riser section to fit off an IED screw mount socket that I stripped from an old ATX power supply. All work that I did that contains 240 VAC is contained within this box. I did this intentionaly to isolate the high voltage circuit from the microcontroller circuit. When I go poking around changing pins on the arduino I wont accidently touch any high voltage terminals. 

The ATX supply
An ATX power supply is an excellent solution projects like this. They are very cheap, efficient and readily available. by adding it into the progect we have a very efficient circuit for providing low current 5v DC continuously while plugged in, which keeps the Arduino alive and ticking. We can also use the arduino to pull signal wires of the ATX HIGH or LOW to power the supply up or down depending on our power requirements 

A pin out of the ATX supply can be found at:
http://en.wikipedia.org/wiki/ATX#Power_supply

Key pins are:
Purple - 5v standby, connected to the arduino 5v rail.
Green - Power on, connected to one of the arduino outlet pins and pulled low to power up the PSU.

Earths are all connected together.

12v supply is used to power the coil of the relay.





Step 4: Head Bar

For my system I made a watering bar that would hang off the side of the grow bed. I used 90 degree beds so that I could rempove the components easily for cleaning and maintenance.

The bar is intended to spread the high nutrient loaded water across the breadth of the grow-bed. Intuitively, a point source will result in high levels of growth in that area and filter the nutrients before they can reach other root systems further from the inflow point.

BOM for building the bar
2 off. 25mm 90 deg elbows
1 off. 25mm 'T' fitting
1 off. 25mm female threaded adapter
2 off. 25mm threaded male to 19mm barbed hose fitting (poly propylene)
2 off. 25mm end caps
2 off. 25mm pvc pipe cut to 200mm (depends on width of your grow bed)
various short lengths of 25mm pvc pipe to join fittings

drill 3 equidistant holes (5mm) along the lengths of the water bar.

dry fit the assembly per the diagram attached. you can leave the assembly dry fit as it is not essential that this component be air and leak tight like it is for the bell syohon.

Step 5: Bell Syphon

This is the most critical part of the system. it may require some adjustments when running to get everything to work reliably. I have included  some notes about tuning in this section to help you troubleshoot your system.

BoM
25mm polypropolene tank fitting
1 off. 25mm female threaded fitting
1 off. short length* ~100mm length of pvc pipe.  note that this length is critical in determining the top level of the water during the flood cycle.
1 length off 50mm PvC pipe
1 off. 50mm Pvc endcap
90mm PVC pipe
90mm end cap

The media filter is really important to get the system to work well. Previously, I had the system running without a filter ie the filter media was sitting directly against the siphon. This caused the siphon to walk up through the media during the flood/drain cycle and break the seal becoming ineffective.

Filters on other systems are glued to the base of the tank to prevent this walking action.  To help keep things easily accessible for maintenance,  I used press fittings only.

The filter is made with a 90mm cap end drilled out in the middle so the tank outlet can pass through the fitting.
The media filter is made from 90mm PVC sleeve 300mm long with saw slots cut at regular intervals. Note: Be sure to add plenty of drill holes at the base of the sleeve because at the lower levels the filter can impede the flow to the point of prematurely starving the siphon.

When we first started running the system we found that the siphon would frequently miss-fire resulting in the grow bed not being properly drained.  Through experimentation, reducing the cross-sectional area of the bell siphon stem pipe allowed the siphon action to be triggered more effectively. Controlling the equilibrium between water flowing into the siphon (from the flow of the pump) and water flowing through the stem of the siphon is critical to having things run reliably.

Step 6: Overflow Outlet

For the overflow outlet it is important to make the diameter of the pipe big enough to cope with the inflow of water from the bell siphon. The bell siphon draws the water down from the growbed and even though the pipe diameter is small (~25mm) in this case the discharge rate is very high. Initially I had a 25mm outlet pipe and this just could not keep up with the water rushing in from the growbed which led to the fish tank overtopping. Not good if you want to keep the fish in the tank.

Afterwards, I stepped up the diameter of the outlet to 32mm and this still was too small. Finally I bought another 50mm fitting and this was able to discharge quick enough.  To stop the fish passing into the sump I put chicken wire over the inlet and secured with a zip tie.

Step 7: Code

This simple code provides a working program that will reliably switch on the pump for 3 minutes at a time at 1 hour intervals. In future more sensors and routines will be included to increase functionality.

Below is the code used:

int pumpTimeON = 60000;
int pumpTimeOFF = 60*1000;
int pumpRelay = 4;
int powerON = 6;

// the setup routine runs once when you press reset:
void setup() {   
Serial.begin(9600); 

  pinMode(pumpRelay, OUTPUT);
  pinMode(powerON, OUTPUT);

  digitalWrite(powerON,LOW);

  Serial.println("Powering on ATX supply");
  delay(2000);

}

// the loop routine runs over and over again forever:
void loop() {

  digitalWrite(pumpRelay, HIGH);   // turn the LED on (HIGH is the voltage level)
  Serial.println("Pump on");
  delay(pumpTimeON);    
  // wait for a second
  digitalWrite(pumpRelay, LOW);
  Serial.println("Pump off");
  digitalWrite(powerON,HIGH);
  Serial.println("ATX off");
  delay(pumpTimeOFF);
  digitalWrite(powerON,LOW);
  Serial.println("ATX on");
}

Step 8: Running the System

It takes time for the system to reach an equilibrium.  4 full weeks of cycling may be required to allow the system to build up a culture of organisms to reach stability. Before this time, you may loose fish and plants. Check the system regularly during the early stages of the systems life. Use aquarium bought chemical indicators to monitor the concentration of nutrients in the system and make adjustments as required. 


After the establishment period, the system should be stable enough to promote growth for both the fish culture and the plants requiring only weekly monitoring.

Hydroponics and Indoor Gardening Contest

Participated in the
Hydroponics and Indoor Gardening Contest