Raspberry pi controller for a simple hydroponics system.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore 👾 Added .gitattributes & .gitignore files Feb 6, 2016


Simple hydroponics system

A Raspberry-Pi based controller for a hydroponics system, turning the lights on and off at set times of day and running the pump every hour.


Parts list

  1. Raspberry Pi with a charger.
  2. A pair of relays for controlling the lights and pumps. An easy and safe (but certainly not cheapest) solution is to get two "IoT Relays" from Digital Loggers Inc..
  3. Ribbon cable and matching header for the Raspberry Pi GPIO, for connecting the relays.
  4. A pump, tubing, and valves for aerating the water. We used,
  5. Lamps for illuminating the plants. We used a 5 meter Toogod red:blue 4:1 LED roll, which gives 2.5 meters of LEDs (about 30 W) per container. You will also want two packs of the 15 cm connectors for these, and a power supply.
  6. IKEA TROFAST cabinet (yes, the toy storage one), to serve as frame, with two matching shallow storage boxes to hold the water, two lids to hold the plants, and two shelves for adjustable-height lighting.
  7. Baskets for the plants, approximately 3" in maximum diameter. Each TROFAST box can hold 8 baskets, for a total of 16.
  8. Clay pellets.
  9. Liquid plant food.
  10. Seeds to plant and starter plug to germinate the seeds before transferring them to the hydroponics setup. Or, seedlings to place directly in the setup.


  1. A 2.75" hole saw (for cutting holes in container lids).
  2. Soldering iron and solder (for soldering the LED strips).
  3. A utility knife (for stripping rubber insulation from the LED strips).
  4. Glue for the LED strips. The Toogod strips come with adhesive on the backside, but it is not sufficiently strong to hold their weight for more than a few hours.


  1. Assemble the IKEA cabinet.
  2. Cut seven 2.75" holes in each container lid. This is most easily done using a hole saw.
  3. Cut the LED roll into 14 strips of 7 segments each. (You will have two segments leftover. If you cut 7 strips, then 2 segments, and then another 7 strips, you will not have to cut through the manufacturer's solder, which appears every 10th segment.)
  4. Glue 7 LED strips to the backside of each of the TROFAST shelves and connect them in series using the connectors. Solder the connectors. (The connectors appear to work without solder at first, but in our experience fail after a couple of days.)
  5. Wire the electronics.
    • Plug the LED power supply into a relay driven by the Pi's pin 11.
    • Plug the pump power supply into a relay driven by the Pi's pin 13.
  6. Glue an airstone to the center of each container box.
  7. Assemble the aeration system: split the output of the pump into two tubes using the air connectors, then connect each tube to an airstone.
  8. Wash the pellets and use them to steady the seedlings (still on their pieces of starter plug!) in the baskets.
  9. Fill the storage boxes with a mixture of water and plant food, cover them with the lids, and place the baskets in their holes.

Figures needed

  1. Container lid with holes cut.
  2. Assembled lighting panel, with at least one connector open to show solder job.
  3. Assembled lighting panel, showing the "serial" nature of the circuit.
  4. Circuit diagram for the wiring?


There are two versions of the software.

  1. The basic version runs the pump and lights on a schedule, but does not provide any convenient interface for suspending operation.
  2. The web app version provides a Flask web application, accessible from the browser, which allows you to turn off the lights and stop running the pump for a period of time ("quiet mode"), and then resumes regular programming.


The basic version depends only on apscheduler, the Advanced Python Scheduler.

The web app version requires the apscheduler, Flask, and RPyC.


To have access to the GPIO, we need to run the application as root, so all of the packages must be installed into the sudo Python (rather than the user Python or some virtualenv).

  1. Install Flask via sudo pip install Flask.
  2. Install the Advanced Python Scheduler via sudo pip install apscheduler.
  3. Install RPyC via sudo pip install rpyc.
  4. Clone this repository.


After setting the values in config.py, run either,

  1. sudo python main.py & for the basic version, or,
  2. sudo python hydroponics_server.py &, followed by sudo python webapp.py &, for the web app version. The web app will be served at port 5000 by default.

Don't forget to do disown to keep the job(s) running after you log off.