Raspberry Pi Controlled Aquaponics

133,315

937

39

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

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Halloween Contest 2018

      Halloween Contest 2018
    • Furniture Contest 2018

      Furniture Contest 2018

    39 Discussions

    0
    None
    vunguyen390

    8 months ago

    the cloud solution for aquaponics using raspberry pi is here: https://smart-hub.cloud/

    0
    None
    bqbowden

    1 year ago

    Are you measuring ph in your system and if so what sensors are you using?

    0
    None
    bqbowden

    1 year ago

    I have wondered if electronic monitoring of my system could be easily done. Not fluent with pie but this looks like a project I could adapt to my needs.

    0
    None
    jacobsonr

    1 year ago

    Do you think sprinkler valves would in place of brass valves?

    1 reply
    0
    None
    matthewh415jacobsonr

    Reply 1 year ago

    No - I experimented with sprinkler valves first. What I found was that they required constant pressure to open and close, and since the drain didn't have much pressure they just stayed closed.

    Great project Matthew, I going to create mine at home. I forked your github project I going to transform your script into a web app. I going to add more features.

    4 replies

    I'll update this instructable soon. I've actually started using a dashing dashboard http://dashing.io/ which displays the data locally now. The timing scripts are all still executed through command line, since they don't change very often.

    Aquaponics_Dashboard.png
    0
    None
    lucypullenmatthewh415

    Reply 2 years ago

    Hi Matthew, you've got a great idea here. I'm writing to ask if you could you elaborate on step #3. I'm not sure about how to wire the components to the Pi. More detailed instructions would be great!

    Lucy

    0
    None
    MichaelH282

    2 years ago

    what about ph level monitoring and i am sure other items aside from water and air temp and cycle time of the water

    1 reply
    0
    None
    lucypullenMichaelH282

    Reply 2 years ago

    I too am curious about this. It would be great to monitor PH, nitrates and nitrites.....

    0
    None
    pablompole

    2 years ago

    trying to learn to code to add some rules... in the meantime I get :-

    File "status_Plotly.py", line 14, in <module>

    device_file_list = [glob.glob(base_dir + '28*')[0] + '/w1_slave',glob.glob(base_dir + '28*')[1] + '/w1_slave']

    IndexError: list index out of range

    any takers?

    the sensor is connected and working...

    0
    None
    Joshgreene24

    2 years ago

    I keep gettng a syntax error on datetime.datetime.now () for cycle_count. Any suggestions?

    0
    None
    danielh14

    3 years ago on Introduction

    hi for some reason it's asking me for your user name and password when I try and clone from GitHub, can you help

    1 reply
    0
    None
    gundamdud

    3 years ago on Introduction

    I love this setup and was wondering if it would be easy to use the same Raspberry Pi configuration for a normal Hydro system? I think the only addition would be adding light and fan control.