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 user’s 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 than the other innovations in the current market for watering plants is it’s 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 discussed how we the entire system works part by part, which included two main parts, offline watering system and online ESP8266 Wifi shield as well as FAVORIOT PLATFORM. Each parts will be discussed and explained in detail of 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 shown in Figure 1. This device helps the Arduino board connect to the internet and allow the integrating of data from the Arduino board using the FAVORIOT platform shown in Figure 2. The FAVORIOT platform is a platform which is compatible for 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 in the FAVORIOT platform.
The project is the integration of offline automatic plant watering system and the online IOT system. This is system is the beginner level of IOT system, which data are uploaded online to 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 FAVORIOT platform
Figure 3 Completed System
Figure 3 shows the completed set up 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, 3 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 connect 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 connect 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 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 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 shown all the AT Command of ESP8266 Wifi shield module that we applied to manipulate the ESP8266 Wifi shield module to perform various tasks, which included, reset wifi shield module, set the station mode of ESP8266, connect ESP8266 to internet via hotspot by its name and password, set a single TCP connection, send data and close TCP connection.
In Flow Chart 1, it show the steps of working of ESP8266, from resetting the ESP8266 wifi shield, establish TCP internet connection, recognizing the address, sending data to close TCP connection.
Whereas in Flow Chart 2, it has shown how the data is manipulated after its sent to FAVORIOT PLATTFORM. After the data are sent to FAVORIOT, it will be displayed in line graph, which is, soil moisture level and water level. Besides, two rules are set, if any the conditions are met, then it will send an email to the user to notify them of what is 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 be have maximum reading when the soil is dry, however, when the soil is wet, the reading of 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 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 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 serial monitor, the reading is exceeded 320, which indicate the plant is dry. Therefore, as shown in Figure 5, the water pump is activated and pump the water from 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 shown that we inserted the soil moisture sensor into a wet pot of soil, which the reading of soil moisture sensor is smaller than 270 and display in 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 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 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 uploaded 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, which 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 as well. Therefore for the first case, an Email 1.0 will be sent to the user, which shown in Figure 11. It will notify the user the water in water tank is running low, which carry a string message, “Your water tank is running dry”.
However, the other case which is the emergency case, is when water tank is running dry as well as 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 programming 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 room in the 64 byte serial buffer.
In Code B, we assign “OPPO F7”, which is the name of our hotspot internet, and “12345678”, which is the password of the hotspot internet, to be string of said and password. These two strings will be further used to connect ESP8266 to 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 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 threshold and limit to be the integer with value of 320 and 270 respectively.
In code D, we set up the ESP8266 Wi-Fi shield module and Arduino serial with 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 second of delay, void connect Wi-Fi() is called, as shown in Code F, to connected ESP 6288 wifi shield module to Internet using hotpots.
In this void reset, AT+RST command is used, to reset the ESP 8266 wifi shield module, after received response “OK”, 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 received response “OK”, the internet connection of ESP8266 Wi-Fi shield module is established, and serial monitor will print “Connected” to indicate the success of connection to internet.
Code G is the offline part of our project, which located under the void loop. Integer variable soil_1 is the reading of soil moisture level sensor which it 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 range of 0 – 1023 to 0 – 700 range.
After that, Soil moisture level reading and Water level reading will be printed in 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, which is the enable pin of 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 indicate 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 void loop, which will be executed after Code G. This part of code is to create a JSON format into variable data, which include 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 serial monitor.
Then, void httppost() is called and executed, and this void will be discussed further in Code I.
The objective of the project which is to make an automatic plant watering system which can alert the user from time to time was achieved. The overall system functioned well and an email could be sent when either the water tank level or moisture level is low. The only area that needed some improvement was the neatness of the project box.
However, this is just 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 in order to monitor the value of soil moisture level and water tank level and alter can be changed to be the notification of mobile phone application.
In future, a more completed project that can be done that, not only plant watering system,  but the whole smart housing system, which can include, door security lock system, a face recognizing security camera, smart temperature air conditioner, etc. Therefore, we found that there is plenty of possibility thing of housing IOT that can be done in future and improvement can be achieved.
 “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 ]