Instructables
Intro
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:

http://adacsprojects.appspot.com


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


Prerequisite

The web application runs on Google App Engine.  Our previous Instructable, http://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.
 
Remove these adsRemove these ads by Signing Up
globrite1 year ago
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.
maewert1 year ago
Nice 'ible.

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.

Best Wishes
IAquaponics (author)  maewert1 year ago
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.
IAquaponics (author) 1 year ago
Update 1: Fixed the link to the demos