Project tutorial

Arduino Indoor Garden © Apache-2.0

In this project, I will make an indoor gardening system to take care of my sweet plant and its beautiful flowers.

  • 96 respects

Components and supplies

About this project

Gardening in the modern age means making things more complicated and arduous, with electrons, bits, and bytes. Combining microcontrollers and gardening is a really popular idea. I think that’s because gardens have very simple inputs and outputs that are easy to wrap your head around. I guess people (myself included) see a notoriously simple and relaxed hobby and can’t help but feel compelled to overcomplicate it.

In this project I will show you how to build a simpler version of indoor garden using an Arduino dev board.

I’m providing a full step-by-step guidance to show you how to make your own beautiful garden, and I'm explaining in details both hardware and software parts in order to turn this guidance the simplest way that leads you to try your own skills in electronic making. This project is so handy to make specially after getting the customized PCB that we’ve ordered from JLCPCB to improve the appearance of our car and also there is enough documents and codes in this guide to allow you create your automatic garden system.

We've made this project in just 7 days only, just three days to finish the hardware making and the assemble, then 4 days to prepare the code and the android app. in order to control the garden through it. Before starting let’s see first

What you will learn from this tutorial :

  • Choosing the right components depending on your project functionalities
  • Making the circuit to connect all the choosen components
  • Assemble all the project parts and start testing
  • Using the Android app. to connect through Bluetooth and start manipulating the system

Step 1: What Is an Indoor Garden!

Most plants have simple needs. As guests go, they're relatively undemanding. There are only three basic things you need to understand before you decide to invite a plant home: light, water and air. If you can master these four elements, from a plant's perspective, you can create an indoor garden just about anywhere in the world and during any season of the year.

  • Light - Most garden plants need at least six hours of light a day. But it has to be good light. If you put your hand in front of the window and it doesn't cast a shadow, chances are the light isn't adequate for most plants to live a happy life. However, you can always supplement low light conditions with grow lights.If you have modest natural light in your home and don't want to fuss with special lighting, stick to plants that normally need low-light conditions, or try moving your garden to a sunny windowsill.
  • Water - Plants need conditions close to those in their native habitats. A plant that calls the desert home will need less frequent watering than a plant that lives in a bog. Knowing what water conditions a plant prefers is a good first step to keeping a successful indoor garden. It's easier than you think because the plants themselves will often give you clues. Plants with thick rubbery leaves are water hoarders and can typically survive with less water than plants with thin, delicate leaves. If you hate to water your plants, choose varieties that can thrive on less, or pick plant-pots with hidden reservoirs to cut down on your watering chores.
  • Air - As a byproduct of photosynthesis, plants produce oxygen and filter nasty gasses, like formaldehyde, from your home environment via their leaves. To keep plants healthy, you need to keep their leaves clean and keep the air around them moving and moist. To do this, you can place them in a spot with good air flow or provide them with a small fan.

I will make an Arduino based system to supervise the temperature and humidity status of my plant and automatically provide its necessary needs like light intensity, water, and pure fresh air and in order to do this I need some sensors to control some actuators. For example I will control the light intensity depending on the signals received from the light brightness sensor the same for watering I used a moister sensor to turn on and off a water pump and temperature/humidity sensor for on and off controlling of a 12V DC fans.

Step 2: Sensors and Actuators

Making this system is the Assembling of some sensors and actuators in order to access the physical data arround the plant and to be able to find which thing is requested by the plant and when should you supply it.

This is the reason why you should use some sensors and actuators all connected to one Arduino board:


  • Light sensor BH1750 : BH1750FVI Is a Digital Light sensor , which is an digital Ambient Light Sensor IC for I2C bus interface. This IC is the most suitable to obtain the ambient light data for adjusting LCD and Keypad backlight power of Mobile phone. It is possible to detect wide range at High resolution.( 1 - 65535 lx ).
  • Soil moisture sensor : Moisture sensors that measure the resistance or conductivity across the soil matrix between two contacts are essentially junk. First of all, resistance is not a very good indicator of moisture content, because it is highly dependent on a number of factors which might vary from garden to garden including soil ph, dissolved solids in the water, and temperature. Second, most of them are of poor quality with contacts that easily corrode. For the most part you'd be lucky to get one to last through an entire season.
  • Temperature & Humidity sensor : The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing to grab data. The only real downside of this sensor is you can only get new data from it once every 2 seconds, so when using our library, sensor readings can be up to 2 seconds old.


  • Light white LED : A light-emitting diode (LED) is a two-lead semiconductor light source. It is a p–n junction diode that emits light when activated.[5] When a suitable voltage is applied to the leads, electrons are able to recombine with electron holes within the device, releasing energy in the form of photons.
  • Water pump : A pump is a device that moves fluids (liquids or gases), or sometimes slurries, by mechanical action. Pumps can be classified into three major groups according to the method they use to move the fluid: direct lift, displacement, and gravity pumps.Pumps operate by some mechanism (typically reciprocating or rotary), and consume energy to perform mechanical work by moving the fluid. Pumps operate via many energy sources, including manual operation, electricity, engines, or wind power, come in many sizes, from microscopic for use in medical applications to large industrial pumps.
  • DC 12V cooling fan : It is important to understand cooling techniques that can be used to preserve the life of your plant by moving fresh air arround the plant when it is required to keep the plant in a healthy conditions.

Step 3: The PCB Making (Produced by JLCPCB)


JLCPCB(Shenzhen JIALICHUANG Electronic Technology Development Co., Ltd.), is the largest PCB prototype enterprise in China and a high-tech manufacturer specializing in quick PCB prototype and small-batch PCB production.

With over 10 years of experience in PCB manufacturing, JLCPCBhas more than 200,000 customers at home and abroad, with over 8,000 online orders of PCB prototyping and small quantity PCB production per day. The annual production capacity is 200,000 sq.m. for various of 1-layer, 2-layer or multi-layer PCBs. JLC is a professional PCB manufacturer featured of large scale, well equipment, strict management and superior quality.

Back to our project

In order to produce the PCB, I have compared the price from many PCB producers and I chose JLCPCB the best PCB suppliers and the cheapest PCB providers to order this circuit. All what I need to do is some simple clicks to upload the gerber file and set some parameters like the PCB thickness color and quantity, then I’ve paid just 2 Dollars to get my PCB after 3 days only and I’ve noticed that there is some free shipping offers from time to time in this online ordering platform.

You can get the Circuit (PDF) file from here.

As you can see in the pictures above the PCB is very well manufactured and I’ve got the same PCB leaf shape that we’ve designed and all the labels and logos are there to guide me during the soldering steps.

Step 4: Ingredients

Now let’s review the necessary components for this project and you can find all the related links for an online ordering so we will need:

  • - The PCB that we've order it from JLCPCB

Step 5: The Assemble

Show All 9 Items

We are ready now so let’s start soldering the components and don’t forget to follow the labels to avoid soldering mistakes. We start by soldering Arduino connector to test the power supply and you can also write some basic test code to verify the right connection for each sensor like the Light sensor and its the same for the LEDs because they are all connected directly to the board (Arduino) so you have a full acces to them.

Note: You need to keep your soldering iron nice and clean. That means wiping it on the sponge every time you use it. The tip of your soldering iron should be clean and shiny. Whenever the you see the tip becoming dirty with flux or oxidizing, that means loosing it's shinyness, you should clean it. Even if you are in the middle of soldering. Having a clean soldering tip makes it A LOT easier to transfer heat to the soldering target.

The PCB that we ordered from JLCPCBwill guide you keep everything in the right placement so do not hesitate to visit this link if you want to view the PCB that we've made and make an online ordering.

As you can see, using this PCB is so handy because of its quality and for sure all the labels there provide the best guidance for you, so you will be 100% sure that you will not make any soldering mistakes.

I’ve soldered each component to its placement and you can use both sides of the PCB to solder you electronic parts.

Now we have the PCB ready and all the components soldered very well, after that I prepared this design to make a CNC laser cutting in order to insert the electronic part and the plant in one support, so if you want to make the same design as mine find the (DXF) files here

Step 6: The Android App.

This app will allow you to connect to your Arduino through Bluetooth, and using the Manual mode you can have access to the fans, and lights and also the water pump for ON and OFF controlling, without forgetting the sensors that you can read them data by pressing the “get data” button and all the appropriate data will be displayed on your smartphone screen.

You can get this android app for free from this link

Step 7: The Arduino Code and Test Validation

the code is available and as usual you can download it from this link. And as you can see in the photos the code is so simple and very well commented so you can understand it you own.

As you can see guys each button has a functionality with the system but what I really appreciate is the automatic mode for light brightness control I placed the light sensor at the lower base of the house then when we select this mode the system will control the brightness of the front light LEDs depending on the sensor signals. Also we can read the temperature and humidity values directly on the screen of the smart phone which is really impressive.


Arduino source codeArduino
 * - Author               : BELKHIR Mohamed              *                                               
 * - Profession           : (Developer) MEGA DAS owner   *                                                                                              
 * - Main purpose         : Industrial Application       *                                                                                 
 * - Copyright (c) holder : All rights reserved          *
 * - License              : BSD 2-Clause License         * 
 * - Date                 : 20/11/2017                   *
 * ***********************************************************************************************************************************************************************/
 /*********************************** NOTE **************************************/
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:

// * Redistributions of source code must retain the above copyright notice, this
//  list of conditions and the following disclaimer.

// * Redistributions in binary form must reproduce the above copyright notice,
//  this list of conditions and the following disclaimer in the documentation
//  and/or other materials provided with the distribution.


________________________________________________________________________________________________ (`v)
______________________________________________________________________________________________(`v)_____ (_.^._)(`v)
_____________________________________________________________________________________________ (`())_ (`v)___(`())
______________________________________________________________________________________________ (_.^._)_(`())___(_.^._)
______________________________________________________________________________________________ (`v) (_.^._) (`v)
___________________________________________________________________________________________ ___________
__________________________________________________________________________________________ (_.^._)
___________________________________________________________________________________________ (`v)
____________________________________________________________________________________________ (`())
______________________________________________________________________________________________ (_.^._)

#include "DHT.h"                                             // Include the dht library to interface with the DHT sensor
#include <Wire.h>                                            // IC library to use the light sensor
#include <BH1750.h>                                          // Import BH1750 library in order to be able to use the light sensor
//------------------------------------------------ Define the control pins --------------------------------------------------------
const int Pump=4;                                            // We've used this pin to control the motor pump 
const int Fan=5;                                             // Use this pin as a PWM output to control the Fan speed
const int Light=6;                                           // Use this pin in order to control the LED brightness
const int TempHum=7;                                         // Input pin for DHT sensor
const int Moisture=8;                                        // Digital Input pin to read the moisture command signals
const int TestLED=9;                                         // Use this output pin to test the right soldering on your PCB by turning on and off the test LEDs
const int Brightness=12;                                     // Input pin to read the light sensor signals
const int analogMoistue=0;                                   // Analog Input to read the analog signal from moisture sensor
#define DHTTYPE DHT11                                        // DHT 22  (AM2302), AM2321
DHT dht(TempHum, DHTTYPE);                                   // Temperature and humidity sensor constructor
BH1750 lightMeter;                                           // Light sensor constructor
char Data='x';                                               // Store Serial data in this variable
String cmd="";                                               // Read the full instruction sent from the android app
int flagModeAuto=0;                                          // flag to activate the auto mode
int sprayCMD=0;                                              // CMD limit spray
int LightCMD=0;                                              // CMD limit brightness
int lightLevelPlus=0;                                        // Variable to control the light brightness
float temperature=0;                                         // Variable to store the temperature value
float humidity=0;                                            // Variable to store the humidity value
uint16_t lux=0;                                              // Variable to read light brightness from the light sensor
//------------------------------------------------ Start the pin configuration --------------------------------------------------------
void setup() 
  Wire.begin();                                              // Initialize the I2C bus (BH1750 library doesn't do this automatically)
  dht.begin();                                               // Start the temperature and humidity sensor reading
  lightMeter.begin();                                        // Start the light sensor reading
  Serial.begin(9600);                                        // Set the baudrate up to 9600 BPS to comunicate with the android app through Bluetooth
  Serial.setTimeout(100);                                    // Set the time to wait for data before closing the Serial port (after 100 ms)

//------------------------------------------------ Start the Process code --------------------------------------------------------
void loop() 
  while(Serial.available())                                  // Read the serial data once available
  if(cmd=="dt")                                              // Send the humidity value to the android app                                 
  if(cmd=="dh")                                              // Send the brightness value to the android app
  if(cmd=="db")                                              // Send the temperature value to the android app
  if(cmd=="o")                                              // Activate the automatic mode
  if(cmd=="m")                                              // Disactivate the automatic mode
    if(cmd=="f")                                             // Turn ON the FAN
    if(cmd=="x")                                             // Turn OFF the FAN
    if(cmd=="l")                                             // Turn ON the Lights
    if(cmd=="k")                                             // Turn OFF the Lights
    if(cmd=="w")                                             // Turn ON the Pump
    if(cmd=="y")                                             // Turn OFF the Pump
  cmd="";                                                    // Clear the cmd variable to make it available for the next instruction
  lux = lightMeter.readLightLevel();                         // Get the brightness level from the light sensor
  temperature=dht.readTemperature();                         // Get the temperature value from the DHT sensor (C)
  humidity=dht.readHumidity();                               // Get the humidity value from the DHT sensor (%)
//------------------------------------------------ Auto control function for Pump spray --------------------------------------------------------
void autoPump()

//------------------------------------------------ Auto control function for Brightness LED --------------------------------------------------------
void lightBrightness()
      analogWrite(Light,lightLevelPlus);                         // Increase the light brightness
      lux = lightMeter.readLightLevel();                         // Read the light brightness level
//------------------------------------------------ Auto control function for FAN --------------------------------------------------------
void autoFan()
    analogWrite(Fan,255);                                        // Turn ON the fan if the temperature exceed 30C
    analogWrite(Fan,0);                                          // Turn OFF the fan if the temperature exceed 30C

Custom parts and enclosures

House DXF Files




Similar projects you might like

CPU and RAM Usage Monitor

Project showcase by thesahilsaluja

  • 8 respects

AWS - Arduino Weather Station

Project tutorial by GilettaStefano

  • 20 respects

Arduino Sunflower: An Electronic Sun-Dancer

Project tutorial by SURYATEJA

  • 10 respects

Backpack Alarm

Project tutorial by Tomi Chen

  • 28 respects

Arduino Based Security System

Project tutorial by Abishek Bhalaaji

  • 8 respects

Hiking Tracker

Project tutorial by Shahariar

  • 37 respects
Add projectSign up / Login