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 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 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
- 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 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|
|Dry(>320)||HIGH||LOW(<100)||EMAIL 2.0 SENT|
|Wet (<270)||LOW||HIGH(>100)||EMAIL NOT SENT|
|Dry(>320)||HIGH||HIGH(>100)||EMAIL NOT SENT|
|Wet (<270)||LOW||LOW(<100)||EMAIL 1.0 SENT|
Table 3 Water Level Sensor functionality
|Water Level Sensor|
|HIGH(>100)||EMAIL NOT SENT|
|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.
In code A, we included 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.
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.
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.
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.
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”.
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 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 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.
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  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  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.
“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.
 “ESP8266 Overview”. Espressif Systems. Retrieved 2017-10-02.
 https://platform.favoriot.com/tutorial/, June 2018
 https://github.com/espressif/ESP8266_AT/wiki, June 2018
https://www.arduino.cc/en/Reference/SoftwareSerial, June 2018
 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/
[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 ]
IoT WEBINAR – The Key to Connect to Any IoT Platform – https://youtu.be/Wg_KMnNsch0
IoT WEBINAR – Connecting IoT Device to FAVORIOT – https://bit.ly/3eSgwgg
IoT-based Smart Manufacturing Monitoring and Controlling System – https://youtu.be/kqdxHJ0PsGc
IoT Based Weather Station by using Raspberry Pi 3 – https://bit.ly/2yz4JnN
IoT Automatic Plant Watering System – https://bit.ly/3d6QFRw
Flood Monitoring & Detection System Using Internet of Thing (IoT) – https://bit.ly/2X29gs7
Monitoring Water Leakage System – https://bit.ly/2ZEjLns
Measuring pH Values Using FAVORIOT and ESP32 – https://youtu.be/1J2R1F9VCDo
pH Sensor Using NODEMCU and OLED Display with Graph Output – https://bit.ly/3dgo78d
ModeMCU (ESP32) and DS18B20 Temperature Sensor With FAVORIOT Platform – https://bit.ly/3hbvDDq
NodeMCU + DHT22 with FAVORIOT Platform – https://youtu.be/fQ_uYh-bYOM
Distance Measurement Using Ultrasonic with OLED, Nodemc8266 and FAVORIOT Platform – https://youtu.be/p4R0zy8KpiE
Webinar – Kickstart Your IoT Journey with Favoriot Platform – https://youtu.be/myZpAvooBiY
Using Android MIT App Inventor With FAVORIOT – http://bit.ly/2URJUfN
MIT App – Favoriot MQTT Test – https://bit.ly/39gxqFT
Using Raspberry Pi With FAVORIOT – http://bit.ly/2SornGk
Using Arduino with FAVORIOT – http://bit.ly/37pcx6L
Using ESP With FAVORIOT – http://bit.ly/2SMg35S
Using React Native With FAVORIOT – http://bit.ly/2UQca2o
FAVORIOT Data Visualization Using React & Plotly.js – http://bit.ly/2SJjvyk
FAVORIOT Data Visualization Using Vue & Chart.js – http://bit.ly/2OSUsYr
Using LabView With FAVORIOT – http://bit.ly/37rVb9g
Using Nodemcu + DHT11 WIth FAVORIOT – http://bit.ly/31WokIS
Arduino Library for Updating Sensors Data to FAVORIOT Data Stream – http://bit.ly/31Qzfnn
NodeMCU (ESP32) & DS18B20 Temperature Sensor – https://youtu.be/ysgOB_6DScA
IoT Disinfection Tunnel – https://www.youtube.com/watch?v=TzfxRATKCJM
Favoriot Graphboard – How To Create a Public Dashboard – https://youtu.be/iXPpEOhqE38
How to Use Telegram Using FAVORIOT Platform – https://youtu.be/mkrlxWICBcY
HOW-TO Create Favoriot Developer Public Portfolio – https://youtu.be/Xp-45t8-Lhc
Become Favoriot Platform REFERRAL – bit.ly/platformreferral
List of IoT Projects by University Collaborators – http://bit.ly/2tRN9sC
Jom Pakai IoT Videos – http://bit.ly/38oqovC
IoT Tutorial Videos – http://bit.ly/2SplWqR
IoT Experiment Videos – https://bit.ly/3gNfWlR
Your IoT Journey eBook – http://bit.ly/youriotjourneyebook
Start Your IoT Journey with FAVORIOT [Videos]
Favoriot Platform v3 – HOW-TO Register an Account
Favoriot Platform v3 – HOW-TO Auto Create Hierarchy
Favoriot Platform v3 – HOW-TO Create Project
Favoriot Platform v3 – HOW-TO Create Application
Favoriot Platform v3 – HOW-TO Create Group
Favoriot Platform v3 – HOW-TO Create Device
Favoriot Platform v3 – HOW-TO Create Dashboard
Favoriot Platform v3 – HOW-TO ADD, RESIZE, EDIT, DELETE WIDGET
Favoriot Platform v3 – HOW-TO Add Graph Realtime and Historical
Favoriot Platform v3 – HOW-TO Change Dashboard’s Public Status
Favoriot Platform v3 – HOW-TO Create Rule Email
Favoriot Platform v3 – HOW-TO Enable Public Portfolio
FAVORIOT – How To Send Data Using Postman
FAVORIOT – How To Use RPC
FAVORIOT – How To Trigger Rule RPC
FAVORIOT – How To Trigger Rule HTTP