Introduction: Raspberry Pi Controlled Aquaponics

Aquaponics /ˈækwəˈpɒnɨks /, is a food production system that combines conventional aquaculture (raising aquatic animals such as snails, fish, crayfish or prawns in tanks) with hydroponics (cultivating plants in water) in a symbiotic environment. In normal aquaculture, excretions from the animals being raised can accumulate in the water, increasing toxicity. In an aquaponic system, water from an aquaculture system is fed to a hydroponic system where the by-products are broken down by nitrogen-fixing bacteria into nitrates and nitrites, which are utilized by the plants as nutrients. The water is then recirculated back to the aquaculture system. http://en.wikipedia.org/wiki/Aquaponics

This build uses the IBC method of Aquaponics, with modifications to include a Raspberry Pi for controlling a pump, solenoid drain, and temperature probes for water and air temperatures. The relays and timing is controlled with python scripting. Temperature and control data is collected every minute and sent to plot.ly for graphing, and future expansion will include sensors for water level and PH values for additional control.

All of my scripts are available at github.com, feel free to use them for your aquaponics setup. Thanks to Chris @ plot.ly for the help with streaming data to their service, and to the amazingly detailed build instructions provided at IBCofAquaponics.com.

The video below shows the script execution towards the end:

Step 1: Materials

Aquaponics:

  1. IBC Shipping Container, prepared using instructions at http://ibcofaquaponics.com/

Supervisory Control and Data Acquisition System:

  1. Raspberry PI Adafruit
  2. SainSmart 8-Channel Relay Module Amazon
  3. Brass Liquid Solenoid Valve Adafruit
  4. DS18b20 Waterproof Temperature Sensors Adafruit

  5. Long range WiFi Adapter Amazon

Shed:

  1. 4x4s, 2x4s, 2x6, Cedar wood fence planks

Step 2: Build IBC Aquaponics / Shed

  1. The shed was laid on 25 1ftx1ft pavers on gravel/sand base.
  2. I followed the instructions/video detailed at http://ibcofaquaponics.com/ to build Aquaponics base and growbed.
  3. Shed frame was built with 4x4s, 2x4s, and 2,6 on top for supporting weight of growbed

Step 3: Wiring Raspberry PI

The raspberry Pi wiring uses three GPIO ports, two for controlling relays for the pump and drain, and another for reading the value of two Waterproof DS18820 temperature sensors.

GPIO 18: Relay Pump
GPIO 24: Relay Drain
GPIO 04: Temperature Probes

Step 4: Raspberry Pi Configuration and Controller Script

Prepare Raspberry PI:

Install Python and Python GPIO libraries:

sudo apt-get update
sudo apt-get install python-dev
sudo apt-get install python-rpi.gpio

Download controller and Plot.ly script:

cd ~
git clone https://github.com/matthewh415/PiPonics

Since this script will be running for several days, I recommend running in background process or using screen command.

screen
sudo python pumpController.py

Press Control-AD to exit screen command while controller script is executing.

To return to the session, you use the screen -list command to find screen ID, then screen -r <screen id>:

pi@aquaponics ~/Aquaponics/PiPonics $ screen -list
There is a screen on: 6614.pts-0.aquaponics (09/06/14 20:32:37) (Detached) 1 Socket in /var/run/screen/S-pi.

screen -r 6614

Once controller script is executing, start Plot.ly script inside another screen command.

screen
sudo python status_Plotly.py

Press Control-AD to exit screen command while plot.ly script is executing.