The most exciting thing for someone new to monitoring, control and automation over the internet, is being able to manually turn something on or off using your computer, tablet or phone, from anywhere.

Inevitably, the next step is to automate the control.  Some automation examples include toggling the relay based on environmental conditions, sensor reports, time, GPS coordinates, motion detection or some combination of these.

We break down the uses of the Arduino in aquaponics to three main categories

    Monitoring.  Using sensors to monitor the environment be it air or water temperature, relative humidity, light levels, etc.
    Control.  Manually prompting an action, turning a pump on/off, grow light on/off, opening/closing windows, etc.
    Automation.  Combines steps one and two to use sensor readings to implement controls, without your input.

What kind of automation projects can the Arduino solve for aquaponics? Actually, there are many, but here are a few.

    Pump timer
    Backup pump triggered when primary pump died (true story).
    Automatically increase/decrease pump cycles on consecutively cloudy/sunny days
    Grow lights based on time of day, cloudy/sunny conditions
    Light shades on bright days
    Open/close greenhouse windows based on climate forecast
    Toggle Portable heaters or air conditioners
    Toggle light on when you enter greenhouse/basement/garage

No matter what intelligence you want to implement, it all starts with getting the relay talking to the internet and that is what this project is all about.  The webapp is bare bones except for an On/Off button.

The demos of our projects are found here:


How it works
The technique we are going to use is polling and is analogous to a child sitting in the backseat on a long road trip asking "Are we there yet?" every twenty seconds.  An Arduino will make a GET request to App Engine, which will query the datastore for the relay entity and return the relay's state property.  The Arduino will parse the response and trigger the relay pin HIGH/LOW.

The webapp is a simple image, whose class changes based on the the current state.  Click the power button image and it will toggle the class, create an AJAX request to the server which in turn will toggle the state property of the relay entity in the datastore.

Parts List
1 x Arduino Uno R3

1 x Arduino Ethernet Shield, R3

1 x Powerswitch Tail II

2 x breadboard male/male jumper wires

1 x Arduino wall wart (optional, for better power)

Software Versions

Arduino IDE 1.0.3

Google App Engine, Python SDK 1.7.4

Ubuntu 12.04

Python 2.7


The web application runs on Google App Engine.  Our previous Instructable, https://www.instructables.com/id/Aquaponics-Online-Temperature-and-Humidity/, discusses how to create an application.

This project is a part of the Arduino Data Acquisition and Control System described in more detail in our upcoming eBook, Automating Aquaponics with Arduino.

Step 1: Web Application Code

0.  Create a new application on Google App Engine.  We have a separate tutorial on our blog on how to do this so we don't have to repeat the same steps for every webapp project.

1.  The project code can be downloaded here.

2.  Extract the tar file in whatever directory you like.  I'll assume it's in your home directory.  If it's not, amend the instructions where necessary.

3.  The extracted folder is called 'IAquaponics_Relay' and inside are two folders, 'myapsystem' and 'arduino'.

4.  In 'myapsystem', open 'app.yaml' and amend the first line with the project identity you created in Step 0.

A cheaper and better alternative to "PowerSwitchTail" is a Wattstopper power unit which is UL approved, has zero voltage switching and as a bonus has DC output at about 150 mA to power your controller. One such unit (B-120 EP) is available from Amazon for about $15. - Enjoy.
Nice 'ible. <br> <br>I believe this system is running open-loop? For a closed-loop system you may want to change the color of the button not based on the commanded state but the actual state of the power downstream of the switch. This would require additional hardware that would set an input low/hi based on the sensed voltage which the arduino would use to set the button color. In this way one can detect failures, for example, loss of power due to a circuit breaker tripping, etc. <br> <br>Best Wishes
Thanks for the comment and you are quite right about the power state downstream. Even then, though, we've found it may not be enough to confirm the end device is working properly. A pump in aquaponics may turn on, yet not pump water (clogged), so we also use other sensors to confirm fluid flow as well. At the top-most level, this project code doesn't confirm the Arduino has even connected and read the relay entity. We meant this to be a Step 1 before posting those (more complex) tutorials.
Update 1: Fixed the link to the demos

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: