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.
- Raspberry Pi with a charger.
- 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..
- Ribbon cable and matching header for the Raspberry Pi GPIO, for connecting the relays.
- A pump, tubing, and valves for aerating the water. We used,
- 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.
- 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.
- Baskets for the plants, approximately 3" in maximum diameter. Each TROFAST box can hold 8 baskets, for a total of 16.
- Clay pellets.
- Liquid plant food.
- 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.
- A 2.75" hole saw (for cutting holes in container lids).
- Soldering iron and solder (for soldering the LED strips).
- A utility knife (for stripping rubber insulation from the LED strips).
- 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.
- Assemble the IKEA cabinet.
- Cut seven 2.75" holes in each container lid. This is most easily done using a hole saw.
- 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.)
- 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.)
- 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.
- Glue an airstone to the center of each container box.
- Assemble the aeration system: split the output of the pump into two tubes using the air connectors, then connect each tube to an airstone.
- Wash the pellets and use them to steady the seedlings (still on their pieces of starter plug!) in the baskets.
- Fill the storage boxes with a mixture of water and plant food, cover them with the lids, and place the baskets in their holes.
- Container lid with holes cut.
- Assembled lighting panel, with at least one connector open to show solder job.
- Assembled lighting panel, showing the "serial" nature of the circuit.
- Circuit diagram for the wiring?
There are two versions of the software.
- The basic version runs the pump and lights on a schedule, but does not provide any convenient interface for suspending operation.
- 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).
- Install Flask via
sudo pip install Flask
. - Install the Advanced Python Scheduler via
sudo pip install apscheduler
. - Install RPyC via
sudo pip install rpyc
. - Clone this repository.
After setting the values in config.py
, run either,
sudo python main.py &
for the basic version, or,sudo python hydroponics_server.py &
, followed bysudo 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.