Introduction: DIY Hydroponics - With Raspberry Pi
Hello!I am making this instructable to document my journey in making a Hydroponics Setup.
With schools shut, and the UK on lockdown, I thought, 'What better of a time than now to start a project?' so I set to work looking for ideas. I have had a Raspberry Pi laying around at home for almost three years now, without a proper use for it, so I wanted a project which I could integrate a Pi into.
With a prior intrest in gardening and plants, this 'Hydroponics' idea really caught my interest.
The concept is that you grow plants without using soil, and the result of this is very eco friendly: the produce tastes just as good, yet only 10% of the water using in traditional soil growing is used. This obviously helps to reduce our water usage as a society, and means that you can grow delicious, fresh fruit and vegetables from your own home.
A great thing about this is that not many materials are required, and the cost of building a setup like this is relatively low compared to other similar projects. I also figured that I could make good use of my Raspberry Pi in this project, and I will explain how very soon!
I would just like to make it clear that this is not a step by step instruction guide, but more a way for me to document my project and share it with others.
For this project I used:
- Raspberry Pi 2 B+
- Male to Female, Female to Female, and Male to Male jumper cables
- EC Meter
- pH Sensor
- Temperature Sensor
- LED Grow Light
- 4 Way Relay Module
- Solderless Connectors
- Submersible Water Pump (Hailea HX4500)
- Water Heater
- USB Wifi Dongle
- 2" PVC Pipe - I used around 2/3 meters
- 2x 2" 90° Bend
- 2" to 1" Reducer
- 2" End Cap
- 1" PVC Pipe - 1 Meter
- Scrap planks of wood
- 2" Pipe Clips
- 19mm Hose - Food Grade
- PVC Pipe Cement
- 2" Net Cups
- Clay Balls
- Lettuce Seeds
- Hydroponic Nutrients - Canna Aqua Vega
- Hydroponic pH Down - Phosphoric Acid
- Propagation/Seeding Tray
- Electric Handheld Cordless Drill
- Handheld Jigsaw
- Rough Sandpaper
- 44mm Hole Cutter
- Drill bits - For Pilot holes + Screwing
Step 1: What Is Hydroponics?
Hydroponics - the process of growing plants in sand, gravel, or liquid, with added nutrients but without soil. The hanging gardens of Babylon, the floating gardens of the Aztecs of Mexico and those of the Chinese are examples of 'Hydroponic' culture. Throughout the last century, scientists and horticulturists experimented with different methods of hydroponics. Later in the century, hydroponics was even integrated into the space program!
There are many benefits of Hydroponics. Below are just a few:
- The yields are much greater than in traditional, soil agriculture.
- Hydroponics give people the ability to grow in parts of the world where the soil just cannot support crops.
- It eliminates entirely the need for pesticide use, and as a result, makes our air, water, soil and food a large amount cleaner.
There are many different associated disciplines of hydroponics. Aeroponics is the process of growing plants where the roots are suspended in the air while nutrient solution is delivered in the form of a fine mist. Aquaponics combines aquaculture with hydroponics, and is where the excretion of fish is used as the plant's nutrients.
In addition to that, there are multiple different techniques which one can choose from when planning to do a hydroponics project.
In Static Solution Culture, plants are grown in containers of nutrient solution. The roots of the plant are suspended just above the solution, allowing enough oxygen to get to the roots. The resovoir for this technique may be as simple as a glass jar, or larger containers with enough space for multiple plants. In all cases, however, the resovoir should be either a dark colour, or have a cover over it, to prevent light getting in. If light does get in, there is the possibility for algae to grow, which takes nutrients away from the plants.
In continuous-flow solution culture, also known as the NFT or Nutrient Film Technique, the nutrient solution constantly flows past the roots. This is the method I will be using. This method gives you the ability to make changes to things such as pH levels, and EC (electrical conductivity) levels. We will go over these later. With this method, you must be careful to properly regulate the flow of water. A flow that is too fast will result in nutrient deficiency, and a flow too slow will also result in the same.
Step 2: Getting Started.
To get started, we first need to understand the fundemental parts of hydroponics. Without enough knowledge, your plants will not grow correctly, or will die.
When growing plants hydroponically, there must be a fine balance of many things.
- EC (Electrical Conductivity)
- Water Temperature
Lights - Plants, as you know, require light to photosynthesize. In the process of photosynthesis, plants convert light energy into chemical energy, which can later be released to fuel the organism's activities. Your plants should have around 12 hours of bright, artificial light, followed by 12 hours of darkness per day. The period of darkness is just as important as the light period, since plants, just like animals, need time to rest and metabolise.
There are three main branches of lights used by hydroponic gardeners: Compact Fluorescent Lighting (CFL); High Intensity Discharge (HID), including High Pressure Sodium (HPS) and Metal Halide (MH) bulbs; and Light Emmiting Diode (LED) lights. Each different type has it's own advantages and disadvantages.
HID Lights are full spectrum (This is light that covers the entire electromagnetic spectrum), can be used for both flowering and vegetative growth, and are very powerful lights. On the other hand, the bulbs wear out very quickly, use a lot of electricity, and have a high heat output requiring fans.
Fluorescent Lights give off low heat, they're relatively energy efficient, inexpensive, and very good for green leaf plants. However, they're not good for flowering or fruit producing plants, not full spectrum, and are not very powerful.
LED Lights are very low heat, last a very long time, and are very energy efficient. But they are expensive to purchase up front, although will save money in the long term.
Electrical Conductivity - EC is a measure of the amount of nutrients in the nutrient solution. An EC meter measures the potential for an electrical current to be transported through water. Plants obviously need nutrients to grow, but the concentration of these nutrients in the water must be finely tuned. For lettuce, an EC of between 0.8-1.2 is ideal for the plant. To adjust the EC, you should add diluted nutrient solution to the main resovoir, until you get the desired reading on your EC meter.
Power of Hydrogen - pH is very important for your plant's development and growth. For lettuce, a pH of between 6-7 works best. You can measure the pH using universal indicator, an electronic meter or pH strips. You can then change the pH with natural solutions such as lemon juice, which is acidic, or man made chemicals which can be purchased online or in gardening shops.
Water Temperature - A benefit of growing hydroponically, using the NFT technique, is that you have full control over many things, including water temperature. This means that you can adjust the environment to be just right for the plant. The perfect water temperature for many plants, including lettuce, is 20°c. The temperature can be controlled using an automatic water heater, purchased online.
Step 3: Choosing + Growing Seeds!
There are an abundance of vegetables and fruits which grow well in hydroponic systems.
For begginners, the easiest would be Lettuce. Lettuce is a very versatile vegetable, which copes well in sudden environment changes, and won't die instantly if the pH fluctuates too much. Among the easiest plants to grow are also: Tomatoes, Radishes, Kale, Cucumbers, Spinaches, Beans, Chives, Basil, Mints, Strawberries, Blueberries and Peppers.
Things like Potatoes, and Carrots are also possible to grow, but are harder. These plants are more suited to experienced growers, looking to try something new.
Once you have decided on what to grow, you need to get your seeds. Although you can buy these plants from garden centres across the UK, they end up as much healthier plants when they're grown at home from seed. The process should be started using soil, and depending on the time of year (if it gets very cold at night) can be grown either indoors or outdoors. Once the seedlings get their first set of true leaves, they're ready. It is recommended to plant 2-3 seeds in each area, to account for seeds which do not germinate. You can later thin them out, selecting the healthiest looking plants.
When I say 'true leaves' I am refering to the second set of leaves that develop on the seedlings shortly after they push above the soil. You will be able to see that the true leaves are in the shape of the leaves that will be there when the plant is fully developed.
Seeds can be germinated on a windowsill, however you will find that the produced seedlings will have very long stems, and they will not cope well when transplanted to the hydroponic system. When germinated under a grow light, the seedlings will be much stronger. Around 16 hours of light per day is ideal for the seeds.
Step 4: Integrating Electronics...
Previously, I said that I will be integrating my Raspberry Pi into this project.
I will be creating an online display, showing live data pulled from various sensors. For this, I will be using an API called Cayenne. This will allow me to access and control sensors, relays, and much more from anywhere in the world. Aside from that, I will create a python script to control the timing of the lights, using a relay module.
On the internet, visible at all times will be:
- The current pH of the water
- The current EC of the water
- The current Temperature of the water
This will be achieved by using a pH, EC and temperature sensor, wired up to a breadboard and raspberry Pi. However, it is sadly not as easy as that. The Raspberry Pi, unlike the Arduino, does not have any Analogue inputs. The GPIO pins will only read Digital signals. This means that the signal will have to be converted from Analogue to Digital using a board such as the MCP3008.
The goal of the script is to:
- Check the current time, from the internet
- Check whether the current time is between two parameters
- Adjust the relay module's status accordingly
Since the script is so simple, it didn't take long to figure out.
This is the script I will use.
In brief, the script gets the Date + Time library, for use in the script, so that it can be used later. It then gets the GPIO library, which will allow me to control the GPIO pins of my Pi later on. Next, the script sets the GPIO mode to BCM. This means that instead of having to use the exact pin number, I can just use the GPIO pin number, in this case 17. This is because some pins on the Pi are noti GPIO, meaning that they are permanently set to Ground, or 5V output for example.
It sets GPIO17 to out, meaning that I can control the signal which is leaving that pin. The script then defines 'Lights on' and 'Lights off' so that later, I will not have to manually write out the functions do. It checks the current time, and depending on where the time falls in the sequence, runs the predefined functions accordingly.
Step 5: Let's Build!
Using Scrap wood which I found laying around in the garden shed, I built a frame. This will support the pipe system, which is still to come. The most important part of this frame is the two struts, running from the top, down to the bottom. This is so important because this is what the pipe will be clipped to in the future.
I made this frame to fit the space it will live in - an unused outdoor bathroom, which had previously only been used for storing paint tins in. It comes out about 30cm, and is around a meter tall. The width is as large as it could be, to still allow the door to open fully without obstruction.
This is what worked for me, but there are many different structures which can be built, and serve the same purpose. If there was more space, I may have built an A frame, with room for pipe on both sides.