Introduction: KS-Garden:Overview

KS-Garden can be used to irrigate/vent./light your garden/greenhouse plants in the backyard or your indoor grow box plants (Modular design)

The KS-Garden system consist mainly of the following modules

- Main system box

- Relais and power supply box

- 300 Watt LED grow light


The system consists of 4 sensors to measure the soil humidity of the plants. It has four pumps to provide water, each sensor controls one of the pumps.

Light and ventilation

It can turn on/off the grow light and it can, depending on temperature and humidity, in the grow box turn the fan on or off.

Step 1: Module 1: Main System Box

- Arduino Nano (The brain)

- OLED Display (To give information about the irrigation process, temperature and humidity)

- RTC (Real Time Clock)

- 4 Relais Module (To turn the four pumps separately on or off)

- 1 Relais (To turn the power supply to the humidity sensors on for measurement)


Every hour all four senors are connected to power up the sensors and read em out. If a configured value (Configuration:soilMoistureDryValue) is exceeded the according pump (according to the sensor) is starting to irrigate the plant for a particular time (Configuration:pouringTime).

At a defined time it gives the command to turn the grow light on (Configuration:lightOnHour) or off (Configuration:lightOffHour).

It measures permanently the humidity and temperature – if the humidity (Configuration:onHumidity) or temperature (Configuration:onTemperature) exceed a value the fan will be turned on. When humidity (Configuration:offHumidity) or temperaure (Configuration:offTemperature) fall below a defined value the fan will be turned off.

After every measurment period the measured values will be showed on the OLED display. The first four lines are the last measured values, and the last four lines are the date, time and measured value of the last irrigation turn.(every full hour)


Make sure the wires you use make really good connections. If they fit loos it will not work – usually you can feel it – when it goes just to easy over the pin.

Step 2: Module 2: Relais and Power Supply Box

- 12VDC cpu fan power supply

- 1 Relais to turn control the grow box fan

- 1 Relais to turn control light and cpu fans


The power supply box receives the signal D1 and D2 from the main system box. The D1 signal is the command to turn the grow lights on or off and the D2 signal ist the one to turn the grow box fan on or off.


Make sure work careful here you work with 230VAC. Only this Box has 230VAC. If not sure keep the ventilation on at all time – if the system is indoor it will be anyways always to hot and to humid.

Step 3: Module 3: 300W Self Made LED-Growlight (~70USD)


- 6 x 50W LED grow light chips

- 6 x CPU cooler

- Metallic board

- Chains and corners

- Wires and clamps


Gives the light for the plants to grow in the grow box. ;-)


Not much to do. Just buy a metallic board and drill the holes you need to fix the fans. (see picture). Just do not forget to paste some conducting paste between the 50W LED-Chips and the CPU coolers. Be careful!!! The LED-Chips are directly supplied by 230VAC from the power supply box. The fans need 12VDC and are supplied from the relais and power supply box. If not sure buy an ready made grow light

Step 4: Used Electric Components

Step 5: Schematic and Wiring

Step 6: Code

Check the code. There is a lot of description in it. You need to
take care of the Calibation and Configuration parts.

It is subdivided in the following themes:



Libraries, defines and initialisations

Input/Output pin definitions

Global variables

OLED display variables



Define pin types

Initialize pin types

Main loop

- Light

- Humidity and temperature

- Water

Step 7: Remark: Security

- There is one magnetic breaker installed in the trivet, shortly before the water would overflow it interrupts the power supply to the main system box.

- There is another magnetic breaker in the water supply barrel, shortly before the pumps would run dry it interrupts the power supply to the main system box.

- If the measured value of the sensor is unreasonably high or low (Values exceeding max and min limits of the calibrated sensor) the irrigation system assumes a wirebrake or short circuit and it will not start. For the first start you need to add some water manually.

Step 8: Remark: Safety

-Do use an earth leakage circuit breaker you are working with 230VAC. However I take no responsability on anything that can happen.

Step 9: Remark: Stumbling Blocks

- Use the capacitive humidity sensors the conductibiltiy sensors tend to corrode.

- Use at least a 9V power supply with only 5V your Relais might not have enough power to be switched on. Be also aware that the sytem might not work with USB-power only. You are able to upload the Arduino sketch but the power is to low to operate the relais.

- Do not place your water source higher than where the plants are - all water will move through the tubes to the plants without any pump activated - until the water level will be equalised.

- The system will not start to irrigate with unreasonable dry soil – you need to add water manually first to get a reasonable measuring value from the sensors.