Picture of 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.

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 for graphing, and future expansion will include sensors for water level and PH values for additional control.

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

The video below shows the script execution towards the end:

Remove these adsRemove these ads by Signing Up

Step 1: Materials


  1. IBC Shipping Container, prepared using instructions at

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


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

Step 2: Build IBC Aquaponics / Shed

Picture of 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 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

Picture of 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

Picture of 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 script:

cd ~
git clone

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

sudo python

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 script inside another screen command.

sudo python

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

any comment on why you chose pi instead of arduino?

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.

matthewh415 (author)  juanjosepimentel1 month ago

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


Hey juanjosepimentel, did you ever get around to making that web app? I'd be interested in checking it out.

I am interested in that as well! Perhaps I can assist being as I am a web developer as well.

danielh141 month ago

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

ignore me I was being a blonker

gundamdud4 months ago

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.

pwnage_5 months ago

Hi, what pump did you use?

matthewh415 (author)  pwnage_4 months ago

I'm using this pump from Amazon:

michaelgc6 months ago

Love the aquaponics, how is this going for you?

bestlife1236 months ago

The system architecture embedded code?

madmedix7 months ago

I like this too; the cold frame/insulation idea would increase your growing time. As an aside, a cold frame for the growing section and a couple of brewing heat belts might just guarantee year round comfort for the fish and food for you. For an auto feeder, there's a whack of instructables on feeding your cats hacking old VCRs etc.

Thanks for sharing!

xanxer827 months ago

I think anywhere north of TX, insulating the shed and adding a cold frame on top of the grow bed would be wise to do. Very cool project!.

SoHa SMART7 months ago

spectacular job...great detail and solid build design!

xarlock6679 months ago

Yes, but where is your fish launching cannon? What use are all these fish with no way to shoot them? LOLZ. No, seriously I love the idea of aquaponics. I was all set to turn our warehouse here in Houston into an aquaponics facility and try raising nile tilapia, tiger prawn, and blue crab and my boss pulled the plug. Grrrrrrrrrrrrrrrr.... Nothing like 2 weeks of wasted research to brighten your mood. One thing you might try is to make it into a streaming system. This is a similar system in most respects but creates an artificial channel in wich to raise the fish, rather than a stationary pond. It utilizes more space but nets more fish. (Pun intended). Anyway, good luck, and make a fish cannon. Fish cannons are kewl and make more efficient use of fish than merely throwing them back into the sea as some commercial trawlers do. Target? Why the fish trawlers of course. If anyone asks, it was a fish mutiny, NOT a fish cannon! You saw nothing!

Indeed! LOL!

ooterman9 months ago
Have you thought about adding a auto feeder that is connected to the system. With it connected you can have it stop feeding the fish during our short cold weeks. Also what part of texas?
matthewh415 (author)  ooterman9 months ago

Definitely - my wife is already getting annoyed with feeding the fish while I'm at work. I've looked for some commercial feeders that I could tie into, but I'm not finding many that are fully waterproof and hackable, so will likely build my own soon. San Antonio, TX

I was looking into a diy auto feeder and was thinking of a stepper motor that you would pulse with a digitally controlled voltage source. I am not sure if the PI can do that or if it can pulse the relays correctly to get the same result so I may have to use a microcontroller like a A-uno or something.

Good idea.

Also, should this be implemented, it would be a good idea to put in an inline water tester that tests for ammonia. nitrite and nitrate. If you notice spikes, it could automatically reduce feeding and alert operator by text message.

matthewh415 (author)  damionflynn9 months ago

That would be ideal... right now I'm sampling all those manually and it's another great automation opportunity. I've found a few digital probes for pH monitoring, but haven't seen any that can continuously sample for ammonia and nitrates... if you come across any please let me know!

There are numerous that test anything from PH, Temperature, TDS, Ammonia, Nitrite, Nitrate, Hardness (GH and KH) and even some that will monitor iron (important as you will almost always be adding iron to your system) and calcium as well as other trace minerals as well.

I do not have any specific examples but a quick search for them will return results.
Personally, I do not use them. As I am frequently checking AP and hydro systems all over the MS Coast, it is much easier for me to use strips or the API master kit when I am out at other locations.

stvgrc9 months ago

This is awesome. Very clean build. And what a great use of a Ras Pi.

plotlygraphs9 months ago


tim_n9 months ago

Fish being kept totally in the dark?

matthewh415 (author)  tim_n9 months ago

Not completely; I live in Texas which has daylight for most of the year and seeps in pretty well through the slats in the sides/door/access lid.

craftclarity9 months ago

Super clean implementation, and really nice build! Thanks for sharing this.