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
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.