MINISTRY OF EDUCATION AND TRAINING HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING ELECTRONICS AND TELECOMMUNICATION ENGINEERING TECHNOLOGY IO
Trang 1MINISTRY OF EDUCATION AND TRAINING
HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION
FACULTY FOR HIGH QUALITY TRAINING
ELECTRONICS AND TELECOMMUNICATION ENGINEERING TECHNOLOGY
IOT-BASED AUTOMATIC MONITORING AND CONTROL
SYSTEM FOR AGRICULTURE
LECTURER: DO DUY TAN STUDENT : DAO DUY TUNG
VO BANG TRANH
SKL 0 0 9 3 2 7
Trang 2
HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION
FACULTY FOR HIGH QUALITY TRAINING
- -
GRADUATION THESIS
IOT-BASED AUTOMATIC MONITORING AND CONTROL SYSTEM FOR AGRICULTURE
DAO DUY TUNG Student ID: 17141034
VO BANG TRANH Student ID: 17141146 Major: ELECTRONIC AND COMMUNICATION ENGINEERING TECHNOLOGY
Advisor: DO DUY TAN, M.Eng
Ho Chi Minh City, August 2022
Trang 3HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION
FACULTY FOR HIGH QUALITY TRAINING
DAO DUY TUNG Student ID: 17141034
VO BANG TRANH Student ID: 17141146 Major: ELECTRONIC AND COMMUNICATION ENGINEERING TECHNOLOGY
Advisor: DO DUY TAN, M.Eng
Ho Chi Minh City, August 2022
Trang 4THE SOCIALIST REPUBLIC OF VIETNAM
Independence – Freedom– Happiness
-
Ho Chi Minh City, July 27 th , 2022
ADVISOR’S EVALUATION SHEET
Student name: Dao Duy Tung Student ID: 17141034
Student name: Vo Bang Tranh Student ID: 17141146
Major: Electronics and Communication Engineering Technology
Project title: IOT-BASED AUTOMATIC MONITORING AND CONTROL
SYSTEM FOR AGRICULTURE
Advisor: M.Eng Do Duy Tan
EVALUATION
1 Content of the project:
- The team implements the content that meets the requirements set out initially
-The topic of designing a garden care system using IoT technology has been
implemented by many groups before
show before
- It is recommended to supplement the garden monitoring table in a certain period of time to evaluate the effectiveness
- Some images are not good quality
4 Approval for oral defense? (Approved or denied): APPROVAL
5 Overall evaluation: (Excellent, Good, Fair, Poor):
6 Mark: 8.2 (in words: Eight point two )
Ho Chi Minh City,
ADVISOR
(Sign with full name)
Trang 5HCMC University of Technology and
Education Faculty for High Quality training
Socialist Republic of Vietnam
Independence - Liberty – Happiness
Ho Chi Minh City, July 27 th , 2022
PROJECT ASSIGNMENT
Name of Members: Dao Duy Tung
Vo Bang Tranh
Student ID: 17141034 Student ID: 17141146
Training system: Regular university
Major: Electronics and communication engineering technology
Class: 17141CLA2; 17141CLS
I NAME OF PROJECT: IOT-BASED AUTOMATIC MONITORING AND
CONTROL SYSTEM FOR AGRICULTURE
II ASSIGNMENT
1 Content of implementation
- Present the theoretical basis of greenhouse models, wifi standards, protocols
UART, I2C communication
- Design block diagrams and schematic diagrams of the entire system
- Present and analyze the operating modes of the system
- Analyze and evaluate the resource usage of the design
- Provide general conclusions and development direction of the topic
2 Product
- Evaluation results on the real paradigm
III DATE OF RECEIVING TASK:
IV DATE OF TASK COMPLETION:
V ADVISOR: M.Eng Do Duy Tan
CHAIR OF THE PROGRAM
(Sign with full name)
ADVISOR
(Sign with full name)
Trang 6HCMC University of Technology and
Education Faculty for High Quality training
Socialist Republic of Vietnam
Independence - Liberty – Happiness
Ho Chi Minh City, July 27 th , 2022
PROJECT IMPLEMENT SCHEDULE
Name of Members: Dao Duy Tung
Vo Bang Tranh
Class: 17141CLA2; 17141CLS
Student ID: 17141034 Student ID: 17141146
Name of project: IOT-BASED AUTOMATIC MONITORING AND CONTROL SYSTEM FOR AGRICULTURE
1st
(7/3-13/3)
Meet Instructor to disseminate regulations:
choose topic, working time
2st
(14/3-20/3)
- Instructor conducts review of the topic
- Write a summary of the requirements of the selected topic: Reasons and objectives of the topic, design content, limited parameters of the topic
3nd
(21/3-27/3) Write the plan and detail outlines for the topic
4rd
(28/3-4/4)
- Design block diagram
- Design the principal diagram and explain the function of each block
5th
(5/4-11/4)
- Search for knowledge, information about the characteristics, temperature, and humidity of plants
- Find out the sensors used in the subject
Trang 7- Learn about how to program apps on smartphone phone
Complete schematic and layout of components
on the circuit board
- Implement, test and fix the Project
- Write the report
16th
(21/6-27/6)
Complete the report and send it to Instructor to review and comment for the last time before printing the report
17th
(28/6-4/7) Summit the report and slide PowerPoint
Trang 9ACKNOWLEDGMENTS
Foremost, our group would like to express our sincere thanks to the teachers in the Faculty
of High Quality Training During the time studying at the school, the teachers were dedicated to teaching and imparting to their group knowledge, experience and motivation
in the learning process
We sincerely thank to my advisor for his continued support and encouragement: M.Eng
Do Duy Tan We offer our sincere appreciation for the learning opportunities provided by
Trang 10TABLE OF CONTENTS
PROJECT ASSIGNMENT i
PROJECT IMPLEMENT SCHEDULE ii
DISCLAIMER iv
ACKNOWLEDGMENTS v
TABLE OF CONTENTS vi
LIST OF FIGURES viii
LIST OF TABLES xi
ABSTRACT xii
Chapter 1: INTRODUCTION 1
1.1 PROBLEM STATEMENT 1
1.2 OBJECTIVES 2
1.3 METHODOLOGY Error! Bookmark not defined 1.4 LIMITATIONS 2
1.5 RESEARCH CONTENT Error! Bookmark not defined 1.6 THESIS REPORT OUTLINE Error! Bookmark not defined Chapter 2: LITERATURE REVIEW 4
2.1 GREENHOUSE MODEL 4
2.2 INTERNET OF THINGS (IoT) 5
2.3.COMMUNICATION PROTOCOLS 6
2.3.1 UART 6
2.3.2 I2C 7
2.3.3 WIFI 9
Chapter 3: METHODOLOGY 12
3.1 HARDWARE DESIGN 12
3.1.1 System block diagram design 12
3.1.2 Circuit design and calculation 144
3.1.3 Hardware schematic 388
3.2 SOFTWARE DESIGN 400
Trang 113.2.1 Introduce about BLYNK APP 400
3.2.2 Design the user interface 411
3.2.3 Flowchart 446
Chapter 4: EXPERIMENT RESULTS 49
4.1 MODEL IMPLEMENTATION 50
4.1.1 Manual mode 533
4.1.2 Automatic mode 544
4.2 PLANTING EXPERIMENTS ON THE SYSTEM 555
Chapter 5: CONCLUSION AND RECOMMENDATIONS 622
5.1 CONCLUSION 62
5.2 RECOMMENDATIONS 622
REFFERENCES 633
APPENDICES 656
Trang 12LIST OF FIGURES
Fig 2.1. Realistic closed garden model 4
Fig 2.2 Realistic opened garden model 4
Fig 2.3 Applications of the Internet of Things 5
Fig 2.4 UART protocol format 6
Fig 2.5 Transmission frame 6
Fig 2.6 Receive Frame 7
Fig 2.7 I2C connections 7
Fig 2.8 Start(left) and Stop(right) condition 8
Fig 2.9 I2C data transfer bit 8
Fig 2.10 I2C address bit 8
Fig 2.11 The master sends data to slave bit sequence 9
Fig 2.12 The master reads data from slave bit sequence 9
Fig 2.13 Summary of Wi-Fi standards 9
Fig 3.1 Block diagram of the system 13
Fig 3.2 Honeycomb power supply 15
Fig 3.3 LM2596 Buck Converter 16
Fig 3.4 The schematic of LM2596 Buck Converter 16
Fig 3.5 Pin diagram of ESP32 Module 19
Fig 3.6 ESP32-CAM pinout 22
Fig 3.7 DHT22 sensor pinout 24
Fig 3.8 Soil moisture sensor 25
Fig 3.9 Arduino CNC Shield V3 27
Fig 3.10 Attach A4988 module to CNC shield and wire 2 step motors 28
Fig 3.11 Module Stepper Motor A4988 schematic 29
Fig 3.12 L298 Motor Driver Module 29
Fig 3.13 Schematic of L298 circuit 31
Fig 3.14 Relay module 32
Fig 3.15 Servo motor pinout 32
Trang 13Fig 3.16 How to control the motor's direction 33
Fig 3.17 TP-43D2033 Step motor 34
Fig 3.18 DC pump motor 35
Fig 3.19 16x2 LCD 36
Fig 3.20 I2C converter module for LCD 38
Fig 3.21 The schematic diagram of the whole system 39
Fig 3.22 Blynk App working diagram 41
Fig 3.23 The application store of the two platforms on smartphones 41
Fig 3.24 How to create an account on Blynk App 42
Fig 3.25 Create a project and device 42
Fig 3.26 Enter auth token, user name and password of Wi-Fi to program 43
Fig 3.27 Where to add widgets 43
Fig 3.28 Add the widget to the project 44
Fig 3.29 Configure the widget 44
Fig 3.30 The information displayed on the App 45
Fig 3.31 Flow chart of selection mode 46
Fig 3.32 Manual mode flow chart 47
Fig 3.33 Automatic mode flow chart 48
Fig 3.34 Flowchart of Image processing 49
Fig 4.1 Automatic Monitoring and Control System in Agriculture based on IoT 51
Fig 4.2 The system is covered by plastic film 51
Fig 4.3 The system is not connected to the network 51
Fig 4.4 The system is connected to the network 52
Fig 4.5 Camera captures live images 52
Fig 4.6 The sow seeds system is working 53
Fig 4.7 MANUAL Configuration Mode 54
Fig 4.8 The garden is in ideal condition 54
Fig 4.9 Set the temperature and humidity 55
Fig 4.10 The map of garden 56
Trang 14Fig 4.12 Select Auto mode and press the sow seed button 57
Fig 4.13 Seeding system is working 58
Fig 4.14 Water pump is working 59
Fig 4.15 Image of the garden after 36 hours of sowing 60
Fig 4.16 Image of the garden after 7 days of sowing 61
Trang 15LIST OF TABLES
TABLE 3.1 Parameters about power consumption of components 14
TABLE 3.2 LM2596 buck converter specifications 18
TABLE 3.3. The pinout configurations of the ESP32 module 19
TABLE 3.4 ESP 32 module specifications 21
TABLE 3.5 ESP 32 CAM specifications 22
TABLE 3.6. OV2640 specifications 23
TABLE 3.7 DHT22 specifications 25
TABLE 3.8. Soil moisture specifications 26
TABLE 3.9. Module steeper control A4988 specifications 27
TABLE 3.10.Number of step control 28
TABLE 3.11.Pin functions of L298 30
TABLE 3.12.L298 module technical specifications 30
TABLE 3.13.SG90 servo specifications 33
TABLE 3.14.The step requirement to reach desire length 37
TABLE 3.15.Water pump specifications 37
TABLE 3.16.Functions of the LCD’s Pins 38
TABLE 3.17 I2C module specifications 40
Trang 16ABSTRACT
Currently, with the development of 4.0, products or systems that remotely monitor and control smart gardens are becoming increasingly popular and appear to be necessary tools for keeping the garden in the best condition However, the market price of these gadgets is rather costly, making them difficult to obtain for farmers As a result, our team created the "Automatic Monitoring and Control System in Agriculture based on IoT"
to meet the need to monitor the environmental parameters of the garden, ensuring that the garden is always in the best condition, as well as cost more affordable to farmers and tree enthusiasts
The system has the following capabilities that can be controlled via a smartphone app Sensor data, device status, and camera images will be captured and continuously updated to the App The system has two operating modes: manual and automatic In MANUAL mode, users can actively control devices, turn them on and off as needed, regardless of environmental conditions, such as watering plants, turning on lights, turning fans on and off, and most importantly, selecting the sowing place and having the app irrigate automatically In AUTO mode, if the user activates the water pump or seeding button, the system will automatically water or sow seeds at all pre-programmed positions
In addition, the system also allows users to set temperature and humidity limits and from there the devices will operate based on environmental parameters
In this project, we tackle this problem by collecting data inside the greenhouse using ESP 32 and ESP 32 CAM, sensors, and actuators, signal processing from the sensors using programming, and controlling the actuator to keep the garden in the proper condition After that, the farmer can get real-time data on the smartphone The operating model is relatively stable, the operations on the application are easy, and the online image can be observed through the Camera
Trang 17Chapter 1: INTRODUCTION
1.1 PROBLEM STATEMENT
According to estimation, world population could reach to 9,8 billion in 2050, it would be 25% more than it is at the moment Urbanization would be increasing in tendency significantly in 2050, nearly 70% of world population are expected to be urbanize (compared to 49%) Agricultural productivity must double by 2050 to support this big metropolitan population [2] Crop production will become equally vital to industry, not only for food but crops such as cotton and rubber are also essential to the economies of many countries These demands place a further strain on already restricted agricultural resources
Internet of Things (IoT) is an important topic at the moment and the future of all thing and it is now changing life of everyone by doing everything smarter Internet of Things is also known as a vast network in which any computer or practically anything with
an IP address is linked to the internet or to another in order to automate operations or minimize human interaction smartphones, lights, watches, machine producing, cars, etc are some examples Beside its numerous benefits, there are three major issues with IoT is privacy violations, over-rely on technology leading to job loss [3]
The 4.0 industrial revolution offers a new approach to resolve this problem By developing the new green house using IoT, it will show a portrait of traditional agriculture
by enhancing plant productivity and minimize wasting crop The goal of this idea is not just revitalizing traditional farming methods but also to provide a solution for family home garden This product help farmers by collecting real-time data, monitoring the sensors and controlling the actuators to take care of the garden Precision plays a key role in agriculture
so that we could use the collected data from the sensors for analytics [4]
IoT technology in agriculture also has drawbacks, such as Wi-Fi signal relying, for example, if the system loses its connection with the Wi-Fi, the whole chain will be unable
to update the condition of the garden Beside, people may want some personal space in their lives so it is not easy to stay connected with family and friends but also provide them with every aspect of their functioning There is possibility that your data can be misused and this is another downside of IoT [6]
As previously indicated, the farmer can only monitor and care for a limited number
of planted crops using themes such as the "Closed Garden System" By inheriting foundation from the previous monitoring system The system can display temperature, humidity of th garden and control watering in closed range with smartphone Our group enhances it more in the situation when the connection is not available, user can set timer
Trang 18system" project describes a a garden system with a closed garden structure and irrigation based on settings on the web interface
1.2 OBJECTIVES
Research, design and manufacture “Automatic Monitoring and Control System in Agriculture based on IoT with the following fundamental features:
Research the theoretical basis of designing and constructing the garden
Research and analyze the planting seeds automation system
Design the seeding and watering system for each pre-programmed location, and integrated camera to easily monitor the garden remotely via smartphone device
Developing an automatic system based on temperature, humidity, and soil moisture monitoring
Designing the interface to monitor and control the devices on smartphones
1.3 METHODOLOGY
The thesis conducted research on the references related to garden monitoring and control systems to select the right system Evaluate latest automated garden design requirements Learn and develop the right design for the intended use Evaluate the results
of the simulation, conduct the actual modeling Make final evaluation and improve design results
1.4 LIMITATIONS
The limitations of this project are:
Using an ESP 32 as a controller, central microcontroller and a represent camera to transmit photos is not a good idea since the signal transmission speed and signal processing are quite slow and heavy depend internet bandwidth
The system is fully controlled via the app
The system responding depends on the strength of the Wi-Fi signal
Design a device’s model especially for educational purposes
1.5 RESEARCH CONTENT
As a product that has the function of controlling devices remotely via the Internet, for everyone especially for urban family If there is a need to control and monitor their garden
Trang 19conveniently, they could use this product due to automatically doing all the work such as: seeding, watering and monitoring all environment variables via smartphone Users can also set the condition for the system to work without having to get close to the system each time they need to do something
In order to design, construct efficiently and save money, the project has been through these following research forms: reading documents related to microcontroller programming to apply for writing programs on Arduino IDE, basic theory of electronics for hardware design
1.6 THESIS REPORT OUTLINE.
The project’s report is arranged into 5 chapters:
Chapter 1: Introduction: general introduction about the topic, methodology, research content, some facts relate to the topic in reality and introduce the quick view of content
In addition, the thesis also presents the topic's objectives and limitations
Chapter 2: Literature review introduce research status, research direction, services and applications being used
Chapter 3: Methodology: provides a general model of the system as a whole, the blocks
of the system, the design and calculation of each block, and the devices used in these blocks
Chapter 4: Experiment results: presenting the construction results of the system model
Chapter 5: Conclusion and recommendations: draw conclusions, strengths and weaknesses Present the plan of the topic in the future
Trang 20Chapter 2: LITERATURE REVIEW
or welded or screwed iron frames Plastic film is completely resistant to ultraviolet rays, sunlight, wind so its durability is quite high [7] Fig 2.1 as below, depicts a realistically closed garden
Fig 2.1 Realistic closed garden model
Opened greenhouse type: A type of house that is only covered mainly on the roof
or partially surrounded, mainly to reduce the harmful effects of rain and wind to help vegetables grow even in the rainy season No insect repellant effect [8] Fig 2.2, describes
a realistically opened garden
Fig 2.2 Realistic opened garden model
Trang 21Although there are undeniable advantages, the above models still have many limitations such as in the closed greenhouse type, it will create an environment with higher temperature and humidity than outside, from which if there is no strict monitoring measure,
it will be easy to mold, etc On the other hand, in the opened greenhouse, because it is not covered well, it is easy for insects to attack Moreover, the cost of installation and large investment is often many times the cost of traditional farming methods In addition, the monitoring and supervision system is still manual, with practical experience, so it will be difficult for those who do not have experience in farming
With the above shortcomings, in this project, the assemblers will retain the advantages
of the above methods and partially overcome the existing shortcomings such as the cost will be cheaper Additionally, there is a monitoring mechanism, monitoring via the Internet,
so it will be easier for users to stay away from the garden
2.2 INTERNET OF THINGS (IoT)
The Internet of Things could be a network of physical devices Kevin Ashton (1999) from the Massachusetts Institute of Technology proposed this idea and defined it as a network of things, including computers, mobile phones, refrigerators, doors, and cars that connect with one another and share data over the web There are similar technologies that are closely associated with IoT like Machine-to-Machine, the web of Everything, ubiquitous computing, and embedded Internet systems Physical things must contain microcontrollers and sensors so as to smartly connect with one another These microcontrollers and sensors will send data to an IoT cloud server that functions as a hub for data exchange [9]
The Internet of Things (IoT) could also be a technology that connects people with things and enables real-time communication and data exchange It is accustomed to record, analyze, and evaluate data important for decision-making or achieving target conditions
Fig 2.3 Applications of the Internet of Things
Trang 22The Fig 2.3, depicts the applications of Internet of Things is currently being used
in a variety of fields, including measuring the amount of sunlight, temperature, and humidity suitable for agriculture, turning home appliances on and off with a smart home mobile application over the internet, monitoring the amount of water and biogas, as well
as activating fire alarms in animal farms, providing flood warnings, and recording data Furthermore, the Internet of Things is becoming increasingly compatible with smartphones, which is increasing their popularity Blynk, NETPIE, and Line Notify are examples of smartphone applications that are simple to use and support the Internet of Things
2.3 COMMUNICATION PROTOCOLS
2.3.1 UART
UART stands for Universal Asynchronous Receiver - Transmitter means asynchronous serial data transmission The UART's purpose is to transform incoming and outgoing data into a serial binary stream Serial to parallel conversion is used to transform 8-bit serial data from a terminal computer into parallel data, and serial to parallel conversion is used to convert parallel data from the CPU This data is in modulating form and is transmitted at a specified baud rate
Protocol format
The UART initiates communication with a start bit of ‘0' as figure 2.4 describes The start bit initiates serial data transfer, and the stop bit terminates the data exchange It also has a parity bit (even or odd) The even parity bit is described by ‘0' (even number of 1's), while the odd parity bit is represented by ‘1' (odd number of 1's)
Fig 2.4 UART protocol format
Transmission
Fig 2.5 Transmission frame
Trang 23A single transmission line is used for data transmission (TxD) shows in Fig 2.5 above In this case, ‘0' denotes a blank space and ‘1' denotes a symbol condition While transmission, the LSB (Least Significant Bit) is often transmitted first The transmitter only delivers one bit at a time Following the transmission of one bit, the next bit is transmitted
As a result, all data bits are transmitted to the receiver at a predetermined baud rate Each bit would be transmitted with a slight delay To send one byte of data at 9600 baud rates, for example, each bit is sent with a 108 micro-second’s delay
Reception
The RxD line (Receiver) is used to receive data during reception is shown in Fig 2.6 After reading the data frame, the receiving UART counts the number of bits with a value of 1 and determines if the sum is an even or odd number If the parity bit is a 0 (even parity), the data frame's 1 bits can add up to an even amount If the parity bit is a 1 (odd parity), the data frame's 1 bits can add up to an odd amount
Fig 2.6 Receive Frame
When the parity bit matches the data, the UART knows that the transmission was free of errors But if the parity bit is a 0, and the total is odd; or the parity bit is a 1, and the total is even, the UART knows that bits in the data frame have changed
Fig 2.7 I2C connections
Trang 24The SCL and SDA signals make up each I2C bus SDA stands for data and SCL stands for clock The current bus controller generates the clock signal at all times; certain peripheral devices can push the clock low to prevent the controller from transmitting additional data
Interfacing condition
The start and stop sequences are unique in that they are the only times when the SDA (data line) will shift while the SCL (clock line) remains high as illustrated in the Fig 2.8 SDA must stay constant and not shift when SCL is high as data is being transmitted The start and stop sequences indicate when a contract with the slave system begins and ends
Fig 2.8 Start(left) and Stop(right) condition
Data transferring
For every 8 bits transmitted, each 8bit byte of data requires 9 SCL clock pulses to transmit If the receiving device returns a LOW ACK bit, it has received the data and is ready to accept the next byte as shown in Fig 2.9
Fig 2.9 I2C data transfer bit
If it responds with a High-level bit, it means it cannot take any more data and the master should stop the transfer by sending a stop sequence
Fig 2.10 I2C address bit
Normally, I2C addresses is 7 bits but the master still sends 8 bits when sending the 7-bit address The extra bit informs the slave whether the owner is writing to it or reading
Trang 25from it If the bit is set to 0, the master is sending data to the slave The master is reading from the slave if the bit is set to 1 The 7-bit address is put in the upper 7 bits of the byte, and the Read/Write (R/W) bit is located in the lower 7 bits (Least Significant Bit)
Fig 2.11 The master sends data to slave bit sequence
Bit R/W is set to LOW so master sends data to slave at 0xC0 which is illustrated in Fig 2.11
above
Fig 2.12 The master reads data from slave bit sequence
Bit R/W is set to HIGH so master reads data to slave at 0xC1 as shown in Fig 2.12
2.3.3 WIFI
Defined by an IEEE (Institute of Electrical and Electronics Engineers) technology organization It's a numbering system that's used to classify and unify a common standard for many different technical protocols The four common standards of Wi-Fi today are 802.11a/b/g/n [10]
Fig 2.13 below, is a summary of all Wi-Fi standards from 1999 to 2019, a summary
of the Wi-Fi standard name, release year, frequency, speed, indoor and outdoor range of each Wi-Fi type
Fig 2.13 Summary of Wi-Fi standards
Trang 26 802.11
o First introduced by IEEE in 1997
o Support for a maximum bandwidth of 2Mbps
o Uses the 2.4 GHz radio frequency
o Disadvantages: the amount of bandwidth is too low, leading to difficulties in data transmission
802.11b
Developed from the original 802.11 standard In July 1999, IEEE released a new standard, 802.11b
o Supports up to 11Mbps bandwidth and is correlated with traditional Ethernet
o Uses the same 2.4 GHz radio frequency as 802.11
o Appropriate for home networks
o The price is reasonable, and the signal is relatively good within the allowed range
o Disadvantages: The bandwidth is still limited, and interference is common due to the large number of devices that use the 2.4 GHz frequency band, such as cordless phones and microwave ovens
802.11a
o Created concurrently with the 802.11b standard However, the 802.11a standard is not widely used because of its higher cost and because of the widespread and rapid use of the 802.11b standard
o Enterprise network models are compatible
o Supports maximum bandwidth up to 54 Mbps
o Use a radio frequency of 5GHz
o Advantages: high speed, 5GHz frequency avoids interference from other devices
o Disadvantages: relatively high cost, narrow operating range and easy to be obscured
802.11g
o Released around 2002-2003 It is a combination of two standards 802.11a and 802.11b
o Maximum bandwidth support is 54Mbps; 2.4GHz frequency is recommended
o Advantages: high speed, large and better active signal range, less obscuring
Trang 27o Disadvantages: relatively high cost compared to 802.11b, devices using this standard can suffer from interference from devices using the same 2.4GHz frequency
802.11n
o Released circa 2009, intended to improve the 802.11g standard with total bandwidth supported by taking advantage of wireless signals and antennas (MIMO Technology)
o MIMO: uses multiple smart antennas to handle large data streams instead of a single antenna like other technologies by multiplexing and spatial division
o Maximum bandwidth support is 100Mbps
o Works on 2 frequency bands 2.4GHz and 5GHz
o Compatible with devices using the 802.11g standard
o Advantages: fast speed, good signal range, good resistance to interference from other devices using the same frequency
o Disadvantages: relatively high cost
All Fi standards in Vietnam are used However, the most commonly used
Wi-Fi standards today are 802.11g and 802.11n But the most used is still 802.11n, operating
in 2 bands of 2.4GHz and 5GHz Moreover, there is some new devices manufactured in Vietnam already use 802.11ac or even 802.11ad standards However, this number is not much (although it is widely used in Western countries) and a part is not suitable for the limited network infrastructure in our country today
Trang 28Chapter 3: METHODOLOGY
3.1 HARDWARE DESIGN
This automatic garden is extremely useful for farmers who consider traveling to the greenhouse frequently are unnecessary In this system, a distant farmer is able to plant, pour water over areas as well as monitor crop quality by the mobility of the shower head which is integrated with the camera Moreover, the LCD display is required in order to show the necessary information to the user for the status of the garden such as temperature, humidity, and soil moisture In this design, this thesis selects related and appropriate parameters as below
3.1.1 System block diagram design
a Block diagram
The system consists of ten blocks assembled in many directions to create a stable operating system shown in the block diagram of Fig 3.1 The power block will power the entire system ESP 32 CPUs with ESP 32 CAM will automatically connect to pre-coded Wi-Fi and then receive data from sensors to continuously update to App blynk via Wi-Fi ESP32 CAM will upload images continuously with a certain delay to App blynk from which it is transmitted to App blynk After connecting, data will be displayed on the app and LCD in parallel with remote control on the app blynk through wifi for modules, drivers, fans, lamps, pumps as follows:
Trang 29Fig 3.1 Block diagram of the system
b Explain the function of blocks
Power Supply: This block provide electricity for all blocks include control actuator, camera, sensors, platform, screen and other working blocks
CPU: Gather data from the device then analyze and control the control actuator, and display on LCD and Blynk app
Server: Analyze the image getting from the camera and transfer that to platform block
Camera: Getting images from surrounding environment and transmit signal to modified images block
Platform (App): Communicate between analyze block and camera, was used to be the platform for display and storage, but now also allow users to operate and monitor the garden via Blink app on Wi-Fi
Display: Allow users to monitor environment variables on screen
Sensor: Gather environment variables to know the latest status of the garden
Actuator: Receiving signals from central control block and control speed and flow of the engine also the status of the device such as lights, fans and water pump
Trang 303.1.2 Circuit design and calculation
a Supply power block
Tab 3.1 below is a summary of all the equipment used in this project These include the device name, the number of each device, and the operating voltage and current consumed by the manufacturer of each device, from which proposed system calculates the power consumed and selects the appropriate source for the model
TABLE 3.1 Parameters about power consumption of components
Name of Part Amount Operating Voltage
Trang 31P = 60 W is enough to provide power for all blocks
Here the group select a 12V - 5A honeycomb set to ensure the continuity of the garden and restricting the use of batteries to lead to expensive cost
Power supply
The 12V 5A honeycomb power supply, also known as a 12-volt DC power supply, converts voltage from 110/220VAC AC to 12V DC to power working equipment Actual image of the 12V 5A honeycomb power supply as Fig 3.2 below
Fig 3.2 Honeycomb power supply
The feature of the honeycomb power supply as heat dissipation, overload protection, short circuit, and overvoltage protection are all possible features of the main device It also has high efficiency and a consistent output voltage within the permitted power limit (no voltage drops when large consumption current)
Trang 32Fig 3.3 LM2596 Buck Converter
Some features of LM2596:
1 The output voltage can be adjusted by the using the flat head turn the variable resistor
2 The converter could supply up to 3 amps of direct current load current
3 Heating shutoff and current limit are two methods of circuit protection
Fig 3.4 The schematic of LM2596 Buck Converter
The LM2596 is known for its high current rating of 3A It has many versions with fixed output voltage such as 3.3V, 5V and 12V But, the most famous is the LM2596-ADJ which has variable output voltage as Fig 3.4 shows above
Unregulated voltage is applied to pin 1 (Vin) through the filter capacitor to reduce input noise The ON/OFF pin or the trigger pin (pin 5) must be connected to ground to enable the IC If set to high, the IC will go into off mode and prevent leakage current This feature will be useful to save input power when operating on battery The feedback pin is
an important pin that sets the output voltage It senses the output voltage and based on the value of this output voltage, the switching frequency of the internal switch is adjusted to
Trang 33provide the desired output voltage Finally the output voltage is obtained through pin 2 through an LC filter
Calculate the output voltage for LM2596
The output voltage of the LM2596-ADJ can be controlled using the feedback pin Circuit diagram showing the feedback pin receiving the feedback voltage from a voltage divider made with resistors R1 and R2
The value of these R1 and R2 determines the output voltage of the IC The formula for calculating R1 and R2 is given below
Vout = Vref (1.0 + R2 / R1) (3.2) Here the value of Vref can be considered as 1.23V hence the formula becomes
Vout = 1.23 * (1+(R2 / R1))
Herewith,
R1 should be in range from 1k Ohm to 5k Ohm
R2 is required needing flat-head screwdriver to adjust resistance
For example, if the thesis requires Vout = 5V Follow formula (3.2) the R2 is:
5 = 1.23 * (1+(R2 / 1.21*1000)) R2 = ~3.7k Ohm
So it is required needing to turn varible resistor and measuring it output voltage that equal
to 5V
Tab 3.2 shows some details of the LM2596 circuit such as the input voltage from 3V to 30V, the output voltage can be adjusted through rotating resistor R2 and the power
of the circuit is 15W
TABLE 3.2 LM2596 buck converter specifications
Name of component Descriptions
Input voltage 3V to 30V
Output voltage Adjustable from 1.5V to 30V
Maximum Response Current 3A
Efficiency 92%
Trang 34Wattage 15W
Dimension 45*20*14 (mm)
b Central processing block
ESP 32 module
Currently, ESP32 is a progression of minimal expense, low power consumption on
a chip microcontroller with integrated Wi-Fi and dual mode Bluetooth It is intended to accomplish the best performance and RF execution, robustness, adaptability, and dependability in a wide assortment of uses, for example, voice encoding, music streaming and MP3 decoding [12]
ESP32 is equipped for working dependably in mechanical conditions, with a working temperature going from – 40°C to +125°C Fueled by cutting edge adjustment hardware, ESP32 can progressively eliminate outside circuit blemishes and adjust to changes in outer conditions [12]
ESP32 provides a complete and closed Wi-Fi network solution; It can be used for application storage or offloading Wi-Fi network functions from other application handlers When the ESP32 stores the application, it starts up directly from the external flash In addition, it can connect to other controllers that need a Wi-Fi connection by connections such as SPI, I2C or UART [12] So, in this system, ESP32 acts as a central processor The
Fig 3.5 below shows the actual image of the ESP32 module, and the pin diagram
Trang 35Fig 3.5 Pin diagram of ESP32 Module
Tab 3.3 describes the specifications of the pinout configuration of the ESP32 module, including parameters such as pin category, pin name, and more details
TABLE 3.3 The pinout configurations of the ESP32 module
Pin Category Pin Name Details
to 3.3V by the on-board regulator
3.3V: To power the board, a regulated 3.3V can be applied to this pin
GND stands for ground pins
Enable EN The microcontroller is reset using the pin and
Trang 36Tab 3.4 describes the specifications of the ESP32 module, including parameters such as type of microprocessor, maximum operating frequency, operating voltage, analog input pins, digital to analog converter pins, digital input/output pins, direct current on I/O and 3.3V pins, number of SRAM, the standard type of communication, Wi-Fi and Bluetooth
Input/Output
Pins
GPIO0 to GPIO39 There are 39 GPIO pins in total, which can be
utilized as input or output pins 0V (low) and 3.3V (high) voltages (high) However, pins 34
to 39 can only be utilized as inputs
Capacitive
Touch pins
T0 to T9 These ten pins can be utilized as touch pins,
similar to the ones found on capacitive pads
RTC GPIO
pins
RTCIO0 to RTCIO17 The ESP32 may be woken up from deep sleep
state using these 18 GPIO pins
Serial Rx, Tx TTL serial data is received and transmitted
using this device
External
Interrupts
All GPIO An interrupt can be triggered by any GPIO
PWM All GPIO Any GPIO may be modified to work as PWM
through the software, and there are 16 distinct channels available for PWM
VSPI GPIO23 (MOSI),
GPIO19(MISO), GPIO18(CLK) and GPIO5
(CS)
Used for SPI-1 communication
HSPI GPIO13 (MOSI),
GPIO12(MISO), GPIO14(CLK) and GPIO15 (CS)
Used for SPI-2 communication
Trang 37TABLE 3.4 ESP 32 module specifications
c Image processing block
ESP 32 CAM
The CAM is a tiny camera module that costs about $10 and uses the
ESP32-S microprocessor It has an integrated OV2640 camera, a few GPIOs for connecting peripherals, and a microSD card slot for storing photos captured with the camera or papers
to be provided to clients [13] The pinout and picture of the ESP32-CAM are displayed in Fig 3.6
Name of component Descriptions
Microprocessor Tensilica Xtensa LX6
Maximum Operating Frequency 240MHz
Operating Voltage 3.3V
Analog Input Pins 12-bit, 18 Channel
DAC Pins 8-bit, 2 Channel
Digital I/O Pins 39 (of which 34 is normal GPIO pin)
DC Current on I/O Pins 40 mA
Trang 38Fig 3.6 ESP32-CAM pinout
The development board module ESP32-CAM is 27 mm by 40 mm in size It frequently integrates with a camera framework that includes an ESP32 module The ESP32-CAM can be widely used in a variety of IoT applications It is suitable for Internet
of Things applications such as wireless industrial control, smart home devices, and more The development board is perfect for IoT applications [8]
The pinout configuration of the ESP32 CAM's pinout is described in detail in Tab 3.5, which also includes information on the device's size, RAM, Wi-Fi standard, interface support, TF card support, UART baud rate, image output format, antenna, security, power supply range, and operating temperature
TABLE 3.5 ESP 32 CAM specifications
Name of component Descriptions
Size 27*40.5*4.5 (+-0.2) mm
RAM 520KB SRAM
Wi-Fi 802.11 b/g/n
Support interface UART, SPI, I2C, PWM
Support TF card Maximum 4GB
UART baud rate Default 115200 bps
Image Output Format JPEG only (OV2640)
Antenna Onboard PCB antenna, gain 2dBi
Security WPA/WPA2
Power Supply Range 5v
Operating Temperature -20*C – 85*C
Trang 39The pinout configuration of the OV2640 Camera is described in detail in Tab 3.6, with information on parameters like resolution, array size, power supply, power consumption, maximum image transfer rate, sensitivity, S/N ratio, dynamic range, pixel size, dark current, fixed pattern noise, image area, package dimensions, output format, shutter type, color filter array, and ISP functions included
TABLE 3.6 OV2640 specifications
Resolution 2 megapixels, UXGA SVGA and below
Array Size 1600 x 1200 (UXGA)
Power Supply
Core: 1.3V DC ± 5%
Analog: 2.5~3.0V DC I/O: 1.7V to 3.3V
Power Consumption
YUV mode full res & framerate: 125mW Compressed mode full Res & framerate: 140mW Standby:600μA
Maximum Image Transfer Rate 1600×1200@15fps, SVGA@30fps, CIF@60fps
Output Format YUV/RGB/Raw RGB Data
Shutter Type Rolling Shutter
Color Filter Array RGB Bayer Array
ISP Functions AE, AWB, Sharpness, Noise Reduction, Defect
Reduction, Gamma, Color Saturation, Special Effects
Trang 40d Sensor block
The sensor block's requirements state that it is in charge of gathering environmental parameters and delivering them to the central processing unit so that they can be processed and altered to best support the growth and growth of plants in the garden The group is interested in the ambient temperature, air humidity, and soil moisture parameters in this topic There are numerous options available for every characteristic, each with a wide range
of costs and features For instance, there are numerous possibilities for temperature measurement needs, such the LM35, DS18B20, DHT11, DHT22, or industrial sensors with extremely high temperature ranges and excellent accuracy In response to the demand for sensors that can track and detect changes in environmental conditions in an inaccurate, affordable, and easy-to-use manner
Therefore, this research has selected the following sensors:
Using the DHT22 sensor to measures temperature and air humidity With the requirement of measuring the humidity of the air, the DHT22 temperature sensor itself has a built-in feature, so the DHT22 sensor will be used
With the requirement of measuring soil moisture, this research uses a soil moisture sensor
DHT22 sensor
The air's temperature and humidity are measured using the DHT22 sensor The DHT22 sensor employs a 1-wire communication protocol The sensor features an 8-bit microcontroller for serial data output of temperature and humidity values as well as a specialized NTC for temperature measurement Figure 3.7 displays a picture of the DHT22 and its pinout
Fig 3.7 DHT22 sensor pinout
The DHT22 sensor can measure temperature from -40°C to 80°C and humidity from 0% to 100% with an accuracy of ±0.5°C and ±1% [14] More detailed information is described in Tab 3.7, in this table describes the DHT22 specifications such as operating