Uploaded by Enjy Aboelsoud

smart irrigation system

advertisement
Acknowledgement
Apart from our efforts, the project's success depends
largely on the encouragement and guidelines of many
others. Therefore, we take this opportunity to express
our
gratitude
to
the
people
who
have
been
instrumental in completing this project.
We want to extend our sincerest gratitude to the
supervisors,
Associate Professor Osama Orabi
and
Dr Hossam Elsheikh
for their guidance, supervision, providing necessary
information, and support in completing the project.
Finally, yet significantly, we also extend our heartiest
thanks to our parents, friends, and well-wishers for
being
with
us
and
throughout the project.
1|P a g e
extending
encouragement
Abstract
Automated irrigation systems are crucial for
sustainable agriculture and conservation of water
resources. The integration of smart irrigation
techniques with Internet of Things (IoT) and sensory
systems can help minimize water usage and reduce
environmental impact. The researchers have
incorporated Neural Network in optimizing water usage
in smart farms to achieve efficient soil and weather
monitoring and optimize irrigation systems. Smart
agriculture provides farmers with the opportunity to
efficiently manage water resources and approach
irrigation-related
activities.
Overall,
the
implementation of sensory-based irrigation systems is
beneficial for both researchers and farmers to better
understand irrigation techniques and achieve
Sustainable Development Goals (SDGs).
2|P a g e
CHAPTER 1 ........................................................................................................................................................... 7
METHODOLOGY ...................................................................................................................................................... 9
CONCLUSIONS ...................................................................................................................................................... 12
CHAPTER 2 ........................................................................................................................................................ 14
EMBEDDED SYSTEM ............................................................................................................................................... 15
HISTORY .............................................................................................................................................................. 16
COMPONENTS OF EMBEDDED SYSTEMS..................................................................................................................... 17
CHARACTERISTICS OF EMBEDDED SYSTEMS ................................................................................................................ 20
ADVANTAGES OF EMBEDDED SYSTEM ....................................................................................................................... 21
DISADVANTAGES OF EMBEDDED SYSTEM................................................................................................................... 21
BASIC STRUCTURE OF AN EMBEDDED SYSTEM ............................................................................................................ 22
CLASSIFICATIONS OF EMBEDDED SYSTEM................................................................................................................... 23
Performance of Microcontroller: ................................................................................................................. 23
Performance and Functional Requirements ................................................................................................ 24
ARDUINO............................................................................................................................................................. 27
history ........................................................................................................................................................... 27
Arduino ......................................................................................................................................................... 28
Arduino Usege .............................................................................................................................................. 28
Types............................................................................................................................................................. 31
Arduino - Hardware Design ......................................................................................................................... 32
PWM (pulse width modulation) in Arduino ................................................................................................ 39
SENSORS.............................................................................................................................................................. 40
Soil moisture sensor ..................................................................................................................................... 40
DH11 ............................................................................................................................................................. 46
Esp ................................................................................................................................................................ 51
CHAPTER 3 ........................................................................................................................................................ 57
DATABASE DEFINED ............................................................................................................................................... 58
STRUCTURED QUERY LANGUAGE (SQL) .................................................................................................................... 58
EVOLUTION OF THE DATABASE ................................................................................................................................. 58
TYPES OF DATABASES ............................................................................................................................................. 59
DATABASE SOFTWARE ............................................................................................................................................ 61
DATABASE MANAGEMENT SYSTEM (DBMS) .............................................................................................................. 61
MYSQL DATABASE ................................................................................................................................................ 62
CLOUD STORAGE ................................................................................................................................................... 62
TYPES OF CLOUD STORAGE ...................................................................................................................................... 62
BENEFITS OF CLOUD STORAGE .................................................................................................................................. 65
CLOUD STORAGE AND HIGH-PERFORMANCE COMPUTING.............................................................................................. 65
CLOUD STORAGE USE CASES .................................................................................................................................... 66
BACKUP AND RECOVERY ......................................................................................................................................... 67
USING DATABASES TO IMPROVE BUSINESS PERFORMANCE AND DECISION-MAKING ........................................................... 68
DATABASE CHALLENGES.......................................................................................................................................... 68
HOW AUTONOMOUS TECHNOLOGY IS IMPROVING DATABASE MANAGEMENT................................................................... 69
FUTURE OF DATABASES AND AUTONOMOUS DATABASES .............................................................................................. 70
3|P a g e
CHAPTER 4 ........................................................................................................................................................ 71
MOBILE APPLICATION ............................................................................................................................................ 72
TYPES OF MOBILE APPLICATION ................................................................................................................................ 72
THE MAIN PURPOSE OF MOBILE APPLICATION.............................................................................................................. 73
TYPES OF MOBILE APPS ........................................................................................................................................... 73
EXPLAINS MOBILE APPLICATION .............................................................................................................................. 74
THERE ARE SEVERAL TYPES OF APPS CURRENTLY AVAILABLE ........................................................................................... 75
ANDROID MOBILE APPLICATION .............................................................................................................................. 76
FRONT-END .......................................................................................................................................................... 76
CREATING AN ANDROID MOBILE APPLICATION ............................................................................................................. 77
WHAT ARE THE PARTS OF ANDROID STUDIO? ............................................................................................................. 85
Android Studio consists of ........................................................................................................................... 85
ANDROID VIEW .................................................................................................................................................... 91
USING THE VIEW IN ANDROID.................................................................................................................................. 91
TYPES OF ANDROID VIEWS ..................................................................................................................................... 91
ANDROID VIEW GROUP ......................................................................................................................................... 92
TYPES OF LAYOUTS IN ANDROID .............................................................................................................................. 92
ATTRIBUTES OF LAYOUT IN ANDROID........................................................................................................................ 93
WHAT IS THE BENEFIT OF ANDROID STUDIO? ............................................................................................................. 94
DESIGN APPLICATION.............................................................................................................................................. 95
radio button vs checkbox in android: .......................................................................................................... 99
CHAPTER 5 ...................................................................................................................................................... 100
PUMP CONTROL ................................................................................................................................................. 101
PUMP MONITORING............................................................................................................................................ 102
DIESEL PUMP MONITORING PARAMETER.................................................................................................................. 103
PUMP PREVENTATIVE MAINTENANCE REMINDERS .................................................................................................... 104
CHAPTER 6 ...................................................................................................................................................... 105
4|P a g e
FIGURE 1: EMBEDDED SYSTEM APPLICATION ................................................................................................................... 15
FIGURE 2: COMPONENTS OF EMBEDDED SYSTEM ............................................................................................................. 17
FIGURE 3: CHARACTERISTICS OF EMBEDDED SYSTEMS ....................................................................................................... 20
FIGURE 4: BASIC STRUCTURE ....................................................................................................................................... 22
FIGURE 5:CLASSIFICATION ........................................................................................................................................... 23
FIGURE 6:8-BIT MICROCONTROLLER. ............................................................................................................................ 23
FIGURE 7:32-BIT MICROCONTROLLER ............................................................................................................................ 23
FIGURE 8:EMBEDDED CAMERA .................................................................................................................................... 24
FIGURE 9 ................................................................................................................................................................. 25
FIGURE 10 ............................................................................................................................................................... 26
FIGURE 11 ............................................................................................................................................................... 31
FIGURE 12 ............................................................................................................................................................... 31
FIGURE 13 ............................................................................................................................................................... 31
FIGURE 14 ............................................................................................................................................................... 31
FIGURE 15 ............................................................................................................................................................... 32
FIGURE 16 ............................................................................................................................................................... 33
FIGURE 17 ............................................................................................................................................................... 34
FIGURE 18 ............................................................................................................................................................... 34
FIGURE 19 ............................................................................................................................................................... 35
FIGURE 20 ............................................................................................................................................................... 35
FIGURE 21 ............................................................................................................................................................... 36
FIGURE 22 ............................................................................................................................................................... 36
FIGURE 23 ............................................................................................................................................................... 37
FIGURE 24 ............................................................................................................................................................... 37
FIGURE 25 ............................................................................................................................................................... 38
FIGURE 26 ............................................................................................................................................................... 38
FIGURE 27 ............................................................................................................................................................... 39
FIGURE 28 ............................................................................................................................................................... 40
FIGURE 29 ............................................................................................................................................................... 42
FIGURE 30 ............................................................................................................................................................... 43
FIGURE 31 ............................................................................................................................................................... 43
FIGURE 32 ............................................................................................................................................................... 44
FIGURE 33 ............................................................................................................................................................... 45
FIGURE 34 ............................................................................................................................................................... 46
FIGURE 35 ............................................................................................................................................................... 46
FIGURE 36 ............................................................................................................................................................... 48
FIGURE 37 ............................................................................................................................................................... 49
FIGURE 38 ............................................................................................................................................................... 49
FIGURE 39 ............................................................................................................................................................... 50
FIGURE 40 ............................................................................................................................................................... 51
FIGURE 41 ............................................................................................................................................................... 52
FIGURE 42 ............................................................................................................................................................... 53
FIGURE 43 ............................................................................................................................................................... 53
FIGURE 44 ............................................................................................................................................................... 54
FIGURE 45 ............................................................................................................................................................... 55
FIGURE 46 : REGISTER SCREEN ..................................................................................................................................... 95
FIGURE 47 : LOGIN SCREEN ......................................................................................................................................... 95
FIGURE 48 : SPLASH SCREEN........................................................................................................................................ 95
FIGURE 49 : USER INTERFACE ...................................................................................................................................... 96
5|P a g e
FIGURE 50 : PUMP INTERFACE ..................................................................................................................................... 96
FIGURE 51 : SCROLL INTERFACE.................................................................................................................................... 96
FIGURE 52 : RESULT INTERFACE.................................................................................................................................... 96
FIGURE 53 ............................................................................................................................................................. 101
FIGURE 54 ............................................................................................................................................................. 102
FIGURE 55 ............................................................................................................................................................. 103
FIGURE 56 ............................................................................................................................................................. 104
FIGURE 57 ............................................................................................................................................................. 104
6|P a g e
CHAPTER 1
Introduction
7|P a g e
Chapter 1
The concept of precision agriculture, intended as site-specific crop management,
lately has been associated with the concept of smart farming. A “smart” system
permits an open, inclusive, systematic, inter and transdisciplinary system vision.
The “smart” concept applied in farming includes the employment of new digital
and high-tech technology and the creation of a localized community in which
these technologies have a meaning. Innovation, intended as a new idea or method,
is the cornerstone of smart farming. New forms of innovation cover all
dimensions of the agrarian production cycle, along the entire value chain. Those
innovations range from crop, input, and resource management, to organization,
marketing, and distribution. New technologies such as sensors, Decision Support
Systems (DSS), automation and robotics, collected data, traceability, and
blockchain are available to farmers for supporting and enhancing productivity.
However, some difficulties are accounted for in adopting PA and smart farming
solutions. Those obstacles can be summarized in two focal points. Firstly, there
is a lack of information on the advantages of applying smart farming instead of a
traditional way of production, as those advantages are not perceived. Secondly,
the significant amount of technology and data collection necessary in smart
farming can be challenging to manage.
For those reasons, a reference framework was created. The aim of this framework
is to suggest a methodology for farmers, experts, and other actors of the
agricultural sector. This methodology allows the orientation towards the multiplechoice offered by precision agriculture and smart farming to find the best
entrepreneurial and technological choice and solution. It is possible to summarize
this methodology in four steps:
Understanding the changes in action;
Identifying the added value of smart farming processes;
Verifying the reliability of new technologies;
Adjusting production processes.
8|P a g e
Chapter 1
METHODOLOGY
As previously stated, the present framework present four main aspect:
I.
II.
III.
The understanding of the change in action in the agricultural system. Those
changes, (environmental, economic, social and technical) affect greatly a
farm work and organization. In order to counter those challenge, the
introduction of PA and smart farming is necessary. However new smart
asset and new technologies in farm, in order to be efficient, require a great
amount of data and data collection, in particular with the application of a
multidimensional analysis that allows us to analyze and categorize several
dimensions. Multidimensional data are data that record information related
to several different units, called dimensions, for instance, soil, plants,
weather, etc. Such a process can help decision-making and planning
activities in farms . Therefore, in the methodology here proposed,
agronomical choices and objectives, all cultivation drivers, and the
knowledge needed to accomplish the objectives and use the drivers can be
classified in “layers”.
Identifying the added value of smart farming processes. Nowadays,
starting or renewing a new business in agriculture needs an entrepreneurial
approach and entrepreneurial tools that also consider social and
environmental aspects. One of the main tools that can be used, when a
farmer should approach its business, is the Business Model Canvas (BMC).
The Business Model Canvas describes the logic with which an organization
creates, distributes and captures value. BMC is composed of nine blocks—
the central one is the “value proposition”; on the right side, there are four
blocks focused on customer relationships, customer segments, channels,
and revenue streams, on the left side four blocks focused on activities,
resources, partners, and costs. In smart farming, BMC might be a tool to
help enterprises to understand how to invest in PA to develop economically
while also keeping an eye on social and environmental impact
Verifying the reliability of new technologies. The reliability of any
machinery and tool used in a farm have a great importance and influence
on how well, fast and uneventful a task is completed. In order to verify the
reliability of new technologies, the Technology Readiness Levels (TRL)
tool can be a valid instrument. The TRL tool assigns a scalar level from 1
9|P a g e
Chapter 1
IV.
to 9 to describe how mature a technology is. The technology maturity levels
(adapted from the original NASA one), go from level 1, as the lowest, to
level 9 as the highest. Another tool investigated and deemed necessary in
the application of this methodology is the Market Readiness Levels
(MRL). This tool allows a technology readiness evaluation of
commercialization and diffusion phases. MRL is based on a scale of 1 to
5, with 5 being the most diffused. However, it resulted necessary to
establish a third evaluation tool, the Local Ecosystem Readiness Levels
(LERL). LERL contains two important terms: on the one hand, the noun
“ecosystem” (apart from the biological context), which can be interpreted
as a complex network and interconnection between multiple entities. In the
agricultural technology context, an ecosystem can be described as an
aggregate of independent entities and interrelated factors to allow a system
innovation in the whole sector. On the other hand, the adjective “local”
strongly correlates to the ecosystem which needs to exist not only in the
macro-area but also in the local area Therefore, the LERL is a tool that
permits to evaluate the maturity level of the local ecosystem and to
establish at which point of the transformation road, from new product to
innovation, a new technology is located.
Adjusting production processes. The design thinking and the tools of “Lean
Production” or “Lean Farming” may be endorsed as decision support tools
also in the viticulture sector. The lean approaches, which are fundamentally
anthropocentric, realistic, and firmly based on waste management, have
been proven to be extremely compatible with companies sustainability
policies and activities. In this methodology are highlighted five main
categories regarding the driving factors that determine sustainable
organizational efficiency through the implementation of lean methods:
• Knowledge and training between workers and managers; as the
training of key staff with extensive and multi-disciplinary
knowledge which provides a broad view of the production processes
and consequently a better ability in problem-solving may ensure that
workers work independently and competently.
• Awareness of the operative context; the output outcomes of
operational management activities are influenced by the context in
which they are applied and must, therefore, be adjusted to the new
scenario to achieve the desired results;
• Organizational structure; the organization needs to motivate
workers, concentrating on more organized and responsible
10 | P a g e
Chapter 1
behaviour, using more appropriate equipment, pattern sequence, and
parallel working. Moreover the regularity of the planting layout
allows standardization of the settings of the machinery, a more
efficient use of resources, and a general optimization by reducing
downtime;
• Technology and decision support; the diffusion of technologies
involves minimal changes from an operational point of view (the
machines work intelligently supporting the management of the
workers), but is relevant from an organizational point of view
(changing in settings, maps elaboration, implements configuration);
so those technologies must be accompanied by effective
organizational processes and procedures in order to exploit their
potential to implement more sustainable practices;
• Implementing and cyclical enhancement of the adoption procedure;
the practical adoption of innovation through lean methodologies, as
highlighted in the previous paragraphs, includes assessments and
preparation of all the process elements: structures, plants, tools,
services, staff training, operational protocols. But it also need a
continuous improvement of the production process through a
cyclical sequence of stages: examine, identify, implement, assess,
check of the feedbacks.
11 | P a g e
Chapter 1
CONCLUSIONS
In adopting the smart farming methodology, data collection is an essential stage.
Database collections are a basic tool during the decision-making process and the
organization of operation and work in farms. However, driving data is a complex
process that requires knowledge and competences in order to acquire and
interconnect all the information present or provided in farms. The information
collected in a farm can come in different formats and sources. Mainly, in smart
farming, information comes from technologies and monitoring. For those
reasons, to understand the strategic importance of any information, in this
methodology, the layer concept is provided. In the layer concept, all the
information and all the data are classified and stratified in hierarchical levels, with
constraints and available resources at the bottom, and informatics/computing
technologies at the top, that gives the Agri-entrepreneur an overall picture of their
farm and a way to strategically use all the data and the information in the decisionmaking process. BMC tool application could help to focus on the value
proposition of the farm and then to point out the technologies needed to bring
added values for the farm outcomes. In agriculture, the TRL tool permits
evaluation of the maturity levels both of one technology and of a set of
technologies. This tool indicates innovative products’ (technology) readiness, but
it does not indicate the development of the infrastructure related to the
technology. That is why the MRL must integrate it. Indeed, this last tool can
provide the degree of the technology readiness for commercialization and
diffusion. However, even in this case, not all the variables that contribute to
turning an innovative product in a system innovation are taken into account. It is
in this perspective that the third evaluation tool (LERL) must be seen. This last
indicator aims to evaluate the maturity level of the local ecosystem, i.e., the chain
of infrastructures, actors, and formative system in each area or region. Moreover,
the LERL may establish at which point of the transformation road, from
innovative product to innovation, a new technology is located.
The increasing availability of agricultural technologies able to provide data
requires an exact integration process. Tools such as the Business Model Canvas,
the assessment of the TRL level and the restructuring of processes according to
lean and, most recently, lean plus green methods, offer advantages that allow
farms to acquire highly competitive margins.
12 | P a g e
Chapter 1
Priority criteria that determine the success of smart farming can be summarized
in the following points:
The agricultural progress in smart farming could offer huge possibilities to
enhance quality and profitability for the future agripreneurs
The enthusiasm for astonishing innovative products should be controlled, driving
the whole entrepreneur process in a shared system of territorial rural innovation;
Variability in type of farm, age of actors, and infrastructure (i.e., broadband)
should be taken into consideration, scaling the introducing technology in an
innovative systems design of new shared, connected services like the territorial
digital platform to process data for all sizes of entrepreneurial farms of a
productive community;
It seems necessary to grow the diffused awareness of thinking in terms of added
value, assess and allocate, prepare the change in the farming process and adopt,
verify and tune-up through a lean-approach;
More and more appropriate is the High Tech and ITC cluster networks
participation to be aware and joined with knowledge at global and local level.
13 | P a g e
CHAPTER 2
Embedded Systems
14 | P a g e
Chapter 2
EMBEDDED SYSTEM
An embedded system is a microprocessor-based computer hardware system with
software that is designed to perform a dedicated function, either as an independent
system or as a part of a large system. At the core is an integrated circuit designed
to carry out computation for real-time operations.
Complexities range from a single microcontroller to a suite of processors with
connected peripherals and networks; from no user interface to complex graphical
user interfaces. The complexity of an embedded system varies significantly
depending on the task for which it is designed.
Embedded system applications range from digital watches and microwaves to
hybrid vehicles and avionics. As much as 98 percent of all microprocessors
manufactured
are
used
in
embedded
systems.
Figure 1: Embedded system Application
15 | P a g e
Chapter 2
HISTORY
Here, are important milestones from the history of embedded system:
➢
➢
➢
➢
➢
➢
➢
➢
➢
16 | P a g e
in 1960, embedded system was first used for developing Apollo
Guidance System by Charles Stark Draper at MIT.
in 1965, Autonetics, developed the D-17B, the computer used in the
Minuteman missile guidance system.
in 1968, the first embedded system for a vehicle was released.
Texas Instruments developed the first microcontroller in 1971.
in 1987, the first embedded OS, VxWorks, was released by Wind River.
Microsoft’s Windows embedded CE in 1996.
by the late 1990s, the first embedded Linux system appeared.
the embedded market reach $140 billion in 2013.
Analysts are projecting an Embedded market larger than $40 billion by
2030.
Chapter 2
COMPONENTS OF EMBEDDED SYSTEMS
Figure 2: Components of embedded system
I.
Power supply
➢ A power supply is a crucial component of the embedded system
design.
➢ It is an electrical device mainly used to power up the electrical load.
➢ Normally, a 5V power supply is required for the system, however, it
can also range from 1.8 to 3.3V.
You can pick either one based on your requirements and application.
To work the embedded system properly, a smooth and efficient power
supply is needed. Both wall adopter and battery can be used as a power
supply. Some power supplies work as independent equipment while others
are incorporated into the embedded technology they power
II.
Micro controller
➢ An embedded system is either a microcontroller-based or
microprocessor-based system. They give a system computing power
and are called integrated circuits.
17 | P a g e
Chapter 2
➢ The embedded hardware performance is mainly dependent on the
processor which is normally called the brain of the embedded
system.
➢ Pick from a range of processors including 8-bit, 16-bit, and 32-bit
processors.
➢ They are different in terms of processing speed. For example, a 32bit processor comes with more processing speed and can manipulate
32-bits at a time while an 8-bit processor comes with less processing
speed and can manipulate 8-bits at a time.
For simple applications, an 8-bit processor would suffice while for
complex and advanced applications, processors with more bits are used.
The 8-bit processor is normally clocked to 8MHz while the 32-bit
processor
can
run
up
to
hundreds
of
MHz
III.
Memory
➢ Memory is essential to store important information in the embedded
computer system.
➢ Memory is integrated into a microcontroller or microprocessor.
There are two types of memories including ROM (read-only-memory) and
RAM (random access memory). The former is called the code memory that
stores the program code and is non-volatile which means it stays stored in
the system when the power supply is removed. While latter is called the
data memory and is a volatile memory which means it is used for
temporally storing the information and is removed from the system when
the
power
supply
is
turned
off.
18 | P a g e
Chapter 2
IV.
Timer / Counter
Sometimes you need to create a delay before a specific function. Timers
are used in such cases. While at times you want to count the number of
times a particular event occurs. Counters are used in such cases. If an up
counter is used in the system, it will count up from the initial value to 0xFF
and if it is down counter, it will count down to 0x00. The counters are
integrated using register-type circuits like a flip-flop.
V.
Communication port
Communication ports are used in embedded systems to establish
communication with other embedded systems. There are several
communication ports including USB, UART, USB, I2C, SPI, and RS-485.
For simple applications, communications ports are utilized from the
microcontroller, and for complex and advanced applications these ports are
externally installed inside the embedded systems.
VI.
Output / Input
Input is required to interact with the embedded system. A sensor can be
used to provide input to the system. The microcontroller used in the system
can be configured as an input or output port. In the microcontroller, there
are a fixed number of input and output ports that you can utilize as per your
requirement.
19 | P a g e
Chapter 2
CHARACTERISTICS OF EMBEDDED SYSTEMS
Figure 3: Characteristics of Embedded systems
➢ All Embedded Systems are task specific. They do the same task repeatedly
/continuously over their lifetime. An mp3 player will function only as an
mp3 player.
➢ Embedded systems are created to perform the task within a certain time
frame. It must therefore perform fast enough. A car’s brake system, if
exceeds the time limit, may cause accidents.
➢ They have minimal or no user interface (UI). A fully automatic washing
machine works on its own after the programme is set and stops once the
task is over.
➢ Some embedded systems are designed to react to external stimuli and react
accordingly. A thermometer, a GPS tracking device.
➢ Embedded systems are built to achieve certain efficiency levels. They are
small sized, can work with less power and are not too expensive.
➢ Embedded systems cannot be changed or upgraded by the users. Hence,
they must rank high on reliability and stability. They are expected to
function for long durations without the user experiencing any difficulties.
➢ Microcontroller or microprocessors are used to design embedded systems.
➢ Embedded systems need connected peripherals to attach input & output
devices.
➢ The hardware of an embedded-system is used for security and
performance. The Software is used for features.
20 | P a g e
Chapter 2
ADVANTAGES OF EMBEDDED SYSTEM
➢ They are convenient for mass production. This results in low price per
piece.
➢ These systems are highly stable and reliable.
➢ Embedded systems are made for specific tasks.
➢ The embedded systems are very small in size, hence can be carried and
loaded anywhere.
➢ These systems are fast. They also use less power.
➢ The embedded systems optimize the use or resources available.
➢ They improve the product quality.
DISADVANTAGES OF EMBEDDED SYSTEM
➢ Once configured, these systems cannot be changed. Hence, no
improvement or upgradation on the ones designed and created can be
made.
➢ They are hard to maintain. It is also difficult to take a back-up of embedded
files.
➢ Troubleshooting is difficult for embedded systems. Transferring data from
one system to another is also quite problematic.
➢ Because these systems are made for specific tasks, hardware is limited.
21 | P a g e
Chapter 2
BASIC STRUCTURE OF AN EMBEDDED SYSTEM
Figure 4: Basic Structure
I.
Sensor
This sensor converts a physical quantity (which is measured), to an
electrical signal. This then can be read by an electronic instrument or an
observer. The sensor stores this measured quantity to the memory.
II.
A-D Convertor
An analog-digital convertor, converting any analog signals sent by the
sensor into a digital signal.
III.
Processor & ASIC’s
The output is measured by the processor and is stored in the memory.
IV.
D-A Convertor
Digital-analog convertor converting any digital data which is given from
the processor to analog data.
V.
Actuator
In this system, the actuator will compare the output provided by the digitalanalog convertor to the actual/expected output stored in it. Then it stores it
as the approved output.
22 | P a g e
Chapter 2
CLASSIFICATIONS OF EMBEDDED SYSTEM
Figure 5:Classification
PERFORMANCE OF MICROCONTROLLER:
I.
`Small scale Embedded System
➢
➢
➢
➢
Single 8-bit or 16-bit Microcontroller
Little hardware and software complexity.
They May even be battery operated.
Usually, “C” is used for developing this system.
Figure 6:8-bit
Microcontroller.
Medium-scale Embedded System
➢
➢
➢
➢
23 | P a g e
Single / few 16-bit or 32-bit microcontrollers
Digital Signal Processors (DSP)
Reduced Instructions Set Computers (RISC).
Both hardware and software complexity.
Figure 7:32-bit
microcontroller
Chapter 2
II.
Sophisticated Embedded System
➢ Enormous hardware and software complexity may
need callable processors, configurable processes,
orprogramming logic arrays.
➢ They were constrained by the processing speed
available in their hardware units.
Figure 8:Embedded
Camera
PERFORMANCE AND FUNCTIONAL REQUIREMENTS
I.
Real-Time Embedded Systems
A Real-Time Embedded System provides output within a defined
specific time. That is, real-time embedded systems are designed
and created to perform some specific work in pre-specified time.
Types of Real-Time Embedded Systems:
There are two types of Real-Time Embedded systems. They are:
➢ Soft Real-Time Embedded Systems.
➢ Hard Real-Time Embedded Systems.
II.
Stand-Alone Embedded Systems
Stand-Alone Embedded Systems are those that can work alone,
i.e., they are self-sufficient and do not depend on a host system.
Stand-alone embedded systems are made so that input is received,
processed, and produced the desired output.
III.
Networked Embedded Systems
Networked Embedded Systems depend on a connected network to
perform theirassigned tasks. These systems consist of components
like sensors, controllers, etc., which are interconnected. Many of
these systems are built on general- purpose processors.
24 | P a g e
Chapter 2
IV.
Mobile Embedded Systems
Mobile Embedded Systems are small-sized and can be used in
smaller devices. They are used in mobile phones and digital
cameras because of their small size. They often have memory
constraints and lack an exemplary user interface.
Several examples of devices containing embedded systems include
automobiles, household appliances such as microwaves, toasters,
refrigerators, washers, dryers, television, etc., security systems, wireless
network routers, traffic lights, 3G cell phones, cameras, mp3 audio
players, DVD players, and various Bluetooth devices such as a mouse,
earpiece, keyboard, etc. it is a small list compared to today's thousands
of embedded systems.
They all have standard features that can be coarsely quantized by the
block diagram shown in Figure 9. For example, every system contains
some input and output elements to interact with the environment, i.e., the
workers. Additionally, there must be some governing mechanism that
manages the system's behavior as a whole, i.e., the manager.
Figure 9
A peripheral device, or just peripheral, is a device attached to a controlling
mechanism, for example, a processor or host computer, yet is not part of the
controlling mechanism and whose operation is functionally dependent upon the
controlling mechanism. Peripherals supplement a system’s overall functionality
but require some extra mechanism to control its behavior.
25 | P a g e
Chapter 2
For our brain in Figure 9. e must design and build all the functions to control the
peripheral and make system-level decisions. That is, based on asynchronous input
actions, such as a button being pressed down, making corresponding decisions,
and notifying the user via an output device, for example, rotating a motor 90◦.
Classically, these circuits would be built using standard electronic building
blocks, including resistors, capacitors, diodes, and transistors. However, the
current, almost universal, solution to the customized brain uses a single chip,
either a microprocessor/microcontroller or a PLD. Both devices can perform
many generic actions. In either case, the problem of designing brain functionality
still exists, but now we do not use discrete components to build our circuits.
Instead, we must “tell” the controller what actions to take. We do this by writing
down concrete steps in a language only the controller understands.
Figure 10
The program is often called software, while the physical system
components are called hardware. Software design is all about creating patterns of
0’s and 1’s in order to get the hardware to do what we want. Sometimes, it is
difficult to understand the importance of embedded programming because
software is virtual, whereas hardware is physical. However, the truth is that both
are equally important for a successful system. We also know that a processor
contains a custom instruction decoder sub-circuit that takes as input some single
“instruction” and outputs a signal or set of signals that go to other circuit subsystems within the microcontroller, telling them to perform some function. It is
the heart of the processor and the bulk of the Central Processing Unit (CPU).
Because this is just a custom decoder circuit, instructions valid for processor A
26 | P a g e
Chapter 2
are likely wholly different for processor B. That is, the machine language is
unique for every processor. Along with the CPU, there is an Arithmetic/Logic
Unit (ALU) responsible for performing all standard operations such as addition,
subtraction, multiplication, etc. Each operation takes in its operands from values
stored in CPU registers, which are small groups of memory used by the ALU and
CPU.
Finally, every processor has access to two conceptual banks of memory. Nonvolatile memory holds the program like a textbook, while volatile memory
provides the CPU with the freedom to run the program, like scratch paper. Just
as there are standard components and features, we can expect out of every
microcontroller, common questions arise at the beginning of every project based
on a new component. For example, we need to know the power supply
requirement, maximum clock frequency, which determines how fast a single
instruction can be executed, the machine language, the capabilities of the ALU,
the number and size of the CPU registers, and how instructions interact with the
registers, how much memory is available, etc.
ARDUINO
HISTORY
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast
prototyping, aimed at students without a background in electronics and
programming. As soon as it reached a wider community, the Arduino board
started changing to adapt to new needs and challenges, differentiating its offer
from simple 8-bit boards to products for IoT applications, wearable, 3D printing,
and embedded environments. All Arduino boards are open-source, empowering
users to build them independently and eventually adapt them to their particular
needs. The software, too, is also open-source, and it is growing through users'
contributions worldwide.
Arduino is a compact computer that can interact and control the surrounding
environment better than a Desktop computer. It is an open-source software
platform consisting of an electronic controller, a small console, and an IDE
development framework.
27 | P a g e
Chapter 2
ARDUINO
Arduino is an Embedded development platform that consists of both the hardware
as well as software parts. Arduino boards are open-source electronics prototyping
platforms which are widely used between both engineers and hobbyists to build
DIY robots or any application that needs a microcontroller.
ARDUINO USEGE
Arduino has been used in thousands of different projects and applications.The
Arduino software is easy-to-use for beginners yet flexible enough foradvanced
users. It runs on Mac, Windows, and Linux. Teachers and students useit to build
low-cost scientific instruments, prove chemistry and physics principles, or start
programming and robotics. Designers and architects build interactive prototypes,
and musicians and artists use them for installations and toexperiment with new
musical instruments. Makers, of course, use it to build many of the projects
exhibited at the Maker Faire. Arduino is a vital tool for learning new things.
Anyone - children, hobbyists, artists, programmers - can start tinkering just by
following the step-by-step instructions of a kit or sharing ideas online with other
members of the Arduino community
There are many other microcontrollers and microcontroller platforms available
for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets,
MIT's Handyboard, and many others offer similar functionality. All these tools
take the messy details of microcontroller programming and wrap them up in an
easy-to-use package. Arduino also simplifies the process of working with
microcontrollers, but it offers some advantages for teachers, students, and
interested amateurs over other systems:
There are a lot of Micro-Controllers available in the market, such as Parallax,
Basic Stamp, Netmedia's BX-24 Phidgets, and Raspberry Pi, all of which have
strong capabilities and can control various electronic parts and software, of
course, with a varying preference ratio.
28 | P a g e
Chapter 2
However, what distinguishes Arduino is a group of things that make the
difference between it and others, the most important of which are:
➢
Simplicity:
the Arduino piece is designed to suit the needs of everyone,
professionals, professors, students, and amateurs of interactive
electronics.
➢
The Price:
The Arduino board is less expensive than other boards of the same
type. For example, the price of the most expensive Arduino does not
exceed 500EGP (at the time of the project).
➢
Self-Assembly:
Arduino Datasheet can be downloaded from the official website, and
buy the parts to be installed!
➢
Multi-platform:
Arduino can run on Windows, Mac OS, and Linux, and most other
electronic controls work only on Windows. A straightforward
programming environment: the Programming Environment is
designed to be easy for beginners, stable and robust for professionals.
➢
Open-Source Software:
written in C ++ and available for everyone to download, and
programmers can modify it according to their needs.
➢
Open-Source Hardware:
Arduino is mainly made of ATMEGA8 and ATMEGA168
controllers, and the diagrams are published under a Creative
Commons license allowing electronic circuit designers to design their
circuits
29 | P a g e
Chapter 2
➢
Ease to use:
We will need to download the program from the official website, then
we only need to connect the piece to the device, and perhaps we will
need to purchase a USB cable if we do not already own it. Now we
are ready to go
➢
Communication:
It means communicating with other devices through a local or home
network orthe Internet. So can connect to networks easily if we add it
to the Ethernet shield,which is an additional piece supported by the
official website, or we can buy anArduino board equipped with the
feature of Wi-Fi and also there is an Arduino board with the feature
of connecting to GSM networks, which opens the door to thinking
about interesting project
30 | P a g e
Chapter 2
TYPES
More than 40 types of Arduino Boards vary in capacity, shape, size, and price to
suit all ideas and designs. The below-listed types were our options.
Arduino Uno
The best choice for beginners to
discover theworld of Arduino is simple,
easy to use, and suitable for most
Extensions and Shields.
Figure 11
Arduino Nano
It has roughly the same capabilities as
the Arduino Uno; its size is about a
third of theArduino Uno.
Figure 12
Arduino Lilypad
It is distinguished by its circular shape,
making it more suitable for technical
projects, although it can be used as any
otherArduino board.
Arduino Mega 2560
What distinguishes it is that it has the
mostsignificant memory between other
Arduino parts and more Input / Output,
it is the best and largest Arduino we can
get and also themost expensive among
the rest of the pieces
Figure 13
Figure 14
Arduino UNO was the most suitable board according to our needs, memory, and budget
31 | P a g e
Chapter 2
ARDUINO - HARDWARE DESIGN
What’s Arduino hardware? It's a PCB-mounted microcontroller that you can
program and use for simple daily tasks, mathematical computations, and
prototyping and testing. An Arduino development board consists of the core
microcontroller with its supplementary components and the necessary circuitry
to communicate with the PC which we will be using for both communications
as well as programming the microcontroller. For communication or
programming purposes, we will be using a USB to TTL converter, which will
be embedded within the Arduino board. So, if we look into an Arduino board at
a block level it will look like this.
Figure 15
The above Arduino block diagram shows the important modules on an Arduino
UNO board. When you think about the Arduino board the first image that comes
to your mind might be that of an Arduino UNO or an Arduino Nano. That is
because they are the most popular board among the community. That doesn’t
mean the Arduino is limited to the capabilities of an ATMEGA328 chip. There
are plenty of board variants available, with an entirely different set of features
like different microcontrollers, layout, number of I/O ports. We will take Arduino
UNO as an example and will discuss each component in it.
32 | P a g e
Chapter 2
ARDUINO UNO HARDWARE DESCRIPTION
Figure 16
In the UNO board, the main component is the ATMega328P. It is the heart of the
Arduino UNO. Near the MCU you can see a 16MHz resonator which will give
the ATMega328P the clock signal to work. Near that, you can also see a connector
named ICSP. It is used to burn the Arduino bootloader into the chip. And you can
also see the header pins for the I/O.
If you look at the other side of the board, you can spot
If you look at the other side of the board, you can spot another microcontroller in
a QFN package. It is an ATMega16U and is used as a USB -TTL converter. Near
that, it will have its crystal and ICSP port to burn the firmware. There will be a
reset button near it, which will reset the ATMega328P.
You can see the USB port and DC barrel jack on the left side. You can power the
Arduino either through the USB port or the barrel jack. The barrel jack will accept
a voltage range of 7-12V. And near the barrel jack, you can find two voltage
regulators. One for 5V and one for 3.3V. Let’s check out each component.
33 | P a g e
Chapter 2
I.
USB - B Socket
The USB socket on the UNO has two
functions. One is for communication
to connect with the computer through
a USB port, and also to load the
firmware into the Arduino with the
help of the bootloader. The second is
to power the Arduino. You can use
the USB port to power the Uno
directly from any USB port.
II.
Figure 17
ISCP Pins
In the UNO you can find
two 6 pin connectors. One
is near the USB – TTL
Chip and the other one is
at the end of the board.
These pins are used to
program
those
two
microcontrollers.
The
USB – TTL chip on this
board
is
an
ATMgega16U.The
connector marked as 1 is
Figure 18
used to program the USBTTL firmware into this chip.
And the connector marked as 2 is used to burn the bootloader into the
ATMega328 microcontroller.
34 | P a g e
Chapter 2
III.
Reset Button
As the name
indicates
this
tactile switch is
used to reset
theATMega328
microcontroller.
It’s connected to
the
PC6/Reset
pin, which is
pulled up through
Figure 19
a 10K. When the
switch is pressed, the pin is pulled to the ground and the chip will reset.
IV.
DC Barrel Jack
The DC barrel jack is
used to supply power
to the UNO. We can
supply 7-12V through
it and hence we can
use a 12V DC adapter
or 9V DC adapter on
this Jack to power the
Arduino board.
Figure 20
35 | P a g e
Chapter 2
V.
USB-TTL Interface Chip
To
communicate
with the computer,
the Arduino relies
onUSB-TTL
interface. In UNO,
ATMega16
with
custom firmware act
as a USB – TTL
interface chip.
Figure 21
VI.
Crystal Oscillator/ Ceramic resonator
For
a
microcontroller to
work it needs a
clock source. The
clock
circuit determines
the speed with
which
the
microcontroller
operates.
How
many instructions
per
Figure 22
second it
will
execute is dependent on the clock frequency. The ATMega series
microcontrollers can use two types of clock sources. One is an internal RC
oscillator that is already built into the microcontroller. But the drawback of
using the internal oscillator is that its maximum frequency is limited and it
is not that accurate. That is where the second option comes into place, i.e.,
using an external clock generator. In this case, we will be using a Quartz
36 | P a g e
Chapter 2
crystal oscillator or a ceramic resonator for this purpose. In the picture
below, you can see two components are marked. The first one is a 16MHz
crystal oscillator used for the ATMega16U2 chip and the second one is a
16MHz resonator used for the ATMega328P microcontroller.
VII.
Digital and Analog I/O
The Arduino UNO has
14 digital I/O pins and
6 Analog inputs. The
digital I/O pins are 5V
logic level and you
can also use the
Analog pins as digital
I/O too. Arduino UNO
supports 6 channel 10
bit
ADC
inputs
through A0-A5, which
can be sampled and
analyzed using UNO.
VIII.
Figure 23
Power path control
If you inspect a
UNO, you can find
an LM358. You
might think what’s
its role here. It’s
used
as
a
comparator
to
control the input
power path. When
the input power is
provided through the
barrel jack or Vin pin
37 | P a g e
Figure 24
Chapter 2
the power path control circuit will cut off the USB power pin from the
circuit which in fact will protect the USB port
IX.
Status LEDs and Inbuilt LED
Uno has 4 LEDs onboard. One is
used as a power indicator and two
are used to show the activity of the
Rx and Tx pin. The other one is
tied to the Digital pin 13, which
can be used to test the Arduino
board or simply as an indicator.
X.
ATMega328P – The Brain
Figure 25
Last but not least is the main
component on the Arduino
board – the ATMega328P
Microcontroller. UNO uses a
28Pin DIP version of
ATMega328P. Atmega328P
is pre-programmed with a
bootloader that allows you to
directly upload the program
to Arduino through USB
without the need for an
external programmer.
Figure 26
38 | P a g e
Chapter 2
PWM (PULSE WIDTH MODULATION) IN ARDUINO
is a method of Digital to Analog Conversion. It helps in delivering analog average
voltage using digital pulses of variable pulse width. By controlling the on time
and off time, we can generate an analog average voltage using the digital pulses.
PWM has a wide range of application. It is used in DC motor speed control,
Brightness control of LED lamps .
Figure 27
What makes the Arduino so special is not that it’s a microcontroller that uses
sensors, or that it can communicate with a computer to give input from or to the
physical world, but the fact that it has been packaged with its software in such a
way that it makes physical computing(the communication between the computer
and the physical world) much easier than ever before. Microcontrollers are said
to be a very difficult field in programming, but the Arduino is very simple to
program. Also, the way it is build, facilitates prototyping to a great extent, where
you can plug in a few sensors and start using them in a matter of a few minutes.
The Arduino has actually revolutionized the way we use microcontrollers and the
contributed in the expansion of the maker communities worldwide
39 | P a g e
Chapter 2
SENSORS
A sensor means that a device which detects or measures a physical property and
records, indicates, or otherwise responds to it.
In this project, we use 2 sensors and 1 esp.
SOIL MOISTURE SENSOR
WHAT IS MEANT BY SOIL MOISTURE SENSOR?
Soil moisture sensors measure or estimate the amount of water in the soil.
These sensors can be stationary or portables such as handheld probes. Stationary
sensors are placed at the predetermined locations and depths in the field, whereas
portable soil moisture probes can measure soil moisture at several locations
SOIL MOISTURE SENSOR PINOUT
Figure 28
40 | P a g e
Chapter 2
AO (Analog Output) generates analog output voltage proportional
to the soil moisture level, so a higher level results in a higher voltage
and a lower level results in a lower voltage.
DO (Digital Output) indicates whether the soil moisture level is
within the limit. D0 becomes LOW when the moisture level exceeds
the threshold value (as set by the potentiometer), and HIGH
otherwise.
VCC supplies power to the sensor. It is recommended that the sensor
be powered from 3.3V to 5V. Please keep in mind that the analog
output will vary depending on the voltage supplied to the sensor.
ADVANTAGES OF A MOISTURE SENSOR
The benefits of optimizing irrigation scheduling with soil moisture
sensors includes increasing crop yields, saving water, protecting
local water resources from runoff, saving on energy costs, saving on
fertilizer costs and increasing the farmer profitability.
MOISTURE SENSOR MODULE FEATURES &
SPECIFICATIONS
➢ Operating Voltage: 3.3V to 5V DC
➢ Operating Current: 15mA
➢ Output Digital - 0V to 5V, Adjustable trigger level from
preset
➢ Output Analog - 0V to 5V based on infrared radiation from
fire flame falling on the sensor
➢ LEDs indicating output and power
➢ PCB Size: 3.2cm x 1.4cm
41 | P a g e
Chapter 2
➢ LM393 based design
➢ Easy to use with Microcontrollers or even with normal
Digital/Analog IC
➢ Small, cheap and easily available
BRIEF ABOUT SOIL MOISTURE SENSOR MODULE
This Moisture sensor module consists of a Moisture sensor, Resistors,
Capacitor, Potentiometer, Comparator LM393 IC, Power and Status LED in an
integrated circuit.
Figure 29
I.
LM393 IC
LM393 Comparator IC is used as a voltage comparator in
this Moisture sensor module. Pin 2 of LM393 is connected to
Preset (10KΩ Pot) while pin 3 is connected to Moisture sensor
pin. The comparator IC will compare the threshold voltage
set using the preset (pin2) and the sensor pin (pin3).
II.
Moisture Sensor
The moisture sensor consists of two probes that are used to
detect the moisture of the soil. The moisture sensor probes are
coated with immersion gold that protects Nickel from
oxidation. These two probes are used to pass the current
through the soil and then the sensor reads the resistance to get
the moisture values.
42 | P a g e
Chapter 2
III.
Preset (Trimmer pot)
Using the onboard preset you can adjust the threshold
(sensitivity) of the digital output.
HOW TO USE SOIL MOISTURE SENSOR MODULE
Moisture sensor module consists of four pins
i.e. VCC, GND, DO, AO. Digital out pin is connected to the output pin of
LM393 comparator IC while the analog pin is connected to Moisture sensor.
The internal Circuit diagram of the Moisture sensor module is given below.
Figure
Figure
3031
Using a Moisture sensor module with a microcontroller is very easy. Connect
the Analog/Digital Output pin of the module to the Analog/Digital pin of
Microcontroller. Connect VCC and GND pins to 5V and GND pins of
Microcontroller. After that insert the probe inside the soil. When there is
more water presented in the soil, it will conduct more electricity that means
resistance will be low and the moisture level will be high.
43 | P a g e
Chapter 2
APPLICATIONS OF SOIL MOISTURE SENSOR
➢
Gardening
➢
Irrigation Systems
➢
Used in Controlled Environments
HARDWARE OVERVIEW
A typical soil moisture sensor consists of two parts.
I.
The Probe
The sensor includes a fork-shaped probe with two exposed
conductors that is inserted into the soil or wherever the
moisture content is to be measured.
As previously stated, it acts as a variable resistor, with
resistance varying according to soil moisture.
Figure 32
44 | P a g e
Chapter 2
II.
The Module
In addition, the sensor includes an electronic module that connects the
probe to the Arduino.
The module generates an output voltage based on the
resistance of the probe, which is available at an Analog
Output (AO) pin.
The same signal is fed to an LM393 High Precision
Comparator, which digitizes it and makes it available at a
Digital Output (DO) pin.
Figure 33
The module includes a potentiometer for adjusting the sensitivity of
the digital output (DO).
You can use it to set a threshold, so that when the soil moisture level
exceeds the threshold, the module outputs LOW otherwise HIGH.
This setup is very useful for triggering an action when a certain
threshold is reached. For example, if the moisture level in the soil
exceeds a certain threshold, you can activate a relay to start watering
the plant.
45 | P a g e
Chapter 2
Figure 34
The module also includes two LEDs. The Power LED illuminates when the
module is turned on, and the Status LED illuminates when the soil moisture
level exceeds the threshold value.
DH11
These DHT sensors are perfect for home projects like weather
stations,
environmental
automatic
control
systems,
testing/inspection of equipment, farm/garden monitoring systems,
and many more.
DHT sensors are made up of two parts, a capacitive humidity sensor,
and a thermistor with a basic chip that is responsible for analog to
digital conversions
Figure 35
46 | P a g e
Chapter 2
The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It
is able to detect temperature and also relative humidity which is the amount of
water vapour in the air vs the saturation point of water vapour in the air.
DHT11 is the most common temperature and humidity module for Arduino and
Raspberry Pi. Thus, widely favour. Our DHT11 temperature humidity sensor is
based on the new DHT11 module
FEATURES
➢ Low power consumption and excellent long-term stability.
➢ Relatively high measurement accuracy can be obtained at a very low cost.
➢ Single-bus digital signal output through the built-in ADC, which saves the
I/O resources of the control board.
➢ Humidity range of 5 to 95% RH with a ±5% and also a temperature range
of -20 to 60℃ with a ±2%
47 | P a g e
Chapter 2
INSIDE THE DHT11 SENSOR:
If you remove the sensor’s casing, you will find an NTC thermistor and a
humidity sensing
component inside.
Figure 36
The humidity sensing component has two electrodes with a moisture-holding
substrate (usually a salt or conductive plastic polymer) in between.
As the humidity rises, the substrate absorbs water vapor, resulting in the release
of ions and a decrease in the resistance between the two electrodes.
This change in resistance is proportional to the humidity, which can be measured
to estimate relative humidity.
48 | P a g e
Chapter 2
Figure 37
DHt11 also includes a NTC thermistor for measuring temperature. A thermistor
is a type of resistor whose resistance varies with temperature.
Technically, all resistors are thermistors in the sense that their resistance
changes slightly with temperature, but this change is typically very small and
difficult to measure. Thermistors are designed so that their resistance changes
dramatically with temperature (by 100 ohms or more per degree). The term
“NTC” stands for “Negative Temperature Coefficient,” which means that
resistance decreases as temperature rises.
Figure 38
The sensor also includes an 8-bit SOIC-14 packaged IC. This IC measures and
processes the analog signal using stored calibration coefficients, converts the
analog signal to digital, and outputs a digital signal containing the temperature
and humidity.
49 | P a g e
Chapter 2
HOW DOES DHT11 WORK?
As already mentioned, DHT11 has an NTC thermistor and humidity sensing
components. When the temperature changes, the resistance of the NTC also
changes. This change in resistance is measured and the temperature is calculated
from it.
The humidity sensing component consists of a moisture-holding substrate
sandwiched in between two electrodes. When the substrate absorbs water content,
the resistance between the two electrodes decreases. The change in resistance
between the two electrodes is proportional to the relative humidity. Higher
relative humidity decreases the resistance between the electrodes, while lower
relative humidity increases the resistance between the electrodes. This change in
resistance is measured with the onboard MCU’s ADC and the relative humidity
is calculated
DHT11 MODULE PINOUT
Figure 39
The DHT11 module is relatively simple to connect. There are only three pins:
I.
(VCC) pin provides power to the sensor. Despite the fact
that the supply voltage of the module ranges from 3.3V to
5.5V, a 5V supply is recommended. With a 5V power
supply, the sensor can be placed up to 20 meters away. With
50 | P a g e
Chapter 2
3.3V supply voltage, the sensor can be placed just 1 meter
away; otherwise, the line voltage drop will cause
measurement errors.
II.
Out pin is used for communication between the sensor and the
microcontroller.
III.
(GND) is the ground pin.
ESP
The ESP-01 WIFI Wireless Transceiver Module is a selfcontained SOC with an integrated TCP/IP protocol stack
that can give any microcontroller access to your Wi-Fi
network. This article is going to explain pinout,
programming, specifications, and more details about the
ESP-01 WIFI module
Figure 40
DEFINITION ESP-01
The ESP-01 WIFI Wireless Transceiver Module is a self-contained SOC with
an integrated TCP/IP protocol stack that can give any microcontroller access
to your Wi-Fi network.
51 | P a g e
Chapter 2
ESP-01 PINOUT
Figure 41
➢
➢
➢
➢
➢
➢
➢
➢
GND = Ground. Connect to ground on MCU
GPIO2 = General Purpose Digital I/O
GPIO0 = General Purpose Digital I/O
RX = Receive Data. Connects to RX on MCU
TX = Transmit Data. Connects to TX on MCU
CH_PD = Enable / Power Down. Must be pulled to 3.3V directly or via
pull-up resistor to enable
RST = Reset. Active low, must be pulled to 3.3V directly or via pull-up
resistor
VCC = 3.3V. Can draw up to 200mA worse case.
52 | P a g e
Chapter 2
ESP-01 CAD MODEL
Figure 42
Figure 43
ESP-01 FEATURES
➢
➢
➢
➢
➢
➢
➢
➢
➢
➢
➢
802.11 b/g/n
Integrated low power 32-bit MCU
Integrated 10-bit ADC
Integrated TCP/IP protocol stack
Integrated TR switch, balun, LNA, power amplifier, and matching
network
Integrated PLL, regulators, and power management units
Supports antenna diversity
Wi-Fi 2.4 GHz, support WPA/WPA2
Support STA/AP/STA+AP operation modes
Support Smart Link Function for both Android and iOS devices
Support Smart Link Function for both Android and iOS devices
53 | P a g e
Chapter 2
USING ESP-01 AS A WI-FI SHIELD
As a result, I devised a better way to utilize the ESP-01 as a WiFi shield, in
which the ESP-01 is in charge of establishing WiFi and HTTP(S) connections,
as seen in "Using the ESP-01 as an Arduino." As a sensor node, a Host (in my
case and STM32 Blue Pill) will communicate with the ESP-01 via a serial
interface. This is similar to using the ESP-01 with AT command firmware, except
the ESP-01 's firmware is replaced with the Arduino web client, and we can
design our communication requests and responses between the serials.
Figure 44
ESP-01 VS ESP-01S
The ESP-01 is on the left, and the ESP-01S is on the right. The ESP-01
includes two LEDs near the PCB antenna, one for the Tx line (GPIO1) and the
other for the power indicator. The ESP-01 S, on the other hand, has only one
Blue LED and is wired to GPIO2. Two more pull-up resistors were added to
the ESP-01 S, which can be seen between the ESP8266EX chip and the
header pins. Between the CH PD and 3v3 (VCC) pins is one of the pull-up
resistors.
54 | P a g e
Chapter 2
ESP-01
esp01 esp-01 esp8266ex blue
512MB
512 Mo
Blue
AI Cloud Inside
ESP-01S
esp01s esp-01s esp8266ex black 1Mb
1 Mo
Black
S Series
The red (Power) and blue (WiFi) LEDs are placed next
to the antenna engraved on the PCB
Figure 45
CHOOSE ESP-01 OR ESP8266
The ESP01 is simply an ESP8266 module installed on a miniature
development board (24.8 x 14.3mm). There are only 2 pins of the ESP8266EX
module that are exposed on the GPIO GPIO0 and GPIO2 as well as
the pins RX ET TX for programming and debugging via the serial port.
The difference between the versions lies only in the amount of flash memory,
512 KB or 1 MB.
55 | P a g e
Chapter 2
ESP-01 MANUFACTURER
Pimoroni designs manufacture and sell friendly products for Makers,
Educators, and Creatives. Founded in 2012 by Jon Williamson and Paul Beech,
Pimoroni makes tech treasure for tinkerers. The company started just after Paul
won a competition to design the Raspberry Pi logo. Supported by the Raspberry
Pi community, as well as the wider Maker community, Pimoroni wants to bring
electronics to a larger audience by making electronics accessible and attractive.
Pimoroni has seen 80% growth each year since they started and currently
employ over 30 people from their headquarters in Sheffield, in the northern
UK. This growth has been sustained by selling internationally through more
than 50 worldwide distributors. Pimoroni is the largest Adafruit reseller in the
UK. When Kickstarter launched their UK site, Pimoroni's Picade (a kit to
convert your Raspberry Pi into a desktop arcade machine) was their first
project.
56 | P a g e
CHAPTER 3
Database
57 | P a g e
Chapter 3
DATABASE DEFINED
A database is an organized collection of structured information, or data, typically
stored electronically in a computer system. A database is usually controlled by
a database management system (DBMS). Together, the data and the DBMS,
along with the applications that are associated with them, are referred to as a
database system, often shortened to just database.
Data within the most common types of databases in operation today is typically
modeled in rows and columns in a series of tables to make processing and data
querying efficient. The data can then be easily accessed, managed, modified,
updated, controlled, and organized. Most databases use structured query language
(SQL) for writing and querying data.
STRUCTURED QUERY LANGUAGE (SQL)
SQL is a programming language used by nearly all relational databases to query,
manipulate, and define data, and to provide access control. SQL was first
developed at IBM in the 1970s with Oracle as a major contributor, which led to
implementation of the SQL ANSI standard, SQL has spurred many extensions
from companies such as IBM, Oracle, and Microsoft. Although SQL is still
widely used today, new programming languages are beginning to appear.
EVOLUTION OF THE DATABASE
Databases have evolved dramatically since their inception in the early 1960s.
Navigational databases such as the hierarchical database (which relied on a treelike model and allowed only a one-to-many relationship), and the network
database (a more flexible model that allowed multiple relationships), were the
original systems used to store and manipulate data. Although simple, these early
systems were inflexible. In the 1980s, relational databases became popular,
followed by object-oriented databases in the 1990s. More recently, NoSQL
databases came about as a response to the growth of the internet and the need for
faster speed and processing of unstructured data. Today, cloud
databases and self-driving databases are breaking new ground when it comes to
how data is collected, stored, managed, and utilized.
58 | P a g e
Chapter 3
TYPES OF DATABASES
There are many different types of databases. The best database for a specific
organization depends on how the organization intends to use the data.
I.
➢
II.
➢
III.
➢
IV.
➢
V.
➢
VI.
Relational databases
Relational databases became dominant in the 1980s. Items in a relational
database are organized as a set of tables with columns and rows.
Relational database technology provides the most efficient and flexible
way to access structured information.
Object-oriented databases
Information in an object-oriented database is represented in the form of
objects, as in object-oriented programming.
Distributed databases
A distributed database consists of two or more files located in different
sites. The database may be stored on multiple computers, located in the
same physical location, or scattered over different networks.
Data warehouses
A central repository for data, a data warehouse is a type of database
specifically designed for fast query and analysis.
NoSQL databases
A NoSQL, or nonrelational database, allows unstructured and semi
structured data to be stored and manipulated (in contrast to a relational
database, which defines how all data inserted into the database must be
composed). NoSQL databases grew popular as web applications became
more common and more complex.
Graph databases
➢
A graph database stores data in terms of entities and the relationships
between entities.
➢
OLTP databases. An OLTP database is a speedy, analytic database
designed for large numbers of transactions performed by multiple users.
59 | P a g e
Chapter 3
These are only a few of the several dozen types of databases in use today. Other,
less common databases are tailored to very specific scientific, financial, or other
functions. In addition to the different database types, changes in technology
development approaches and dramatic advances such as the cloud and automation
are propelling databases in entirely new directions. Some of the latest databases
include
VII.
➢
VIII.
➢
IX.
Open source databases
An open source database system is one whose source code is open
source; such databases could be SQL or NoSQL databases.
Cloud databases
A cloud database is a collection of data, either structured or
unstructured, that resides on a private, public, or hybrid cloud computing
platform. There are two types of cloud database models: traditional and
database as a service (DBaaS). With DBaaS, administrative tasks and
maintenance are performed by a service provider.
Multimodal database
➢
X.
➢
XI.
Multimodal databases combine different types of database models into
a single, integrated back end. This means they can accommodate various
data types.
Document/JSON database
Designed for storing, retrieving, and managing document-oriented
information, document databases are a modern way to store data in
JSON format rather than rows and columns.
Self-driving databases
➢
The newest and most groundbreaking type of database, self-driving
databases (also known as autonomous databases) are cloud-based and
use machine learning to automate database tuning, security, backups,
updates, and other routine management tasks traditionally performed by
database administrators.
60 | P a g e
Chapter 3
DATABASE SOFTWARE
Database software is used to create, edit, and maintain database files and records,
enabling easier file and record creation, data entry, data editing, updating, and
reporting. The software also handles data storage, backup and reporting, multiaccess control, and security. Strong database security is especially important
today, as data theft becomes more frequent. Database software is sometimes also
referred to as a “database management system” (DBMS).
Database software makes data management simpler by enabling users to store
data in a structured form and then access it. It typically has a graphical interface
to help create and manage the data and, in some cases, users can construct their
own databases by using database software.
DATABASE MANAGEMENT SYSTEM (DBMS)
A database typically requires a comprehensive database software program known
as a database management system (DBMS). A DBMS serves as an interface
between the database and its end users or programs, allowing users to retrieve,
update, and manage how the information is organized and optimized.
A DBMS also facilitates oversight and control of databases, enabling a variety of
administrative operations such as performance monitoring, tuning, and backup
and recovery.
Some examples of popular database software or DBMSs include MySQL,
Microsoft Access, Microsoft SQL Server, FileMaker Pro, Oracle Database, and
DBASE.
61 | P a g e
Chapter 3
MYSQL DATABASE
MySQL is an open-source relational database management system based on SQL.
It was designed and optimized for web applications and can run on any platform.
As new and different requirements emerged with the internet, MySQL became
the platform of choice for web developers and web-based applications. Because
it’s designed to process millions of queries and thousands of transactions,
MySQL is a popular choice for ecommerce businesses that need to manage
multiple money transfers. On-demand flexibility is the primary feature of
MySQL.
MySQL is the DBMS behind some of the top websites and web-based
applications in the world, including Airbnb, Uber, LinkedIn, Facebook, Twitter,
and YouTube.
CLOUD STORAGE
The term cloud storage encompasses several storage capabilities available to
cloud customers that run on a cloud provider’s hardware. Each of these
capabilities meets a different need, but all provide the flexibility to pay only for
what you use. The provider is responsible for maintaining the underlying
hardware and ensuring that data remains available, resilient, and protected.
The most common types of cloud storage are object, file, and block.
TYPES OF CLOUD STORAGE
Storage types differ primarily in how they are accessed and the level of
performance they provide. The application using the storage and its location
determine storage requirements.
62 | P a g e
Chapter 3
I.
Object storage
Object storage is accessed differently than the other storage types discussed.
Software applications must be intentionally written to use object storage by
calling web APIs. Object storage is maintained remotely from the
application and is used in two similar but different situations. First, it’s often
accessed via the internet by applications running on individual computers,
mobile devices, and Internet of Things devices, among others. Second, it
can be used by applications running in the cloud.
Applications that use object storage can store and retrieve unstructured data
from object storage in a remote location without using a file system. The
stored items are merely abstract “objects” in the cloud. This means the
application developer maintains maximum flexibility and has an essentially
bottomless, free-form datastore in the cloud while being charged only for
the amount of data stored and transferred.
The downsides of object storage are twofold: It involves a bit more work
for the application authors who must manage their own object formats, and
there are performance limitations. Object storage is accessed by software
making API calls, typically over the internet, so what might take directattached storage microseconds and block storage or file storage
milliseconds may sometimes take object storage a second or more. For
many use cases, such as end users running applications connected to cloud
storage on their phones, this performance is acceptable, especially in return
for the “anywhere access” these applications provide. And in cases where
an application using object storage is running in the same cloud as the
objects are stored, performance is considerably higher because all the
resources are in the same region on the cloud provider’s own local network.
II.
Archive Storage
Archive storage is the ideal solution for storing seldom-accessed data that
requires long retention periods. Archive storage is more cost-effective than
object storage for preserving cold data. However, unlike other storage
options, archive storage data retrieval is not immediate.
Both object storage and archive storage use buckets as logical containers
for storing objects. A bucket is a single compartment with policies that
determine the actions that can be performed on objects in the bucket—and
who can perform them.
63 | P a g e
Chapter 3
When buckets are created to hold data as objects, organizations can decide
which default storage tier—archive or standard—is appropriate for their
data. Object storage can also automatically move objects to archive storage .
III.
Cloud file storage
Most traditional applications that run on a physical server and leverage
physical drives in your data center use file storage. Operating systems such
as Linux or Microsoft Windows Server present the applications that run on
them with a file system—a single consistent set of rules and methods for
storing and retrieving data. The operating system handles the details behind
the scenes—for example, is the physical disk a solid-state drive (SSD)? A
traditional spinning disk hard drive? An optical disk? Or a remote network
file share? While the operating system takes care of these details,
applications simply open, read from, write to, and save files with
standardized API calls.
Cloud file storage presents a standard network file share—similar to the
network file shares that might run in your own data center—to the
operating systems you’re running on servers in the cloud. Those operating
systems present that file system to applications running on that virtual
machine. Applications don’t need to be modified or changed to run in the
cloud; they continue to run with the file storage they’ve always used.
The cloud provider manages the hardware, including physical disks and
network hardware, and ensures the data is protected. Additional
incremental capacity is available to customers as their needs grow. The
inherent advantages of cloud file storage are clear when compared to a
traditional approach that involves scheduled bulk purchases of network file
systems to meet the needs of future growth and then requires you to manage
your hardware and ensure the protection of your data yourself.
IV.
Block storage
Block volumes are like cloud file storage in that they represent an enhanced
version of a type of network storage you may already be running in your
data center. Using block volumes results in less network overhead and
offers higher performance, but it requires more configuration and
management within the operating systems in return.
64 | P a g e
Chapter 3
Oracle’s block volumes use a single volume type, which can be configured
on the fly with different settings to increase performance or reduce costs.
Unlike cloud file storage, block volumes must be configured with a specific
size, but that size can be increased at any time while the volume remains
online and available to the applications using it.
As with any cloud service, the provider manages the hardware and capacity
planning and ensures the data is replicated and protected.
BENEFITS OF CLOUD STORAGE
➢ Cost of ownership:
From an IT perspective, cloud storage eliminates layers of overhead
costs. Numerous direct costs are no longer necessary—from hardware
purchases to the excess storage needed to scale over the next few years.
These savings trickle down to indirect costs as well: Any time required
to prepare hardware, handle data management, or troubleshoot issues is
saved, as responsibility for these tasks moves from your IT staff to the
provider. This means that IT will rarely be interrupted to address sudden
problems, enabling staff to focus on bigger-picture tasks and further
innovation.
➢
Scalability:
Because cloud storage is handled using a pay-as-you-go model, the
platform is built to accommodate rapid scaling when needed. In contrast,
when companies rely on local hardware, additional storage and
hardware must be purchased, integrated, and configured by their IT
teams in order to scale. Cloud file storage providers have designed their
infrastructure to handle client needs of all shapes and sizes, meaning that
they can adapt quickly if a client has rapidly changing needs.
CLOUD STORAGE AND HIGH-PERFORMANCE
COMPUTING
High performance computing (HPC) is becoming increasingly common as more
companies use AI, machine learning, engineering simulations, and financial
modeling applications. Advancements in recent years have made high
performance computing in the cloud possible, easily accessible, and affordable.
65 | P a g e
Chapter 3
However, shared file system throughput for compute clusters has often been a
barrier for simulations, AI and machine learning, and complex modeling. But
with the right configuration and specifications, all these workloads can be
supported.
In Oracle's case, high-performance workloads such as complex modeling thrive
because of block storage backed by NVMe SSD media and data centers with fast,
flat network architecture. Oracle's block storage performance is also backed by a
unique SLA. Learn more in this post from the Oracle Cloud Infrastructure blog.
This type of storage requires the manual creation of file server clusters with cloud
compute instances with direct-attached solid-state drives, but it provides the
highest levels of performance—the highest throughput and lowest latency—
which is required for HPC applications.
CLOUD STORAGE USE CASES
For enterprise storage managers, trying to keep up with data growth while
juggling data security needs, archiving requirements, and cost-containment issues
is like swimming upstream with a pile of physical storage arrays on their backs.
The cloud’s scalability and elastic pay-as-you-grow model mean enterprise
storage managers don’t have to shell out for a storage upgrade, whatever the size
or granularity—whether it’s a planned or a short-term granular challenge. In
addition, consuming cloud services is almost always considered an operational
expense and is often a monthly budget line item. Both of these factors invariably
make it easier to create and control expenditures.
Here are some of the many use cases for cloud storage solutions across object
storage, file storage, and block volumes.
➢
General purpose storage
Access an unlimited storage pool to manage structured and unstructured
data growth.
➢
Big data and analytics
Build and run analytic workloads and use a low-cost shared storage
system to store persistent data and generate business insights.
66 | P a g e
Chapter 3
➢
Lift and shift of business applications
Migrate existing custom applications or on-premises business
applications that require storage, such as Oracle E-Business Suite and
PeopleSoft, to the cloud.
➢
Databases and transactional applications
Run DevTest workloads with Oracle, MySQL, or other databases
against easily accessible data in the cloud.
➢
Backups, business continuity, and disaster recovery
Host an additional copy of relevant data and file systems in the cloud
for backup and disaster recovery purposes.
➢
Microservices and Docker
Deliver persistence for cloud containers that quickly scale as your
environments grow.
➢
Unifying global operations and collaboration
Worldwide businesses can leverage a shared storage platform to unify
operations and simplify international collaboration.
➢
Scaling resources
Easily increase or reallocate storage resources through the cloud, scaling
depending on business needs or resource spikes.
BACKUP AND RECOVERY
Backup and recovery is the process of storing copies of data to protect
organizations against data loss. Leveraging the cloud for backup can protect a
copy of your data in a remote location in case of failure or disaster.
67 | P a g e
Chapter 3
Cloud data backup can cement an organization's data protection strategy without
increasing their IT staff’s workload. Cloud storage backup services act as an
offsite facility for many organizations. There are several approaches to cloud
backups that can easily fit into an organization's existing data protection process,
including the following:
➢
On-premises backup to the public cloud
➢
Cloud-to-cloud backup
➢
Cloud backup systems
USING DATABASES TO IMPROVE BUSINESS
PERFORMANCE AND DECISION-MAKING
With massive data collection from the Internet of Things transforming life and
industry across the globe, businesses today have access to more data than ever
before. Forward-thinking organizations can now use databases to go beyond basic
data storage and transactions to analyze vast quantities of data from multiple
systems. Using database and other computing and business intelligence tools,
organizations can now leverage the data they collect to run more efficiently,
enable better decision-making, and become more agile and scalable. Optimizing
access and throughput to data is critical to businesses today because there is more
data volume to track. It’s critical to have a platform that can deliver the
performance, scale, and agility that businesses need as they grow over time.
The self-driving database is poised to provide a significant boost to these
capabilities. Because self-driving databases automate expensive, time-consuming
manual processes, they free up business users to become more proactive with
their data. By having direct control over the ability to create and use databases,
users gain control and autonomy while still maintaining important security
standards.
DATABASE CHALLENGES
Today’s large enterprise databases often support very complex queries and are
expected to deliver nearly instant responses to those queries. As a result, database
administrators are constantly called upon to employ a wide variety of methods to
help improve performance. Some common challenges that they face include:
68 | P a g e
Chapter 3
➢
➢
➢
➢
➢
➢
Absorbing significant increases in data volume. The explosion of data
coming in from sensors, connected machines, and dozens of other
sources keeps database administrators scrambling to manage and
organize their companies’ data efficiently.
Ensuring data security. Data breaches are happening everywhere these
days, and hackers are getting more inventive. It’s more important than
ever to ensure that data is secure but also easily accessible to users.
Keeping up with demand. In today’s fast-moving business
environment, companies need real-time access to their data to support
timely decision-making and to take advantage of new opportunities.
Managing and maintaining the database and infrastructure. Database
administrators must continually watch the database for problems and
perform preventative maintenance, as well as apply software upgrades
and patches. As databases become more complex and data volumes
grow, companies are faced with the expense of hiring additional talent
to monitor and tune their databases.
Removing limits on scalability. A business needs to grow if it’s going
to survive, and its data management must grow along with it. But it’s
very difficult for database administrators to predict how much capacity
the company will need, particularly with on-premises databases.
Ensuring data residency, data sovereignty, or latency
requirements. Some organizations have use cases that are better suited
to run on-premises. In those cases, engineered systems that are preconfigured and pre-optimized for running the database are ideal.
Customers achieve higher availability.
Addressing all of these challenges can be time-consuming and can prevent
database administrators from performing more strategic functions.
HOW AUTONOMOUS TECHNOLOGY IS
IMPROVING DATABASE MANAGEMENT
Self-driving databases are the wave of the future—and offer an intriguing
possibility for organizations that want to use the best available database
technology without the headaches of running and operating that technology.
Self-driving databases use cloud-based technology and machine learning to
automate many of the routine tasks required to manage databases, such as tuning,
security, backups, updates, and other routine management tasks. With these
69 | P a g e
Chapter 3
tedious tasks automated, database administrators are freed up to do more strategic
work. The self-driving, self-securing, and self-repairing capabilities of Selfdriving databases are poised to revolutionize how companies manage and secure
their data, enabling performance advantages, lower costs, and improved security.
FUTURE OF DATABASES AND AUTONOMOUS
DATABASES
The first autonomous database was announced in late 2017, and multiple
independent industry analysts quickly recognized the technology and its potential
impact on computing.
Oracle Autonomous Database is built on the highly available and scalable
architecture of Oracle Exadata, it’s possible to easily scale the database
deployment as needs grow.
70 | P a g e
CHAPTER 4
Android
71 | P a g e
Chapter 4
MOBILE APPLICATION
Mobile apps are designed to provide a wide range of functions and services and
with consideration for the demands, constraints and capabilities of the devices
they're built for. For example, a gaming app might take advantage of the iPhone's
accelerometer
A mobile application or app is a computer program or software application
designed to run on a mobile device such as a phone, tablet, or watch
TYPES OF MOBILE APPLICATION
Understanding the 3 Types of Mobile Apps:
Native, Mobile, andHybrid
➢
Native Mobile Apps: Native mobile
apps are designed to be “native”to one
platform, whether it's Apple iOS,
Google's Android, or Windows Phone
➢
Hybrid Mobile Apps
➢
Web Apps
72 | P a g e
Chapter 4
THE MAIN PURPOSE OF MOBILE APPLICATION
Mobile apps have the advantage of utilizing features of a mobile device like a
camera, contact list, GPS, phone calls, accelerometer, compass, etc. Such device
features, when used within an app, can make the user experience interactive and
fun
TYPES OF MOBILE APPS
The 6 Main Types of Mobile Apps
➢
Lifestyle Mobile Apps.
Lifestyle apps have
come onstrong in recent
years.
➢
Social Media Mobile Apps.
➢
Utility Mobile Apps.
➢
Games/Entertainment Mobile Apps
➢
Productivity Mobile Apps.
➢
News/Information Outlets Mobile Apps.
73 | P a g e
Chapter 4
EXPLAINS MOBILE APPLICATION
Mobile applications are a move away from the integrated software systems
generally found on PCs. Instead, each app provides limited and isolated
functionality such as a game, calculator or mobile web browsing. Although
applications may have avoided multitasking because of the limited hardware
resources of the early mobile devices, their specificity is now part of their
desirability because they allow consumers to hand-pick what their devices are
able to do.
The simplest mobile apps take PC-based applications and port them to a mobile
device. As mobile apps become more robust, this technique is somewhat lacking.
A more sophisticated approach involves developing specifically for the mobile
environment, taking advantage of both its limitations and advantages. For
example, apps that use location-based features are inherently built from the
ground up with an eye to mobile giventhat the user is not tied to a location, as on
PC.
Apps are divided into two broad categories: native apps and web apps. Native
apps are built for a specific mobile operating system, usually iOS or Android.
Native apps enjoy better performance and a more finely-tuned userinterface (UI),
and usually need to pass a much stricter development and quality assurance
process before they are released.
Web apps are used in HTML5 or CSS and require minimum device memory
since they’re run through a browser. The user is redirected on a specific webpage,
and all information is saved on a server-based database. Web apps require a stable
connection to be used.
74 | P a g e
Chapter 4
THERE ARE SEVERAL TYPES OF APPS
CURRENTLY AVAILABLE
➢ Gaming apps: The equivalent of computer video games,
they are amongthe most popular types of apps. They
account for one-third of all app downloads and threefourths
of
all
consumer
spending.
➢ Productivity apps: These focus on improving business
efficiency by easingvarious tasks such as sending emails,
tracking work progress, booking hotels, and much more.
➢ Lifestyle and entertainment apps: Increasingly
popular, these encompass many aspects of personal
lifestyle and socialization such as dating,
communicating on social media, as well as sharing (and
watching)videos. Some of the most widely known apps
such as Netflix, Facebook or TikTok fall into this
category.
Other app types include mobile commerce (M-commerce) apps used to purchase
goods online such as Amazon or eBay, travel apps that help a traveler in many
ways (booking tours and tickets, finding their way through maps and geolocation,
travel diaries, etc.), and utility apps such as health apps and barcodescanners.
75 | P a g e
Chapter 4
ANDROID MOBILE APPLICATION
Android is an open-source software stack that includes the operating system,
middleware, and built-in mobile applications based on a modified version of
Linux thatdevice vendors can further customize to differentiate their products.
Android
Front-End
XML
Back-End
Java
Firebase
FRONT-END
The layer above the back end is the front end and it includes all software or
hardware that is part of a user interface. Human or digital users interact directly
with various aspects of the front end of a program, including user-entered data,
buttons, programs, websites and other features.
What's the Difference Between Front-End and Back-End? All websites require
front-end and back-end development. Front-end development focuses on the
visual aspects of a website — the part that users see and interact with. Back-end
development comprises a site's structure, system, data, and logic.
76 | P a g e
Chapter 4
CREATING AN ANDROID MOBILE APPLICATION
➢ Step 1: Install Android Studio
• Go to http://developer.android.com/sdk/index.html
• download Android Studio.
• Use the installer to install Android Studio following its instructions
77 | P a g e
Chapter 4
➢ Step 2: Open a New Project
78 | P a g e
Chapter 4
• Open Android Studio.
• Under the "Quick Start" menu, select "Start a new
Android Studioproject."
• On the "Create New Project" window that opens, name
your project"HelloWorld".
• If you choose to, set the company name as desired*.
• Note where the project file location is and change it if desired.
• Click "Next."
• Make sure on that "Phone and Tablet" is the only box that is
checked.
• If you are planning to test the app on your
phone, make sure theminimum SDK is below your
phone's operating system level.
• Click "Next."
•
Select "Blank Activity."
•
Click "Next."
•
Leave all of the Activity name fields as they are.
•
Click "Finish."
➢ Step 3: Edit the Welcome Message in the Main Activity
• Navigate to the activity_main.xml
tab if it is not alreadyopen.
• Make sure that the Design
tab is open on the
activity_main.xml display.
79 | P a g e
Chapter 4
• Click and drag the "Hello, world!"
from the upper left corner of the
phone display to the center of the
screen.
• In the project file system on the left
side of the window,open the values
folder.
• In the values folder, double-click the strings.xml file.
• In this file, find the line "Hello world!".After the "Hello world!"
message, add "Welcome to my app!"
• Navigate back to the activity_main.xml tab.
• Make sure that your centered text now reads
"Hello world! Welcometo my app!"
80 | P a g e
Chapter 4
➢ Step 4: Add a Button to the Main Activity
• Navigate to the Design tab of the activity_main.xmldisplay.
• In the Palette menu to the left of the phone display, findButton
(under the heading Widgets).
• Click and drag Button to be centered underneath yourwelcome
message.
• Make sure your button is still selected.
• In the Properties menu
(on the right side of the window),
scroll down to find the field for "text."
• Change the text from "New Button" to "Next Page."
81 | P a g e
Chapter 4
➢ Step 5: Create a Second Activity
• At the top of the project's file systemtree, right click on "app."
• Navigate through to New > Activity > Blank Activity.
• Change the name of this activity to "Second Activity".
• Click "Finish."
• Make sure you are in the Design view ofactivity_second.xml.
• Drag the text box in the upper left of the phone display down to the
center as you did on the Main Activity.
• With the text box still selected, find the "id" field in the Properties
menu on the right, and set it to "text2".
• Open strings.xml again.
• Add a new line under "Hello world! Welcome to my app!" that reads
"Welcome to the second page!".
• Navigate back to activity_second.xml.
• Select the text box again.
• In the Properties pane, set the "text" field to"@string/second_page".
• Make sure that the text box now reads "Welcome to the second
page!" and is in the center of the screen in the phone display.
82 | P a g e
Chapter 4
➢ Step 6: Write the Button's "onClick" Method
• Select the MainActivity.java tab along the top of thework environment.
• Add the following lines of code at the end of the
onCreate method:
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.onClickListener() { @Override
public void onClick(View v) { goToSecondActivity();
}
});
• Add the following method to the bottom of the MainActivity class:
private void goToSecondActivity() {
Intent intent = new Intent(this, SecondActivity.class);
startActivity(intent);
}
• Click the + next to import at the third line of
MainActivity.java toexpand the import statements.
• Add the following to the end of the import statements if they are not
already there:
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
➢ Step 7: Test the Application
• Click the green play symbol from the toolbar at thetop of the Android
Studio window.
• When the "Choose Device" dialog apperas (this may take a few
moments), select the "Lauch emulator" option.
• Click OK.
• When the emulator opens (this too could take awhile), the app will
automatically launch the app upon the virtual phone being unlocked.
• Make sure that all of your text displays correctly and that the button
takes you tothe next page.
83 | P a g e
Chapter 4
➢ Step 8: Up, Up, and Away!
Congrats! You've now completed your first Android application with some basic
functionality. Your finished app should have a page greeting the user and a
button that takes the user to a second page.
From here you have the cursory knowledge you need to go on to learnall there
is to know about Android application development.
84 | P a g e
Chapter 4
WHAT ARE THE PARTS OF ANDROID STUDIO?
The primary elements of the Android Studio environment consist ofthe welcome
screen and main window. Each open project is assigned its own main window
which, in turn, consists of a menu bar, toolbar, editing and design area, status
bar
and
a
collection
of
tool
windows
• what language are Android apps written in?
Google states that "Android apps can be written using Kotlin, Java,and
C++ languages" using the Android software development kit (SDK),
while using other languages is also possible
ANDROID STUDIO CONSISTS OF
I.
First manifest
the manifest file provides essential information about your app to the
Android operating system, and Google Play store. The Androidmanifest
file helps to declare the permissions that an app must have
85 | P a g e
Chapter 4
the Android Manifest is an XML file
which contains important metadata
about the Android app. This includes
the package name, activity names,
main activity (the entry point to the
app), Android version support,
hardware
features
support,
permissions, and other configurations
• what are the advantages of manifest file?
The manifest file also specifies the application metadata, which includes
its icon, version number, themes, etc., and additional top-level nodes can
specify any required permissions,
II.
Second java
JAVA is a programming language which is used in Android App
Development. It is class based and object-oriented programming whose
syntax is influencedby C++. The primary goals of JAVA is to be simple,
object-oriented, robust, secure and high
• Why Java is important in Android Studio?
Java is best suited for creating Android apps since it is platformindependent, and as a result, Java apps work on any platform. Java has its
own runtime environment, Java Runtime Environment,as well as an API.
A major portion of Android apps are based on Java, which is one of the
most popular languages on GitHub
86 | P a g e
Chapter 4
III.
Third resources
resources are used for anything from defining colors, images, layouts,
menus, and string values. The value of this is that nothing is hardcoded.
Everything is defined in these resource files and then can be referenced
within your application's code
➢ Drawable
You can use the new Resource Manager tab Click on the + sign and select
Import Drawables . From here, you can select multiple folders/files and it
will handle everything for you. Click the import button and the images will
be automatically imported to the correct
• what are drawable resources?
A drawable resource is a general concept for a graphic that can bedrawn to
the screen and which you can retrieve with APIs such as getDrawable(int)
or apply to another XML resource with attributes such as android:drawable
and android:icon . There are several different types
87 | P a g e
Chapter 4
• how to set image resource from drawable in Android?
To use an image resource, add your file to the res/drawable/ directory of
your project. Once in your project, you can referencethe image resource
from your code or your XML layout. Either way, it's referred to using a
resource ID, which is the file name without the file type extension.
➢ Layout
• what is layout in Android Studio?
A layout defines the structure for a user interface in your app, suchas in an
activity. All elements in the layout are built using a hierarchy of View and
ViewGroup objects. A View usually draws something the user can see and
interact with
88 | P a g e
Chapter 4
• What Is Layout Design?
Layout design is the process of arranging visual elements—liketext,
images, and shapes—on a given page. Layout design is important for
any project that conveys a message through eye- catching visuals, like
magazine layouts, website design, and advertisements
• layout type in Android
LinearLayout : is a ViewGroup that aligns all children in a single
direction,
vertically
or
horizontally.
RelativeLayout : is a ViewGroup that displays child views in relative
positions.
AbsoluteLayout : allows us to specify the exact location of the child views
and widgets
➢ Values
Resources are used for anything from defining colors, images, layouts,
menus, and string values. The value of this is that nothingis hardcoded.
Everything is defined in these resource files and then can be referenced
within
your
application's
code
• what is color resources in Android?
A color value defined in XML. The color is specified with an RGB value
and alpha channel. You can use a color resource any placethat accepts a
hexadecimal color value. You can also use a color resource when a
drawable resource is expected in XML (for example,
android:drawable="@color/green" )
89 | P a g e
Chapter 4
• what are themes in Android material?
A Material theme includes color, typography and shape parameters which
you can adjust to get near-infinite variations of the components – all while
maintaining their core anatomy and usability. On Android, Material
Theming can be implemented using the Material Components (MDC)
library
• what are the uses of themes?
Themes are often used to change the look and feel of a wide range of things
at once, which makes them much less granular than allowing the user to
set each option individually. For example,users might want the windowborders from a particular theme, but installing it would also alter the
desktop background
• what is string resource in Android Studio?
A string resource provides text strings for your application with optional
text styling and formatting. There are three types of resources that can
provide your application with strings: String. XML resource that provides
a single string
• why do we store strings as resources in XML?
The purpose of strings. xml (and other *. xml resource files) is to
regroup similar values in one place. This facilitates finding values that
would be otherwise buried in the code
90 | P a g e
Chapter 4
ANDROID VIEW
A View is a simple building block of a user interface. It is a small rectangular box
that can be Text View, Edit Text, or even a button. It occupies the area on the
screen in a rectangular area and is responsible for drawing and event handling.
View is a superclass of all the graphical user interface components.
USING THE VIEW IN ANDROID
Now you might be thinking what is the use of a View. So, the use of a view is to
draw content on the screen of the user’s Android device. A view can be easily
implemented in an Application using the java code. Its creation is more easy in
the XML layout file of the project. Like, the project for hello world that we had
made initially.
TYPES OF ANDROID VIEWS
➢
➢
➢
➢
➢
➢
➢
Text View
Edit Text
Button
Image Button
Radio Button
Checkbox buttons
Image View
91 | P a g e
Chapter 4
ANDROID VIEW GROUP
A View Group is a subclass of the View Class and can be considered as a
superclass of Layouts. It provides an invisible container to hold the views or
layouts. ViewGroup instances and views work together as a container for
Layouts. To understand in simpler words it can be understood as a special view
that can hold other views that are often known as a child view.
TYPES OF LAYOUTS IN ANDROID
Now that we’ve learned about the view and view groups and also somewhat about
the layouts. Subsequently let us see the types of Layouts in Android, that are as
follows:
➢ Linear Layout
Layout basically refers to the arrangement of elements on a page these
elements are likely to be images, texts or styles. These are a part of
Android Jetpack
This can have two orientations:
•
•
Vertical Orientation – It is shown above where the widgets
such as TextViews, and all in a vertical manner.
Horizontal Orientation – It is shown above where the
widgets such as TextViews, and all in a horizontal manner
➢ Relative Layout
This layout is for specifying the position of the elements in relation to
the other elements that are present there.
•
•
•
•
android:layout_alignParentTop= “true”
android:layout_alignParentLeft= “true”
android:layout_alignLeft= “@+id/element_name”
android:layout_below= “@+id/element_name”
➢ Constraint Layout
➢ Frame Layout
➢ List View
92 | P a g e
Chapter 4
➢ Absolute Layout
➢ Scroll view
ATTRIBUTES OF LAYOUT IN ANDROID
➢
➢
➢
➢
➢
➢
➢
➢
➢
➢
➢
android:id: It uniquely identifies the Android Layout.
android:hint: It shows the hint of what to fill inside the EditText.
android:layout_height: It sets the height of the layout.
android:layout_width: It sets the width of the layout.
android:layout_gravity: It sets the position of the child view.
android:layout_marginTop: It sets the margin of the from the top of the
layout.
android:layout_marginBottom: It sets the margin of the from the bottom
of the layout.
android:layout_marginLeft: It sets the margin of the from the left of the
layout.
android:layout_marginRight: It sets the margin of the from the right of the
layout.
android:layout_x: It specifies the x coordinates of the layout.
android:layout_y: It specifies the y coordinates of the layout
93 | P a g e
Chapter 4
WHAT IS THE BENEFIT OF ANDROID STUDIO?
Some of the main advantages of using Android Studio are the following.
•
•
•
•
•
•
•
•
Faster Coding. One of the main advantages of using AndroidStudio
is that it helps you code faster. ...
Fast Emulator. ...
Solid Testing. ...
Firebase Support and Integrated Cloud. ...
Feature-Rich Environment. ...
Collaborative. ...
Native to Android. ...
Project Templates Available
94 | P a g e
Chapter 4
DESIGN APPLICATION
Figure 47 : Login Screen
Figure 48 : Splash Screen
Figure 46 : Register Screen
95 | P a g e
Chapter 4
Figure 49 : User Interface
Figure 52 : Result Interface
96 | P a g e
Figure 50 : Pump Interface
Figure 51 : Scroll Interface
Chapter 4
➢ Splash screen:
How the splash screen works:
When a user launches an app while the app's process isn't running (a cold
start) or the Activity isn't created (a warm start), the following events
occur:
•
The system shows the splash screen using themes and any
animations that you define.
•
When the app is ready, splash screen is dismissed and the app
displays
➢ Login Screen:
•
Text view: displays text to the user and optionally allows them to
edit it. A TextView is a complete text editor, however the basic class
is configured to not allow editing.
•
Edit text:
Text view
Edit text
97 | P a g e
Chapter 4
•
Button: consists of text or an icon (or both text and an icon) that
communicates what action occurs when the user touches it.
Depending on whether you want a button with text, an icon, or both,
you can create the button in your layout in three ways: With text,
using the Button class
➢ Register Screen:
•
check box: allow the user to select one or more options from a set.
Typically, you should present each checkbox option in a vertical list.
•
Radio button :By default, the android RadioButton will be in OFF
(Unchecked) state. We can change the default state of RadioButton
by using android:checked attribute. In case, if we want to change the
state of RadioButton to ON (Checked), then we need to set
android:checked = “true” in our XML layout file
98 | P a g e
Chapter 4
RADIO BUTTON VS CHECKBOX IN ANDROID:
Image result for radio button in androidCheckboxes and radio buttons are
elements for making selections. Checkboxes allow the user to choose items from
a fixed number of alternatives, while radio buttons allow the user to choose
exactly one item from a list of several predefined alternative
99 | P a g e
CHAPTER 5
Future Works
100 | P a g e
Chapter 5
Pump Control
remote and automated turn-off control of most electric and
diesel irrigation well pumps used on farms (gardens) today.
Figure 53
101 | P a g e
Chapter 5
Pump Monitoring
the essential information a user needs to know about the
operation condition of his well pumps
Figure 54
102 | P a g e
Chapter 5
DIESEL PUMP MONITORING PARAMETER
Figure 55
➢
Scheduled automatic off times – diesel and electric pumps
➢
Rain gauge triggered automatic shutdowns
➢
Soil moisture level threshold automatic shutdowns
➢
“All Off” pump command feature
➢
Water level triggered automatic shutdowns for rice fields based on
standing water levels
Field operator specific automation scheduling access rights
➢
103 | P a g e
Chapter 5
PUMP PREVENTATIVE MAINTENANCE
REMINDERS
Figure 56
In-Field Sensor Monitori
Figure 57
104 | P a g e
CHAPTER 6
References
105 | P a g e
Chapter 6
[1]
Yari Vecchio; Giulio Paolo Agnusdei; Pier Paolo Miglietta; Fabian Capitanio; Adoption of Precision
Farming Tools: The Case of Italian Farmers. International Journal of Environmental Research and
Public Health 2020, 17, 869, 10.3390/ijerph17030869.
[2]
Simone Van Der Burg; Marc-Jeroen Bogaardt; Sjaak Wolfert; Ethics of smart farming: Current
questions and directions for responsible innovation towards the future. NJAS - Wageningen Journal
of Life Sciences 2019, 90-91, 100289, 10.1016/j.njas.2019.01.001.
[3]
[4]
Osterwalder A., Pigneur Y., Bernarda G., Smith A.. Value Proposition Design: How to Create Products
and Services Customers Want; John Wiley & Sons Inc, Eds.; -: -, 2014; pp. 290.
A. M. Maria Partalidou, Aikaterini Paltaki, Marco Vieri, Lombardo Stefania, “A TOOL FOR BUSINESS
MODEL CANVAS ANALYSIS: EFFECTIVE IMPLEMENTATION OF SUSTAINABLE PRECISION AGRICULTURE,”
EBEEC
Conf.
Proc.,
2020,
Accessed:
Jun.
09,
2020.
[Online].
Available:http://ebeec.ihu.gr/documents/oldConferences/EBEEC2020_abstracts.pdf.
[5]
John C. Mankins; Technology readiness assessments: A retrospective. Acta Astronautica 2009, 65,
1216-1223, 10.1016/j.actaastro.2009.03.058.
[6]
BS ISO 16290:2013, BSI Standards Publication Space systems-Definition of the Technology Readiness
Levels (TRLs) and their criteria of assessment. 2013., 2013, ISBN 978 0 580 78317 3
[7]
[8]
[9]
[10]
A. Aasrud, R. Baron, and K. Karousakis, “Market Readiness: Building Blocks for Market Approaches,”
2010.
Accessed:
Jun.
11,
2020.
[Online].
Available: https://www.oecdilibrary.org/content/paper/5k45165zm8f8-en?crawler=true.
Mariusz Maciejczak; Janis Faltmann; Assessing Readiness Levels of Production Technologies for
Sustainable Intensification of Agriculture. Applied Studies in Agribusiness and Commerce 2018, 12,
47-52, 10.19041/apstract/2018/1-2/7.
G. Fliedner and K. Majeske, “Sustainability: The new lean frontier,” Prod. Invent. Manag. J., vol. 46, no.
1, pp. 6–13, 2010.
Rui Sousa; Christopher A. Voss; QUALITY MANAGEMENT: UNIVERSAL OR CONTEXT DEPENDENT?.
Production and Operations Management 2009, 10, 383-404, 10.1111/j.1937-5956.2001.tb00083.x.
A. Bose, "Embedded System – Characteristics, Types, Advantages & Disadvantages,"
[11] [Online]. Available: https://electricalfundablog.com/embedded-system-characteristics-typesadvantages-disadvantages/.
A. Bose, "Embedded System – Characteristics, Types, Advantages & Disadvantages," [Online].
[12] Available: https://electricalfundablog.com/embedded-system-characteristics-types- advantagesdisadvantages/#:~:text=The%20advantages%20of%20Embedded%20Systems,are%20highl
y%20stable%20and%20reliable..
"What
is
Arduino?,"
Arduino.cc,
5
Feb
2018.
[Online].
[13]
Available: https://www.arduino.cc/en/Guide/Introduction.
106 | P a g e
Chapter 6
[14]
[15]
"ATmega328P, the one microcontroller you should start with," seeedstudio.com, 2019.[Online].
Available:
https://www.seeedstudio.com/blog/2019/10/22/atmega328p-the-onemicrocontroller-you-should-start-with/.
Arduino.cc, "Arduino® UNO R3- Product Reference Manual," 23 05 2022. [Online].
Available: https://docs.arduino.cc/resources/datasheets/A000066-datasheet.pdf.
Mouser Electronics, "DHT11 Humidity &Temperature Sensor," [Online]. Available:
[16] https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-TranslatedVersion-1143054.pdf.
[17] "Embedded system," [Online]. Available: https://en.wikipedia.org/wiki/Embedded_system.
"ATmega328P
Vs
ATmega328PB,"
Mirochip,
[Online].
[18]
Available:
https://www.microchip.com/wwwproducts/productcompare/atmega328p/atmega328pb.
Davis,
"Characteristics
of an Embedded
System,"
[Online].
Available:
https://www.theengineeringprojects.com/2021/06/characteristics-of-embedded- systems.html.
[20] https://alldatasheet.com/
[19]
R.
107 | P a g e
Related documents
Download