Introduction: Greenhouse Automation System (SAS)

In my country greenhouse gardening is widely spread. However, the methods that people are using to grow vegetables have not developed lately, therefore to harvest a decent amount of crops one has to work tediously by taking care of plants, as well as of climate conditions. This situation made me think how can I ease the life of a gardener and I end up designing an automation system for a greenhouse (SAS is the abbreviation of its name in Romanian language) .

First of all, I need to say that I do not own a greenhouse, so I started by gathering more information about them and about all that you need to do while growing something in them. I ended up talking to several farmers that are using their greenhouses as a source of income. They all came up with several features that, in their perspective, an ideal automation system would have (obviously those may vary in your region, but the advantage of this system is versatility, therefore you can easily adapt it to your needs)

  • It should be able to monitor and adjust, if necessary, such parameters as air temperature and humidity;
  • It needs to extend the day according to the ambient illumination level;
  • the system needs to measure the soil humidity and react accordingly;
  • It should be sustainable, versatile and easy to use;
  • And the most important one - it should require minimal changes of an existing greenhouse, hence it should interface such devices as water valves, fans, humidifiers and whatever equipment that could be installed in a common greenhouse.It also meant no WiFi/Ethernet, GSM capabilities, although it could be easily implemented.

Step 1: Parts You Will Need

Suppose you already have a functioning greenhouse, with a working irrigation system, "grow lights", fans, humidifiers and heating elements. You can build this system using either off the shelf parts like Arduino and different shields or you can make a custom PCB and build your system from the scratch.

For the Arduino-based unit you will need:

  1. Arduino Uno
  2. 16x2 LCD display
  3. DHT11 sensor
  4. Soil moisture sensor
  5. LDR as a light sensor
  6. Relay shield
  7. Power supply

For constructing the non-Arduino based system you will need:

  1. PCB
  2. ATMega328 with an Arduino Uno bootloader
  3. LM7805 voltage regulator
  4. 16x2 LCD display
  5. DHT11 sensor
  6. Soil moisture sensor
  7. LDR as a light sensor
  8. Push buttons
  9. LEDs
  10. Resistors
  11. Capacitors
  12. 10k potentiometers
  13. Relays
  14. NPN transistors (I used 2N2222)
  15. Various headers

For a more detailed part list consult with the schematics diagram in one of the following steps.

Step 2: Arduino Based System

To build the system using the Arduino Uno board just make the following connections:

  • LCD (RS-->D13, EN-->D12, DATA4-7 -->D11-D8)
  • signal of DHT11 to pin D7
  • LDR to A0
  • soil moisture sensor to A1
  • output to fan to D6
  • output to grow lights to D5
  • output to water pump/valve to A2
  • output to heater to A3
  • buttons to D2-D4

If you don't have LED indicators on your relay shield you can add some additional LEDs. I used software debouncing with a debounce delay of 10 ms. If you experience some problems with buttons you need to either increase the debounce delay or, to eliminate any possible glitch on a button press, you can connect those buttons via a RC filter with a small time constant. To recalculate the values of the RC filter you first need to measure the "bouncing" period of your buttons with an oscilloscope or an Arduino. Then just calculate the values of R and C to obtain a time constant that's greater than the "bouncing" period. The formula for the time constant of an RC filter is τ=RC. LDR and soil moisture sensor must be connected in a voltage divider configuration, if you don't know how to do that just look at the circuit diagram in the following step.

On the photos you can see the prototype that I made using mostly off the shelf parts, like Arduino board, Relay shield. When I saw that everything is working as expected I designed a custom PCB that met all my requirements. So moving on to the next step.

Step 3: Make Your Own Custom Board

I designed the system so it would be composed of 2 big boards: the main one (brains) and the relay board. I also made a board for the DHT11 sensor but I ended up soldering a 4.7k resistor directly to its pins. I designed the PCBs with only through-hole components, because I think that for a greenhouse SMD is overkill. You may notice that there is no FTDI or similar chip, therefore you will need a programmer or a USB to Serial device to program the chip. It is preferable to use a USB to Serial adapter, because you can use it during the calibration of your device.

Step 4: The Code

I used the Arduino IDE along with some Arduino-oriented libraries. You will notice that all the data is sent to PC over serial connection, this helped me a lot while debugging and calibrating the device. You can use it to calibrate yours, you will need to do that because of the different sensors, soil types, temperature preferences of the plants you are growing and the geographical region, as the light intensity varies. To ease this process I wrote a little application in C# that visualizes the received over serial data. Use this app to set everything up and then comment the lines referring to serial communication and re-flush the chip. It is required only to shut down serial communication, you can change climate conditions using navigation buttons.

Step 5: Final Notes

I must say that this system, once installed, in a greenhouse reduced the amount of the required work considerably. After the proper adjustments, there is actually little left to worry about.

A little about the equipment: you can use literally any valves, pumps, heaters, you only need to choose your relays accordingly. Instead of a heater you can connect a water valve to control the flow of a heated fluid through your system or, if your greenhouse is adjacent to your house, you can connect a fan that will blow warm air from your basement for example. As a light source I recommend "grow lights", on the output they don't have the whole visible spectrum, only the blue and red component. You can really see the effect of those bulbs, comparing to conventional fluorescent ones.

If you are growing only one kind of vegetables in your greenhouse, there is a possibility of programming optimal climate conditions, that will lead to a better vegetation. Hence, you can end up with a set of climate settings that you find more suitable for different plants. In this case consider sharing those settings with others, they will certainly work with any automation system.

Good luck growing stuff!


AshnieB (author)2016-02-17

how many volts is the power supply? And what can you do if you don't have a watering system yet ? I live in the tropics, so i don't need a heater

catherpiler (author)AshnieB2016-02-17

I used a LM7805 voltage regulator, the same one is used in Arduino boards, it means that the input voltage can be up to 35V, but it also implies that it should be no less than 7V. If you have a 5V power supply you can power this system directly, without the regulator. I strongly recommend you build a watering system, it helps a lot, but now, while you don't have one you can just comment all the code that you will not use, including the part with the heater.

AshnieB (author)catherpiler2016-02-18

What kind of soil moisture sensor did you use ? can i have more info about it like the voltage or something ? Can you tell me how your watering system works? Can i make it smaller for a small 'greenhouse'? It's for a school project.

catherpiler made it! (author)AshnieB2016-02-18

I used a sensor like the one in the picture below, but you can even make one yourself. It consists of 2 electrodes and is used to measure the voltage drop of the soil between those electrodes. This sensor is a passive component, it is a part of a voltage divider so it does not have any voltage requirements that I am aware of. For a small greenhouse I would recommend a basic watering system: a tank with water, an electric pump and some hoses to connect the sprinkles. The output from the relay should turn on the water pump. The position of the soil moisture sensor is very important, as the pump will be operated according to the soil moisture in that particular area, so try to distribute your sprinkles evenly and place your sensor in the most important area of the greenhouse. You can also change the code to use several sensors and moisturize only the "dried out" part of the greenhouse, but for a small greenhouse this is probably overkill.

dcp123 (author)2016-01-27

Thanks for this. I am dying to try to bring some sensor-based automation into my garden perhaps initially including some seasonal cold frames before working my way up to a small year-round greenhouse, which is mostly only needed for tropical plants in my climate.

katarina_1 (author)2016-01-27

the project seems very interesting and inspiring! good luck with its development and implementation!

wold630 (author)2016-01-26

Very detailed information. Thanks for sharing your instructable.