When we started developing the Aquaponics Controller   we realized we wanted a single unit that could handle multiple situations.  Some flood-and-drain aquaponics systems toggle the pump on and off on non-matching intervals, say five minutes on and fifteen minutes off and some use a bell siphon and let the main pump run continuously. 

This controller does both and throws in a third mode for manual operation.  There are a couple of challenges to building an aquaponics controller like this with Arduino, where we want to sync the operation information (mode, run time, idle time, and pump state) with a web application and yet operate independently if it should fail to make the connection.  First, due to the inherent limit the Ethernet Shield can make requests - a maximum of 5 to 10 seconds - and the frequency we need to check whether the pump relay should be toggled on or off - once every second, we realized we would need two different TimerAlarms.  Similarly, the Ethernet request frequency meant we had to find a way to sync the operating parameters (mode, run time, etc.) in one request so the Arduino could move on to checking the pump. 

Enter JSON, a web standard for passing key-value pairs.  We used the aJson library to parse the response from the web application.  A ChronoDot (real-time-clock) is used to keep the system time and track when the pump toggles on and off. 

1 x Arduino Mega R3
1 x Arduino Ethernet Shield R3
1 x ChronoDot
1 x PowerSwitch Tail II
1 x Bi-Color (Red/Green) 5mm LED
Jumper wires
CAT-5e cable

Arduino Libraries
You'll need a few libraries:

RTClib is used by the ChronoDot.
aJson is used to parse the JSON.
Time and TimeAlarms

This project is taken directly from Automating Aquaponics with Arduino.

Step 1: Wiring Diagram

The wiring is very straight forward.  Obviously the RTC breakout board in the graphic is not the ChronoDot but as there isn't a ChronoDot in Fritzing we used this as the graphic - the wiring is the same.  Also note the pin connections for the Arduino Mega to the RTC are not the same as they would be on the Uno.

The bi-color LED is used to indicate a successful connection to the web application.  When the connection is made, pin 8 is set to HIGH and pin 9 to LOW, which makes the LED green.  When the connection fails, the flow is reversed and the LED shines red.
<p>Nice, But I still don't understand the need for so many subroutines .. you should really spent some time on it.. </p>

About This Instructable




Bio: It's pronounced "Iowa Aquaponics".
More by IAquaponics:Arduino Aquaponics:  EnvDAQ Upgrade with pH and Dissolved Oxygen Arduino Aquaponics:  JSON Pump Controller Arduino Aquaponics:  Real-Time-Clock Part I 
Add instructable to: