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:
- IBC Shipping Container, prepared using instructions at http://ibcofaquaponics.com/
Supervisory Control and Data Acquisition System:
- Raspberry PI Adafruit
- SainSmart 8-Channel Relay Module Amazon
- Brass Liquid Solenoid Valve Adafruit
DS18b20 Waterproof Temperature Sensors Adafruit
- Long range WiFi Adapter Amazon
Shed:
- 4x4s, 2x4s, 2x6, Cedar wood fence planks
Step 2: Build IBC Aquaponics / Shed
- The shed was laid on 25 1ftx1ft pavers on gravel/sand base.
- I followed the instructions/video detailed at http://ibcofaquaponics.com/ to build Aquaponics base and growbed.
- 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.
39 Comments
4 years ago
I'm currently attempting a similar build, but am having trouble with the solenoid valve. Did you need an external power supply for the 12 V drain? My understanding is that board only has 5V.
5 years ago
the cloud solution for aquaponics using raspberry pi is here: https://smart-hub.cloud/
6 years ago
Are you measuring ph in your system and if so what sensors are you using?
6 years 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.
6 years ago
Do you think sprinkler valves would in place of brass valves?
Reply 6 years 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.
9 years ago on Introduction
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.
Reply 8 years ago on Introduction
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.
Reply 7 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
Reply 8 years ago on Introduction
Hey juanjosepimentel, did you ever get around to making that web app? I'd be interested in checking it out.
Reply 8 years ago on Introduction
I am interested in that as well! Perhaps I can assist being as I am a web developer as well.
7 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
Reply 7 years ago
I too am curious about this. It would be great to monitor PH, nitrates and nitrites.....
7 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...
7 years ago
I keep gettng a syntax error on datetime.datetime.now () for cycle_count. Any suggestions?
8 years ago on Introduction
any comment on why you chose pi instead of arduino?
Reply 7 years ago
Because pi is awesome?
8 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
Reply 8 years ago on Introduction
ignore me I was being a blonker
8 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.