I have always wanted to grow some indoor plants, to have a fresh source of herbs available in the house. Unfortunately, all the previous attempts to keep the plants alive for some time have been unsuccessful, as I travel regularly and can’t keep up providing them water (and sometimes I just forget, too). Therefore, I decided to put an end on this repeated “planticide” and bring some domotics in the flat at the same time.
This instructable makes use of an Arduino UNO to control a fully automated gardening system. The aim is to provide everything a plant needs to grow efficiently, with no waste, minimum human intervention, and eventually the plant survival, despite the questionable gardening skills of the owner. The micro-controller will regulate the right amount of light and water needed, using a moisture sensor and a real time clock (RTC).
Sloper's LED grow book (https://www.amazon.co.uk/LED-Grow-Book-Better-Easier/dp/1482697327) has been a great source of inspiration to develop and implement a working lighting system, rather than just an automated watering system. This has added extra complexity to the project, as the LED lights used are high power ones(1 and 3 W), therefore drawing too much current to be powered directly from the Arduino board. Two separate buck converters have been used to light the LED at their optimal voltage and current settings (failing to do so would reduce the amount of light the plant needs to absorb to start photosynthesis, affecting its growth).
When using the right light spectrum, the LEDs provide an artificial way of stimulating the chemical processes within plants. LEDs can be bought as a set of growing lights, or individually, and then assembled to obtain the best results for the type of plant owned. The latter is what I’ve done, initially using three different wavelengths: red(660nm), blue(460nm), and UV(380-390nm) LEDs. These are the main type of wavelengths absorbed by plants, and by far the most important for a healthy growth (Sloper, 2013). During the test process, I blown up the UV LED, therefore the final version makes only use of the red and blue ones. The LEDs are connected to the Arduino through a MOSFET, which I found out is a much more efficient way to apply high power components to Arduino, than the most common linear switch transistor. And the cool thing is that MOSFETs work in a very similar fashion, so you don't have to learn something completely new to implement them on your design!!
An important aspect of the plant well-being is related to the temperature and humidity in the environment, therefore a DHT11 digital sensor is used to assess whether the right conditions are in place. If not, an RGB LED turns from green to red, when the temperature is above or below a defined range, and from green to purple, when the humidity is above or below the predefined range.
A moisture sensor is also fit in the soil to measure its dryness, telling the Arduino when it’s time to trigger the watering system. The sensor is asked to sense the soil every hour. This is achieved through the use of the RTC mounted on the data logger shield, which allows to write logs into an SD card. The CSV log created can be easily read in a spreadsheet. The RTC also turns the LEDs on and off at set times of the day.
The watering system is made of a 12V solenoid valve, which is powered directly by the power supply, and it is controlled by the Arduino board using a MOSFET. Once the moisture sensor tests the soil and measures low moisture levels, the micro-controller will trigger the pump valve, letting the water pass through for few minutes, and then it will return to its stable position. A narrow silicon hose let the water flow from the tank to the pot.
The Arduino board is programmed to create the ideal daily light cycle for the plant, i.e. using the RTC to provide twelve hours of light and twelve hours of darkness. Too much light might inhibit the plant’s photosynthesis, so the right amount should be chosen accordingly. The plant used for the project is a strawberry plant, and it needs no more than twelve hours of light per day.
A big advantage of using LEDs over other conventional lighting, is that they don’t release much heat, even after prolonged usage. Therefore, no heat sinks are used to dissipate the heat.
Step 1: Design Choices
The main idea behind my project was to see if high power LEDs can actually work for growing plants indoor. The first concern was whether LEDs are already capable of emitting enough lumens as conventional lighting systems do. The biggest challenge posed by this type of LEDs was to provide them the right amount of current and voltage, and since they require high current to work properly, the Arduino itself wouldn’t be enough to power them. Therefore, two buck converters and a transistor had to be added.
To make the project more challenging and different from the ones that can already be found here on Instructables, I have then decided to introduce several elements to make the system self-sufficient. That is, a watering system controlled by a solenoid valve, which operates at 12V, and a moisture sensor that triggers the valve when the soil is dry. A temperature and humidity sensor has been introduced to tell the user whether the surrounding environment is adequate for the type of plant that he/she wants to grow. This is determined by an RGB LED that changes colour from green to purple if humidity is below or above a specified parameter, and from green to red, if the temperature is too high or too low.
To store all the information provided by the system while in operation, a data logger shield is attached to the Arduino UNO. The Real Time Clock installed on the data logger makes sure the time is always right to set the lights on and off at specific time of the day.
A cheap pot was used to set the strawberry plant. The LEDs and electronics holders were 3D printed using woodfilament, to have a nicer, lightweight, design. A power supply was also needed to power all the electronics independently from the micro-controller.
The following is a full list of the components used:
- Arduino UNO
- Data Logger with RTC shield
- DHT 11 Temperature and humidity sensor
- 12V solenoid valve
- Two MOSFET (IRFZ44 and 2SK2761-01)
- 5V Moisture sensor
- RGB LED
- Four 1W Blue LEDs
- Four 3W Red LEDs
- Two Buck converters
- Two diodes
- 12V 10A Power Supply
Several resistors and wires
Total cost: about 40£
Step 2: Lighting
As described earlier,the high power LEDs are the main part of the project. The ones chosen have been selected for being those that plants respond to in the best way. Blue and red are the main colours that plants can absorb, and this is due mainly to evolutionary reason. Since plants have developed under water for millions of years, blue and red lights were the only one to penetrate deep in the sea, therefore they were the only one that plants have learnt to use to do photosynthesis. Specifically, plants can best make use of a specific band of light waves, namely 660nm and 460nm. Ultraviolet light can also help in the growing process, but, as I said before, I managed to burn mine providing it too much current, therefore I couldn’t include it in the project.
The LEDs used for the project, namely 3W red and 1W blue, have been chosen to keep the costs on a budget, and due to the availability. Ideally, 5W LEDs should be used, but they are three times more expensive than the 3W ones. 3W blue LEDs had limited availability, meaning longer waiting times to be delivered, therefore 1W blue LEDs have been chosen.
To power the LEDs I bought a 12V power supply, which can provide up to 10A to the whole system. The LEDs have to be connected to two separate buck converters, one for the 3W red LEDs, and one for the 1W blue LEDs. Their operating max current and voltage differ considerably: 3W red LEDs require about 800mA and not more than 2.8V to operate efficiently; the 1W blue LEDs require about 350mA and up to 3.4V.
To tune the buck converters to a suitable voltage and current, two potentiometers are built on them, and they can be regulated using a small screw driver. I made use of a multimeter to test the outputs.
The buck converters are connected to the Arduino board through a IRFZ44 n-channel MOSFET, chosen over the more common TIP120 linear switch for its better power dissipation quality. I have initially tested the circuit using the TIP120, and noticed that it was releasing too much heat, with temperature well above 50°C after few minutes of operations. Definitely not good for a system that is meant to be on twelve hours a day!! Therefore, I have decided to swap it with a MOSFET, and even after prolonged usage (twelve hours of non-stop lighting), the temperature doesn’t go much above room temperature, so no heatsinks are needed, and stability of the whole system is guaranteed.
Step 3: Watering
The watering system is controlled by a solenoid valve, which has an operating voltage of 12V. This valves are not very popular and easy to find low cost from UK retailers. The one used was bought through a Chinese seller, and took few weeks to be delivered, slowing down the whole project.
This solenoid valve operates as a normally closed switch, which opens up when current pass through it. It has been attached to a small plastic tank, that can store up to 500ml of liquid, and it has been positioned vertically to make sure the water can flow without interruptions from the tank through the hose, and into the pot.
Due to its high operating voltage, the valve cannot be powered by the Arduino board. Instead, it is connected through a MOSFET in the same way as the high power LEDs, and it is powered directly by the 12V power supply.
Later I'll explain how to use the MOSFET.
Step 4: Assembly
To minimise the costs, most of the parts have been 3D printed using a wood filament which gives the system a natural look, and even smells good!!
Initially,the electronics components have been constructed and tested on a breadboard. Once the system was completed and was operating smoothly, the components have been soldered on a perforated board for permanent use.
The RGB LED has been attached to the 3D printed top to make the temperature and humidity feedback from the DHT11 sensor more visible. It is connected to the Arduino using three 2KΩ resistors.
Step 5: Software Implementation
The software written implements all the sensors and mechanical parts that have been described before. To achieve the final version of the programme, I had to divide it in several sub programmes, to individually test each component.
I started by learning how to implement a data logger shield and how to write some lines on an SD card. Once that step was achieved, I tried to write some information in the csv format, until I achieved some good results. The RTC built on the data logger uses an I2C interface, therefore the library wire.h must be used.
The second step was to tune the moisture sensor to provide analogue data instead of digital, in order to obtain accurate values. I found out that values over 700 indicate a dry soil, therefore this is the value used the software to trigger the solenoid valve.
To connect the high power LEDs and the solenoid valve to Arduino, two MOSFETs are used, instead of more common TIP120 transistors, for the reason explained earlier. The MOSFETs gates are connected to the Arduino UNO on pin 6 and 8, while sources are on ground. Drains are connected to the LEDs and valve grounds, so they are physically on an open circuit until the Arduino doesn’t deliver current to the MOSFETs gates, opening the drains and therefore closing the circuits and turning on the LEDs and/or the valve. The Arduino will set the LEDs pin 6 high at a specific time of the day, which is set using the function alarm.alarmRepeat() from the TimeAlarms.h library. Using the same function, the LEDs pin 6 is set to low at the end of the day, effectively turning the lights off until the next day. Using the RTC installed on the data logger will guarantee accurate time even after prolonged periods or current disruptions, thanks to the cell battery that powers the RTC autonomously.
Similar procedure is followed for the solenoid valve. Pin 8 is set low by default, creating an open circuit that keeps the valve off, so no water can pass through it. Once the moisture sensor reads a value over 700, pin 8 is set to high, and the valve will open, letting the water through for a specified amount of time, set by the irrigationTime variable.
The DHT11 reads temperature and humidity digitally. Its behaviour is interpreted by the DHT.h library, therefore it was very straightforward to implement it in the project. A dht type variable is used to read the temperature in Celsius and the humidity as a percentage. To provide a visual feedback, the RGB LED connected on pin 9,10, and 11 will change the colour accordingly to defined range of temperature and humidity, while stays green in normal conditions.
Step 6: Software Interface
The data logger is programmed to store the information retrieved by the Arduino in a SD card. The information are formatted in csv format for better clarity.
The csv saves humidity, temperature, and soil values every hour, while showing the same results on serial communication if the Arduino is plugged to a computer.
The following code is commented thoroughly and divided into sections to facilitate reading. The software makes use of several functions, all declared after the loop function rather than on different files to keep the programme easier to follow.
Step 7: Conclusion
It is safe to say that the project as so far achieved what it was meant to: after just two weeks the plant has raised threefold using only the artificial light provided by the high power LEDs, and the automated watering system. And couple of weeks after, it started flowering and the first fruits have appeared.
The main concern was the use of the 1W and 3W LEDS instead of more performing 5W, but the results are proving this design is more than enough at least for strawberry plants. Their only limitation is probably their angle of beam, which performs at its best when the plant is straight down the lights, but not as well when on the side. This can be seen by comparing the growth of the two plants I have pot at the same time.
The system has been operating continuously for the past weeks, and it has shown high stability overall. The data read by the sensors is stored on the SD card every hour, and it can be analysed at anytime.
A proper storage for the electronics components has yet to be made, and it will probably be one of the first things to work on when I'll have some more time.
In alternative to the expensive solenoid valve used here, a servo motor could be used as well to open up and block the hose at set intervals.
The moisture sensor implementation is probably not a good idea for low cost projects, since the materials used are not strong enough to stand high dampness of the soil for longer period before corrosion will compromise the analogue reading. A better design that will definitely be considered for future work will make use of the RTC and TimeAlarm.h library to trigger the solenoid valve at set intervals. Since the surrounding environment has stable temperature and humidity, it can be assumed that the plant will need regular watering every two-three days. This will reduce the complexity of the system and make the software simpler.
Hope this can be of inspiration for loads of interesting new projects, feel free to ask any question !!
Participated in the
Low Water Gardening Challenge 2016