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!