The team worked on the Arduino-based automatic plant watering system with a built-in pump and a water tank. This system is useful, especially for users who have a day job and travel a lot as this system can water plants only when necessary without any human intervention. What makes our project unique from the other innovations in the current market for watering plants is its built-in function which allows the user to be updated from time to time about the status of the system and plant.

In this report, we will further discuss how the entire system works part by part, which includes two main parts, the offline watering system and online ESP8266 Wifi shield, as well as the FAVORIOT PLATFORM. Each part will be discussed and explained in detail how it works and compiled together as a completed project.


For the automatic plant watering system, a moisture level sensor is attached to the soil of the plant and when the reading of the sensor is below the pre-set value, the pump will be activated. On the other hand, when the reading of the sensor is above the pre-set value, the pump will be deactivated. The pump will pump water from a built-in water tank. To update the user regarding the condition of the system, an Arduino-compatible shield known as the [1]ESP8266 ESP-01E UART Wi-Fi shield is shown in Figure 1. This device helps the Arduino board connect to the internet and allows the integration of data from the Arduino board using the [2]FAVORIOT platform shown in Figure 2. The FAVORIOT platform is a platform that is compatible with any Internet of Things (IoT) and can collect and store data from various sensors and microcontrollers. The user will be updated about the status of the system via emails, and graphs of the moisture level and water tank level will be displayed on the FAVORIOT platform.

The project is the integration of an offline automatic plant watering system and an online IOT system. This system is the beginner level of the IOT system, in which data are uploaded online to the FAVORIOT platform and displayed in graphs form and send a notification to the user for any unusual condition or emergency case happened, as shown in Figure 2 and Flowchart 2.

Figure 1 ESP8266 ESP-01E UART Wi-Fi shield

Figure 2 Basic functions of the FAVORIOT platform


Figure 3 Completed System

Figure 3 shows the completed setup of the project, which includes ESP8266 ESP-01E UART Wi-Fi shield, Soil Moisture Sensor, Water Level Sensor, 6-12V of the water pump, 12V relay, 7.4V Li-Po Battery, three pots of soil, water tank, breadboard, and Arduino UNO


  • ESP8266 ESP-01E UART Wi-Fi shield
  • Arduino Adjustable Soil Moisture Sensor + Soil Hygrometer Sensor
  • Liquid/Water Level Sensor Module
  • 6-12V Water Pump
  • 12V Relay
  • 4V Li-Po Battery
  • Breadboard Jumper Wire
  • Arduino UNO
  • Pipes
  • Breadboard
  • 3 pots of soil
  • Water tank


AT+RST Restarts the Module
Response – OK
AT+CWMODE=mode Set AP’s info which will be connected by ESP8266
Response – OK
1 means Station mode
2 means AP mode
3 means AP + Station mode
AT+CWJAP=ssid,pwd Set AP’s info which will be connected by ESP8266.
Response – OK
ssid: string, AP’s SSID (wifi name)
pwd: string, MAX: 64 bytes (wifi password)
AT+CIFSR Get local IP address.
Response – +CIFSR:IP_address +CIFSR:IP_address OK
IP address of ESP8266 softAP
IP address of ESP8266 station
AT+CIPSTART=type,addr,port Start a connection as a client. (Single connection mode)
Response – OK

type: string, “TCP” or “UDP”


addr: string, remote ip

port: integer, remote port

AT+CIPSEND=length Set length of the data that will be sent. For normal send (single connection).
Response – SEND OK

length: data length, MAX 2048 bytes


After the command is executed, “>” is returned to indicate ‘ready to accept data of specified length‘.

Send data of designated length. When data length defined by length is met, the transmission of data starts. If the connection cannot be established or gets disrupted during data transmission, the system returns: ERROR

If data is transmitted successfully, the system returns: SEND OK

AT+CIPCLOSE Close TCP or UDP connection.For single connection mode
Response – OK

Table 1: AT Command of ESP8266 that applied in the Project

Table 1 shows all the [3]AT Command of the ESP8266 Wifi shield module that we applied to manipulate the ESP8266 Wifi shield module to perform various tasks, which included resetting the wifi shield module, setting the station mode of ESP8266, connecting ESP8266 to the internet via hotspot by its name and password, set a single TCP connection, send data and close TCP connection.

Flow Chart 1, shows the steps of working ESP8266, from resetting the ESP8266 wifi shield, establishing a TCP internet connection, recognizing the address, and sending data to close the TCP connection.

Whereas Flow Chart 2, has shown how the data is manipulated after its sent to FAVORIOT PLATTFORM. After the data are sent to FAVORIOT, it will be displayed inline graph: soil moisture level and water level. Besides, two rules are set, if any of the conditions are met, then it will send an email to the user to notify them of what happened.


Flow chart 1: How to apply AT command to function ESP8266


Flow Chart 2: Function and role of Favoriot Platform


The functionality of the components is tabulated below in Table 1 and Table 2. The picture of the overall complete system is illustrated in Figure 3. The soil Moisture Level Sensor will have a maximum reading when the soil is dry; however, when the soil is wet, the reading of the soil Moisture Level Sensor will drop. The water level sensor will have its maximum reading when the tank is full and vice versa. Therefore, we can observe that whenever the water tank is low, an Email will be sent to the user. However, if the plant is still wet, Email 1.0 will be sent, and if the plant is dry, Email 2.0 will be sent to the user. Besides, the water pump functions as whenever the plant is dry until a certain limit, the water pump will receive a signal to pump water to water the plant.

Table 2 Soil Moisture Level Sensor functionality

Soil Moisture Level Sensor Water Pump Water Level Sensor Email
Dry(>320) HIGH LOW(<100) EMAIL 2.0 SENT
Wet (<270) LOW HIGH(>100) EMAIL NOT SENT
Wet (<270) LOW LOW(<100) EMAIL 1.0 SENT

Table 3 Water Level Sensor functionality

Water Level Sensor Email
LOW(<100) EMAIL 1.0 SENT

Figure 4: Soil Moisture Level Sensor sensed the plant is dry (>320)

Figure 5: Water pump received signal to pump water from the water tank

In Figure 4, we inserted the soil Moisture Level sensor into a pot of dry soil; as we checked the reading of soil Moisture Level sensor reading from the serial monitor, the reading exceeded 320, which indicates the plant is dry. Therefore, as shown in Figure 5, the water pump is activated and pumps the water from the water tank.

Figure 6: Soil Moisture Level Sensor sensed the plant is wet (< 270)

Figure 7: Water pump does not receive signal and will not function

Figure 6 shows that we inserted the soil moisture sensor into a wet pot of soil, and the reading of the soil moisture sensor is smaller than 270 and displayed in the serial monitor. Therefore, in Figure 7, the water pump does not work because there is no signal received by it to water the plant.

Figure 8: The reading of the Soil Moisture Level sensor and Water level sensor will be sent to FOVORIOT PLATFORM in a JSON string form from time to time in a particular device and account by using an API key.


Figure 9: After the soil moisture level and water level data are received, two-line graphs are plotted in the form of, Water Level or Soil Moisture Level vs. times and dates.


Figure 10: Soil Moisture Level and Water level sensor will change from time to time and will be monitored.

Figure 8 shows the result of uploading the data to FAVORIOT, the data will be uploaded from time to time and stored in FAVORIOT in string form. In our case, the reading of the soil moisture level sensor and water level sensor are uploaded and stored in the FAVORIOT. Furthermore, two graphs are plotted, as shown in Figure 9 and Figure 10, with the form of data (Soil moisture level/ water level) vs. times and date. Each time the new data is uploaded, the graph will have the changes. Therefore, the admin and user can monitor the condition of plant moisture level and water tank level from time to time.

Moreover, there are two emergency cases, shown in table 2, that might happen, which is when the water in the water tank is running dry as well as when the water is running dry, and the plant is dry. Therefore for the first case, an Email 1.0 will be sent to the user, which is shown in Figure 11. It will notify the user the water in the water tank is running low, which carries a strong message, “Your water tank is running dry.”

However, the other emergency case is when the water tank is running dry and when the water is running dry. This will cause a fatal consequence to the plant. Therefore, a strong notification will be sent to the user, which is Email 2.0, as shown in Figure 12. It carries a string message, “Caution !!!! Your water tank is running low, and your plant is DYING !!!!”.

Figure 11: Email 1.0

Figure 12: Email 2.0


In the Discussion section, the completed Arduino code is discussed and will be explained how the code is programmed to make the system function part by part.

Code A

In code A, we included [4]SoftwareSerial.h library. This will enable normal IO pins to be used as bit-bashed UART pins. This hardware allows Arduino to receive serial communication even while working on other tasks, as long as there is room in the 64-byte serial buffer.

Code B

In Code B, we assign “OPPO F7”, the name of our hotspot internet, and “12345678”, which is the password of the hotspot internet, to be the string of said password. These two strings will be further used to connect ESP8266 to the internet. Besides, we applied the built-in library function, Software Serial, to assign digital pin 2 and pin 3 to be the RX and TX, which are the receive pin and transmit pin.

Code C

In Code C, we assigned data as a variable of a String, variable x as integer, enb, pos and neg to be integers with the value of 5, 6 and 7, respectively. Besides, we assigned the threshold and limit to be the integer with values of 320 and 270, respectively.

Code D

In code D, we set up the ESP8266 Wi-Fi shield module and Arduino serial with a communication speed of 15200 baud using esp.begin and Serial.begin. We also assign enb, pos and neg pins, which are digital pin 5, 6 and 7 to be the output.

After that, void rest() is called as shown in Code E, with 0.5 seconds of delay, void connect Wi-Fi() is called, as shown in Code F, to connect ESP 6288 wifi shield module to the Internet using hotpots.

Code E

In this void reset, AT+RST command is used to reset the ESP 8266 wifi shield module, after receiving the response “OK”, the serial monitor will print “Module Reset”.

Code F

In Code F, we first applied AT+CWMODE=1 command to set the ESP8266 Wi-Fi shield module to function as a station mode. A string named cmd is created with AT+CWJAP=ssid, password command. After this command is executed and receives the response “OK”, the internet connection of the ESP8266 Wi-Fi shield module is established, and the serial monitor will print “Connected” to indicate the success of the connection to the internet.

Code G

Code G is the offline part of our project, which is located under the void loop. Integer variable soil_1 is the reading of soil moisture level sensor, which takes reading from Analog pin 2, A2, and integer variable water is the reading of water level sensor, which takes reading from Analog pin 3, A3. Then, we rearrange the reading of variable soil_1, soil moisture level sensor’s reading from 0 – 1023 to 0 – 700 range.

After that, Soil moisture level reading and Water level reading will be printed on a serial monitor in the form of “Soil value: “soil” ” and “Water level value: “water.””

Then we used if statement, that whenever the soil moisture reading is greater than the threshold level, which is 320, it indicated that the plant is dry. Digital Pin 5, the enable pin of the 12V relay, will be high to activate the water pump via the 12V relay. Digital Pin 6 and Pin 7 are set to one low and high for the 6-12 V DC water pump. However, when the soil moisture reading is below the limit, which indicates the plant soil is wet, then the relay enable pin, as known as Digital pin 5, will be set as low to turn off the water pump.

Code H

Code H is located under the void loop, which will be executed after Code G. This part of the code is to create a JSON format into variable data, which includes information of device developer ID, water level sensor reading, and soil moisture level reading. We will then print out the data and the data length in the serial monitor.

Then, void httppost() is called and executed, and this void will be discussed further in Code I.

Code I

Code J


The project’s objective was to make an automatic plant watering system that could alert the user from time to time. The overall system functioned well, and an email could be sent when the water tank level or moisture level was low. The only area that needed some improvement was the neatness of the project box.

However, this is the beginning of the Internet of things (IOT) project. There is plenty of future work that can be implemented in the future. We can develop a [5] mobile app to monitor the value of soil moisture level and water tank level, which can be changed to be the notification of the mobile phone application.

In the future, a more completed project can be done that not only plant watering system [6] but the whole smart housing system, which can include, a door security lock system, a face recognizing security camera, a smart temperature air conditioner, etc. Therefore, we found plenty of possibilities for housing IOT that can be done in the future, and improvement can be achieved.


Book Review

“Developing IoT Projects with ESP32” is a book that teaches you everything you need to know about secure data communication techniques for IoT projects using the ESP32 SoC. You’ll learn how to interface with different sensors and actuators and various display technologies. The book also covers cybersecurity, BLE technologies, and BLE mesh networking. You’ll work on a smart home project where nodes communicate over a BLE mesh, and you’ll learn about cloud connectivity and remote access to smart devices. The book explains how cloud platforms and third-party integrations can offer endless possibilities for your end-users, such as big data analytics and predictive maintenance. By the end of the book, you can develop effective, efficient, and secure solutions for your next wireless IoT project using ESP32.

Unlock the Power of IoT with My Free eBooks: Discover the Advantages, Challenges, and Solutions.

Are you looking to explore the world of IoT and learn more about its advantages and challenges? If so, my free IoT eBooks are the perfect resource for you!

Packed with valuable information and resources, my eBooks cover various topics, from the basics of IoT to more advanced concepts and tutorials. With my eBooks, you’ll discover the benefits of IoT and the tools and techniques you’ll need to develop your own IoT solutions and applications.

Whether you’re a developer, engineer, or just curious about this exciting new technology, my eBooks are an excellent resource for anyone looking to explore the world of IoT. You’ll find plenty of tips, how-to guides, and practical advice to help you build your IoT solutions and applications.

So why wait? Download my free IoT eBooks today and start exploring the limitless possibilities of the Internet of Things! With my resources at your fingertips, you’ll be well on your way to becoming an IoT expert in no time.


[1] “ESP8266 Overview”. Espressif Systems. Retrieved 2017-10-02.

[2] https://platform.favoriot.com/tutorial/, June 2018

[3] https://github.com/espressif/ESP8266_AT/wiki, June 2018

[4]https://www.arduino.cc/en/Reference/SoftwareSerial, June 2018

[5] Internet Of Things: The Role Of Mobile Apps. (n.d.). Retrieved from https://readwrite.com/2018/05/02/internet-of-things-the-role-of-mobile-apps/

[6] https://www.forbes.com/sites/forbestechcouncil/2017/06/06/best-smart-home-devices-and-how-iot-is-changing-the-way-we-live/#51aa2c1d43bd, 2018

[NOTE: This project is being done by Taylor’s University, our FAVORIOT’s University’s collaborator. Supervisor – Mr. Mohammad Taghi, Students – Kuan Jun Wei and Prishitha Kandasamu ]

About Favoriot

Favoriot is an IoT Startup company that began its operations in 2017 with the vision to “IoTise all businesses.” Favoriot offers a user-friendly IoT platform that has been used by more than 6700 developers from 121 countries worldwide. Favoriot also offers IoT training from Fundamental to Specialist to create a new “Generation-IoT” to fill the IR 4.0 talent gaps in the country. As a Malaysian-made technology, the Favoriot platform has now been used by the industry, government, and academia.
Subscribe to FAVORIOT Platform – http://bit.ly/favoriotplatform

    Start Your IoT Journey with FAVORIOT [Videos]

      Related Posts Plugin for WordPress, Blogger...

      Share This

      Share this post with your friends!

      %d bloggers like this: