Smart Weather Station
Smart Weather Station
Smart Weather Station
net/publication/329569084
CITATIONS READS
0 3,729
5 authors, including:
2 PUBLICATIONS 0 CITATIONS
University of Burdwan
72 PUBLICATIONS 3,036 CITATIONS
SEE PROFILE
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by C Eng Faruk Bin Poyen on 11 December 2018.
Chapter I
INTRODUCTION
INTRODUCTION:
An automated digital weather station is a device that is used to measure and record the
known parameters of atmosphere without involvement of humans. The weather
conditions are required to be monitored to maintain the healthy growth in crops and to
ensure the safe working environment in industries, etc. Due to technological growth,
the process of reading the environmental parameters became easier compared to the
past days. The sensors are the miniaturized electronic devices used to measure the
physical and environmental parameters. By using the sensors for monitoring the
weather conditions, the results will be accurate and the entire system will be faster and
less power consuming. The system here describes the implemented flow of the
weather monitoring station. It includes the wireless communication technology IEEE
802.11 b/g (Wi-Fi) for communication. The system monitors the weather situations
and updates the information to the web page. The reason behind sending the data to
the web page is to maintain the weather conditions of a particular place can be known
anywhere in the world. All these sensors measure the corresponding weather
parameters. The system is once designed and developed can be used for domestic,
outdoor and industrial purposes
PROJECT OBJECTIVE:
The main focus of this project is to build a low cost digital weather station is capable
of measuring, recording and displaying weather Vis – a – Vis climatic parameters viz.
air and soil temperature, relative humidity, soil pH/salinity status, wind speed, rain
fall, atmospheric pressure and light intensity.
The data will be acquired via an array of sensors specific for each of the above
mentioned parameters which will then be fed to Raspberry Pi for further transmission
and control, if any.
OVERVIEW:
1. Wind Speed
2. Air and Soil Temperature
3. Relative Humidity
4. Atmospheric Pressure
5. Rain Fall
6. Soil pH/Salinity
7. Air Quality
CODE SECTION:
The software code to connect and control the device with one another is done in
Python and this section comprises the code for the same as provided beneath.
WORK PLAN:
Features of the Project – Digital Weather Station
The proposed project will serve the following unique features.
1. Simplicity
2. Usability
3. Low cost
4. Maintainability.
The desirable aspects of this weather station are that it should be capable of recording
and processing data outdoor tolerating the wear and tear of outside nature and should
have a considerable long life with good accuracy (± 0.5).
CHAPTER II
WEATHER PARAMETERS
INTRODUCTION:
In this section, we will learn about the parameters that are to be considered for the
modeling of the prototype smart weather station. The sensors that will be responsible
for the measurements of these parameters will also be dealt with before one can
integrate the sensors into one unit. The parameters that will be discussed in this
chapter are
i) Relative Humidity
ii) Temperature
iii) Air Pressure
iv) Soil Moisture
v) Rain fall measurement
vi) Light Meter or Lux meter
vii) Gas or Air Quality
viii) Carbon Oxide (CO)
This module deals with wiring up and receiving an output from the DHT22
temperature and humidity sensor. The sensor is manufactured by a Chinese company,
Aosong Electronics, and is very low cost. As such it doesn’t use a standard for
communication between it and the microcontroller, but instead uses its own
communication protocol.
Connecting the sensor the Arduino was straightforward; all that was required was the
sensor, some jumper wires and a 10k Ohm resistor. The pins on the sensor are long
enough to allow it to plug directly into the breadboard. The sensor has four pins: VCC
(3 to 5V power), Data out, Null and GND.
Once the sensor had been connected work could start on writing a program to get a
reading from it. Due to the delicate timings required for communication with the
sensor the C programming language is used, instead of Python. This is the only part of
the project for which this change had to be made. When the start signal is sent to the
sensor, it changes from low-power mode to running mode, and after the start signal
has finished the sensor sends a response signal of 40-bit data that contains the relative
humidity and temperature readings. Data from the sensor is comprised of integral and
decimal parts.
This pressure sensor is a BMP-180 based digital barometric pressure sensor module
and is functional compatible with older BMP-085 digital pressure sensor with less
power consumption smaller in size and more accurate. BMP180 combines barometric
pressure, temperature and altitude. The IC allows easy interface with any
microcontroller. On board 3.3V LDO regulator makes this board fully 5V supply
compatible. BMP-180 can measure pressure range from 300 to 1100hPa (+9000m to -
500m relating to sea level) with an accuracy down to 0.02hPa (0.17m) in advance
resolution mode. BMP-180 is an improved replacement for BMP-085 sensor. BMP-
180 uses piezo-resistive technology for high accuracy, linearity, EMC robustness and
stability for a longer period of time.
Specifications
Working of BMP180
The Moisture sensor is used to measure the water content (moisture) of soil when the
soil is having water shortage, the module output is at high level, else the output is at
low level. This sensor reminds the user to water their plants and also monitors the
moisture content of soil. It has been widely used in agriculture, land irrigation and
botanical gardening.
Specification
Working Voltage: 5V
Working Current: <20mA
Interface type: Analog
Working Temperature: 10°C~30°C
Fig 2.3: Actual Diagram of Soil Moisture Sensor with I2C Module
An example for a temperature sensor is LM35. The LM35 series are precision
integrated-circuit temperature sensors, whose output voltage is linearly proportional to
the Celsius temperature. In general, a temperature sensor is a device which is
designed specifically to measure the hotness or coldness of an object. With LM35, the
temperature can be measured more accurately than with a thermistor. It also possess
low self-heating and does not cause more than 0.1 °C temperature rise in still air. The
operating temperature range is from -55°C to 150°C.The LM35’s low output
impedance,linear output, and precise inherent calibration make interfacing to readout
or control circuitry especially easy.
Working Principle
There are two transistors in the centre of the drawing. One has ten times the emitter
area of the other. This means it has one tenth of the current density, since the same
current is going through both transistors. This causes a voltage across the resistor R1
that is proportional to the absolute temperature, and is almost linear across the range.
The "almost" part is taken care of by a special circuit that straightens out the slightly
curved graph of voltage versus temperature.
The amplifier at the top ensures that the voltage at the base of the left transistor (Q1)
is proportional to absolute temperature (PTAT) by comparing the output of the two
transistors.
The amplifier at the right converts absolute temperature (measured in Kelvin) into
either Fahrenheit or Celsius, depending on the part (LM34 or LM35).The little circle
with the "i" in it is a constant current source circuit.
The two resistors are calibrated in the factory to produce a highly accurate
temperature sensor.
The integrated circuit has many transistors in it -- two in the middle, some in each
amplifier, some in the constant current source, and some in the curvature
compensation circuit. All of that is fit into the tiny package with three leads.
If the temperature is 0°C, then the output voltage will also be 0V. There will be rise of
0.01V (10mV) for every degree Celsius rise in temperature. The voltage to
temperature conversion formula is provided in the figure above.
BH1750 is a digital ambient light sensor ready for I2C communication. It has been
noticed that our smartphones are changing the screen backlight depending on the
amount of light, and this is done by this sensor. Figure below shows the diagram of a
BH1750 light sensor.
Specification
Voltage: 3V-5V;
Measurement range: 1-65535lx;
Resolution: 0.5lx
Dimensions: 14 x 19mm
Range Night: 0001 - 00:02;
Range moonlight: 0.02-0.3;
Range Cloudy, inside: 5-50;
Range Cloudy, without, 50-500;
Range Sunny, inside: 100-1000;
Range direct sunlight: 1M;
Range optimal for reading books: 50-60;
Range standard TV light: 1400.
Working of BH1750
Provided below in the IC circuit diagram of BH1750. The process starts with a
photodiode (PD), which has a sensitivity about the sensitivity of the human eye. We
intensify this signal with the operational amplifier (AMP) and convert it from analog
to 16-bit digital signal (ADC). The procedure ends with IIC logic that uses an internal
oscillator (serves as CLK).
The duration of this process depends on the accuracy of the readings we want. We
have three possibilities that give accuracy of 0.5lx, 1 lx or 4LX, and the duration time
is in the order of 120ms, 120ms and 16ms. Due to prolonged measurements, some
noises can be eliminated (including the 50Hz / 60Hz noise) so we get this accurate
results. Otherwise, lux [lx] is the SI unit of measurement of illumination. It is equal to
one lumen per square meter, whereas the Candella (symbol: cd) applies as lumen per
steradian (cd = lm / sr). Much more on the light, you can read in this tutorial. It should
be mentioned that the resolution of the measurements can be increased to 10k lux,
which actually corresponds to the light that gives direct sunlight.
MQ-7 gas sensor is sensitive material used in clean air, low conductivity tin dioxide
(SnO2). Detection method using low temperature cycling (1.5V heating) detect carbon
monoxide, airborne sensor conductivity increases with the increase of the
concentration of carbon monoxide gas, high temperature (5.0V heating) cleaning stray
gas adsorption at low temperature. Using a simple circuit can be changes in the
conductivity, concentration of the gas is converted to the corresponding output signal.
MQ-7 gas sensor with high sensitivity for carbon monoxide, this sensor can detect a
variety of gases containing carbon monoxide, is a low-cost sensors for a variety of
applications.
Operation Principle:
The MQ-7 gas sensor is shown as Fig. 1 (Configuration A or B), sensor composed by
micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer, measuring electrode
and heater are fixed into a crust made by plastic and stainless steel net. The heater
provides necessary work conditions for work of sensitive components. The enveloped
MQ-7 have 6 pin, 4 of them are used to fetch signals, and other 2 are used for
providing heating current.
Sensor Features:
High Sensitivity
Stable and long life
Detection Range: 10 - 1,000 ppm CO
Response Time: <150s
Heater Voltage: 5.0V
Electrical properties:
Specifications Value
Parameter
Circuit voltage 5V
Using temperature -20C to +50° C
Storage temperature -20C to +50° C
Relative humidity Less than 95% RH
Applications
They are used in gas detecting equipment for carbon monoxide (CO) in family and
industry or car. Carbon Monoxide sensor for use in industrial or mining applications.
This unit offers excellent long life performance with stable sensing characteristic.
Photovoltaic modules, commonly called solar modules, are the key components used
to convert sunlight into electricity. Solar modules are made of semiconductors that are
very similar to those used to create integrated circuits for electronic equipment. The
most common type of semiconductor currently in use is made of silicon crystal.
Silicon crystals are laminated into n-type and p-type layers, stacked on top of each
other. Light striking the crystals induces the “photovoltaic effect,” which generates
electricity. The electricity produced is called direct current (DC) and can be used
immediately or stored in a battery. For systems installed on homes served by a utility
grid, a device called an inverter changes the electricity into alternating current (AC),
the standard power used in residential homes.
High purity silicon crystals are used to manufacture solar cells. The crystals are
processed into solar cells using the melt and cast method. The cube-shaped casting is
then cut into ingots, and then sliced into very thin wafers.
Processing Wafers
Silicon atoms have four "arms." Under stable conditions, they become perfect
insulators. By combining a small number of five-armed atoms (with a surplus
electron), a negative charge will occur when sunlight (photons) hits the surplus
electron. The electron is then discharged from the arm to move around freely. Silicon
with these characteristics conducts electricity. This is called an n-type (negative)
semiconductor, and is usually caused by having the silicon 'doped' with a phosphorous
film.
In contrast, combining three-armed atoms that lack one electron results in a hole with
an electron missing. The semiconductor will then carry a positive charge. This is
called a p-type (positive) semiconductor, and is usually obtained when boron is doped
into the silicon.
The same thing happens when light falls on a silicon crystal. If the intensity of
incident light is high enough, sufficient numbers of photons are absorbed by the
crystal and these photons, in turn, excite some of the electrons of covalent bonds.
These excited electrons then get sufficient energy to migrate from valence band to
conduction band. As the energy level of these electrons is in the conduction band, they
leave from the covalent bond leaving a hole in the bond behind each removed
electron. These are called free electrons move randomly inside the crystal structure of
the silicon. These free electrons and holes have a vital role in creating electricity in
AEIE 891 – B.E. – AEIE – UIT, BU Page 22
Smart Weather Station 2018
photovoltaic cell. These electrons and holes are hence called light-generated
electrons and holes respectively. These light generated electrons and holes cannot
produce electricity in the silicon crystal alone. There should be some additional
mechanism to do that.
A p-n junction is formed by placing p-type and n-type semiconductors next to one
another. The p-type, with one less electron, attracts the surplus electron from the n-
type to stabilize itself. Thus the electricity is displaced and generates a flow of
electrons, otherwise known as electricity.
When sunlight hits the semiconductor, an electron springs up and is attracted toward
the n-type semiconductor. This causes more negatives in the n-type semiconductors
and more positives in the p-type, thus generating a higher flow of electricity. This is
the photovoltaic effect.
CHPATER III
Although there is no single, universal definition of ICT, the term is generally accepted
to mean all devices, networking components, applications and systems that combined
allow people and organizations (i.e., businesses, nonprofit agencies, governments and
criminal enterprises) to interact in the digital world.
ICT DEFINITION:
In the past few decades, information and communication technologies have provided
society with a vast array of new communication capabilities. For example, people can
communicate in real-time with others in different countries using technologies such as
instant messaging, voice over IP (VoIP), and video-conferencing. Social networking
websites like Facebook allow users from all over the world to remain in contact and
communicate on a regular basis.
ICT encompasses both the internet-enabled sphere as well as the mobile one powered
by wireless networks. It also includes antiquated technologies, such as landline
telephones, radio and television broadcast -- all of which are still widely used today
alongside cutting-edge ICT pieces such as artificial intelligence and robotics.
ICT commonly means more than its list of components, though. It also encompasses
the application of all those various components. It's here that the real potential, power
and danger of ICT can be found.
CONNECTING TO WORK:
Information and communication technology (ICT) has grown as a sector and now
employs millions of people worldwide. The proliferation of ICTs has also help
digitize how people find and do work. The world will need to create over 600 million
jobs by 2030 for unemployment to remain at current levels. ICT-enabled employment
AEIE 891 – B.E. – AEIE – UIT, BU Page 26
Smart Weather Station 2018
may help address some of this problem both by creating jobs in the ICT sector and by
helping to make labor markets more inclusive, innovative, flexible, and transparent.
What can governments do to prepare for these changes and maximize employment
opportunities? This paper is a first step in an effort by the World Bank to understand
how ICTs are shaping, changing, and transforming labor markets. It explores how
governments and other stakeholders might respond to leverage the growth of ICTs to
help increase employment opportunities. This paper is structured as follows: section 1
serves as an introduction; section 2 defines the scope, focusing on the types of
employment opportunities due to ICT as a sector and as a tool; section 3 considers the
impact of the ICT sector on software programming, IT services, and
telecommunications; section 4 describes how ICTs as tools empower and include
more workers in labor markets; section 5analyzes the challenges and risks that appear
alongside these opportunities; section 6 discusses human capital, infrastructure,
financial, regulatory, and social systems that will enable ICT in employment; and
section 7 identifies strategic themes for governments to consider as they maximize the
gains from ICT's increasing role in the world of work.
USE OF ICT:
1. Modern developments in information and communication technologies (ICT)
provide exciting possibilities to enhance the quality of education. Interactive
education software, open access digital libraries, and cheaper and more intuitive
technology may facilitate new forms of interaction between students, teachers,
education employees and the community and enhance the quality of education by
making it more accessible.
3. ICT has the capacity to enhance the learning process and facilitate
communications within education institutions and between educators and learners but
it must be used in education institutions under the supervision of qualified well-
trained professionals with the expertise in pedagogy and in education to ensure that its
impact does not damage or undermine the learning process or the development of
learners.
In recent years ICT has had, and is continuing to have, an increasingly significant
impact on all aspects of society. There are few areas of life, at home and in work,
where this new technology has not made an impact. ICT expands our access to, and
understanding.
It is thus of vital importance that all young people have adequate access to ICT and
that they develop the necessary skills, taking full advantage of the learning capabilities
that ICT offers. Schools have a special responsibility to ensure that young people
receive the provision that they are entitled to. As the 5-14 stages represent 9 out of the
11 years of compulsory education, they have a key role to play in developing ICT
capability.
DISADVANTAGES OF ICT:
4. Not Safe: Since information has been centralized under one database, it is exposed
to people with wrong intention within the organization. Also information can be
attacked by a hacker or a virus and all data will be lost in a minute. So the
organization must pay an extra cost to keep this information safe.
The Internet of Things may be a hot topic in the industry but it’s not a new concept. In
the early 2000’s, Kevin Ashton was laying the groundwork for what would become
the Internet of Things (IoT) at MIT’s AutoID lab. Ashton was one of the pioneers who
conceived this notion as he searched for ways that Proctor & Gamble could improve
its business by linking RFID information to the Internet.
The concept was simple but powerful. If all objects in daily life were equipped with
identifiers and wireless connectivity, these objects could be communicate with each
other and be managed by computers.
In a 1999 article for the RFID Journal Ashton wrote: “If we had computers that knew
everything there was to know about things—using data they gathered without any
help from us -- we would be able to track and count everything, and greatly reduce
waste, loss and cost. We would know when things needed replacing, repairing or
recalling, and whether they were fresh or past their best. We need to empower
computers with their own means of gathering information, so they can see, hear and
smell the world for themselves, in all its random glory. RFID and sensor technology
enable computers to observe, identify and understand the world—without the
limitations of human-entered data.” At the time, this vision required major technology
improvements.
After all, how would we connect everything on the planet? What type of wireless
communications could be built into devices? What changes would need to be made to
the existing Internet infrastructure to support billions of new devices communicating?
What would power these devices? What must be developed to make the solutions cost
effective? There were more questions than answers to the IoT concepts in
1999.Today, many of these obstacles have been solved. The size and cost of wireless
radios has dropped tremendously. IPv6 allows us to assign a communications address
to billions of devices. Electronics companies are building Wi-Fi and cellular wireless
connectivity into a wide range of devices. ABI. Research estimates over five billion
wireless chips will ship in 2013. Mobile data coverage has improved significantly
with many networks offering broadband speeds. While not perfect, battery technology
has improved and solar recharging has been built into numerous devices. There will be
billions of objects connecting to the network with the next several years. For example,
Cisco’s Internet of Things Group.(IOTG) predicts there will be over 50 billion
connected devices by 2020. IoT describes a system where items in the physical world,
and sensors within or attached to these items, are connected to the Internet via
wireless and wired Internet connections.
These sensors can use various types of local area connections such as RFID, NFC,
Wi-Fi, Bluetooth, and Zigbee. Sensors can also have wide area connectivity such as
GSM, GPRS, 3G, and LTE.
WHAT IS IOT?
Internet of Things (IoT) is an ecosystem of connected physical objects that are
accessible through the internet. The ‘thing’ in IoT could be a person with a heart
monitor or an automobile with built-in-sensors, i.e. objects that have been assigned an
IP address and have the ability to collect and transfer data over a network without
manual assistance or intervention. The embedded technology in the objects helps them
to interact with internal states or the external environment, which in turn affects the
decisions taken.
An article by Ashton published in the RFID Journal in 1999 said, “If we had
computers that knew everything there was to know about things - using data they
gathered without any help from us - we would be able to track and count everything,
and greatly reduce waste, loss and cost. We would know when things needed
replacing, repairing or recalling, and whether they were fresh or past their best. We
need to empower computers with their own means of gathering information, so they
can see, hear and smell the world for themselves, in all its random glory.” This is
precisely what IoT platforms does for us. It enables devices/objects to observe,
identify and understand a situation or the surroundings without being dependent on
human help.
ESTABLISHMENT OF IOT:
Communication is central to the Internet of Things. Networking technologies enable
IoT devices to communicate with other devices as well as with applications and
services that are running in the cloud. The internet relies on standardized protocols to
ensure that communication between heterogeneous devices can occur securely and
reliably. Standard protocols specify the rules and formats that devices use for
establishing and managing networks, as well as for transmission of data across those
networks.
We often describe networks as being built up from a stack of technologies, with
technologies at the bottom of the stack, such as Bluetooth LE, relating to physically
connecting devices, while technologies further up the stack, such as IPv6, relating to
logical device addressing and routing of network traffic. Technologies at the top of the
stack are used by the applications that are running on top of those layers, for example,
message queuing technologies.
almost unlimited and on-demand storage capacity, low cost, cloud is the most
convenient and cost effective solutions to deal with the data generated by the Internet
of things .
This integration realizes a new convergence scenario, where new opportunities arise
for data aggregation, integration, and sharing with third parties. Once to the cloud,
data can be in a uniform way through a standard API, can use the top security
protection, direct access from anywhere, and visualization. IoT equipment processing
resources are not allowed to field data processing.
Collected data are usually aggregated and transmitted to a more powerful node
processing is feasible, but not an appropriate scalability challenges to achieve
infrastructure. Cloud and its on-demand model of infinite capacity allows appropriate
content, make the Internet of things to deal with unprecedented demand complex
analysis. Data-driven decision making and prediction algorithms would be possible at
low cost and would provide increasing revenues and reduced risks.
One of the requirements of the Internet of things is to make the IP access devices
communicate through dedicated hardware, and support the communication can be
very expensive. Cloud connection provides an effective and cheap solution such as
tracking and managing anything at any time from any place to use a custom portal and
built-in applications. The integration with the Cloud solves most of these problems
also providing additional features such as ease-of-access, ease-of-use, and reduced
deployment costs.
Using Cloud IoT paradigm to make intelligent services and applications of new scene
based on the expansion of the cloud by things: (1) Sensing as a Service, (2) Sensing
and Actuation as a Service, (3) Sensor Event as a Service, (4) Database as a Service,
(5) Ethernet as a Service, (6) Identity and Policy Management as a Service, (7) Video
Surveillance.
monitoring & preempting and increase revenue generated through a protection &
expansion of their market share while taking on challenges from market leaders.
Together, our IoT technology platform provides our OEM partners mature IoT
technology which can be injected into their components under a customized IoT
upgrading plan tailored to the components' unique characteristics & needs at minimal
cost & time, reducing the time-to-market, especially for time-sensitive components.
Chapter IV
A computer bus connects the different components, also called "blocks" of the
System-on-Chip. Direct memory access controllers route data directly between
external interfaces and memory, bypassing the CPU or control unit, thereby increasing
the data throughput (the amount of data processed per time) of the SoC
WHAT IS AN ARDUINO?
Arduino is a board used for making computers that can interact with the environment,
sense various data from the environment with the use of sensors and control devices
like lights, motors, et cetera accordingly. It is an open source platform based on
microcontrollers. The term Open Source indicates that all the resources for the board
including the design files, CAD files et cetera are free and open to all. This means
anyone can modify it according to their need. Arduino was designed to provide an
inexpensive and easy way for students and professionals to create microcontroller
computers that can interact with the physical environment.
Arduino has gone viral among makers and enthusiasts with its simple design. It has
two segments; a hardware part which includes the Arduino board and the software
part which includes the Arduino IDE. The IDE is a simple and easy to learn software
for writing Arduino programs. The simplicity and easiness of Arduino have made it so
popular that almost all maker events have at least one project based on it.
Arduino has huge flexibility with which we can make almost anything we imagine. It
can be easily connected to a variety of modules like fire sensors, obstacle sensors,
presence detectors, GPS modules, GSM Modules or anything with which we wish to
give wings.
ARDUINO MEGA:
The Arduino Mega 2560 is a microcontroller board based on the ATmega2560. It has
54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog
inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything
needed to support the microcontroller; simply connect it to a computer with a USB
cable or power it with a AC-to-DC adapter or battery to get started. The Mega 2560
board is compatible with most shields designed for the Uno and the former boards
Duemilanove or Diecimila.
Microcontroller ATmega2560
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limit) 6-20V
Digital I/O Pins 54 (of which 15 provide PWM output)
Analog Input Pins 16
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 256 KB of which 8 KB used by bootloader
SRAM 8 KB
EEPROM 4 KB
Clock Speed 16 MHz
LED_BUILTIN 13
Length 101.52 mm
Width 53.3 mm
Weight 50 Gram
Programming a Mega:
The Mega 2560 board can be programmed with the Arduino Software (IDE). The
ATmega2560 on the Mega 2560 comes preprogrammed with a bootloader that allows
you to upload new code to it without the use of an external hardware programmer. It
communicates using the original STK500 protocol (reference, C header files). You
can also bypass the bootloader and program the microcontroller through the ICSP (In-
Circuit Serial Programming) header using Arduino ISP or similar; see these
instructions for details. The ATmega16U2 (or 8U2 in the rev1 and rev2 boards)
firmware source code is available in the Arduino repository. The ATmega16U2/8U2
is loaded with a DFU bootloader, which can be activated by:
On Rev1 boards: connecting the solder jumper on the back of the board (near the map
of Italy) and then resetting the 8U2.
On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to
ground, making it easier to put into DFU mode. You can then use Atmel's FLIP
software (Windows) or the DFU programmer (Mac OS X and Linux) to load a new
firmware. Or you can use the ISP header with an external programmer (overwriting
the DFU bootloader). See this user-contributed tutorial for more information.
Memory of Mega:
The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is
used for the bootloader), 8 KB of SRAM and 4 KB of EEPROM (which can be read
and written with the EEPROM library)
Each of the 54 digital pins on the Mega can be used as an input or output, using
pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each
pin can provide or receive 20 mA as recommended operating condition and has an
internal pull-up resistor (disconnected by default) of 20-50 k ohm. A maximum of
40mA is the value that must not be exceeded to avoid permanent damage to the
microcontroller.
See also the mapping Arduino Mega 2560 PIN diagram. The Mega 2560 has 16
analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values).
By default they measure from ground to 5 volts, though is it possible to change the
upper end of their range using the AREF pin and analogReference() function.
The maximum length and width of the Mega 2560 PCB are 4 and 2.1 inches
respectively, with the USB connector and power jack extending beyond the former
dimension. Three screw holes allow the board to be attached to a surface or case. Note
that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple
of the 100 mil spacing of the other pins.
The Mega 2560 is designed to be compatible with most shields designed for the Uno
and the older Diecimila or Duemilanove Arduino boards. Digital pins 0 to 13 (and the
adjacent AREF and GND pins), analog inputs 0 to 5, the power header, and ICSP
header are all in equivalent locations. Furthermore, the main UART (serial port) is
located on the same pins (0 and 1), as are external interrupts 0 and 1 (pins 2 and 3
respectively). SPI is available through the ICSP header on both the Mega 2560 and
Duemilanove / Diecimila boards. Please note that I2C is not located on the same pins
on the Mega 2560 board (20 and 21) as the Duemilanove / Diecimila boards (analog
inputs 4 and 5)
ARDUINO NANO:
The Arduino Nano is a small, complete, and breadboard-friendly board based on the
ATmega328P (Arduino Nano 3.x). It has more or less the same functionality of the
Arduino Duemilanove, but in a different package. It lacks only a DC power jack, and
works with a Mini-B USB cable instead of a standard one.
Microcontroller ATmega328
Architecture AVR
Operating Voltage 5V
32 KB of which 2 KB used by
Flash Memory
bootloader
SRAM 2 KB
Clock Speed 16 MHz
Analog IN Pins 8
EEPROM 1 KB
DC Current per I/O
40 mA (I/O Pins)
Pins
Input Voltage 7-12 V
Digital I/O Pins 22 (6 of which are PWM)
PWM Output 6
Power Consumption 19 mA
PCB Size 18 x 45 mm
Weight 7g
Product Code A000005
Programming a Nano:
The Arduino Nano can be programmed with the Arduino software. Select "Arduino
Duemilanove or Nano w/ ATmega328P" from the Tools > Board menu (according to
the microcontroller on your board). The ATmega328P on the Arduino Nano comes
preburned with a bootloader that allows you to upload new code to it without the use
of an external hardware programmer. It communicates using the original STK500
protocol. You can also bypass the bootloader and program the microcontroller through
the ICSP (In-Circuit Serial Programming) header using Arduino ISP or similar.
Memory of Nano:
The ATmega328P has 32 KB, (also with 2 KB used for the bootloader. The
ATmega328P has 2 KB of SRAM and 1 KB of EEPROM.
Each of the 14 digital pins on the Nano can be used as an input or output, using
pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each
pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 kOhms. In addition, some pins have specialized
functions
The Nano has 8 analog inputs, each of which provide 10 bits of resolution (i.e. 1024
different values). By default they measure from ground to 5 volts, though is it possible
to change the upper end of their range using the analogReference() function. Analog
pins 6 and 7 cannot be used as digital pins. Additionally, some pins have specialized
functionality.
ARDUINO UNO:
Microcontroller ATmega328P
Operating Voltage 5V
Input Voltage
7-12V
(recommended)
Input Voltage (limit) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
PWM Digital I/O Pins 6
Analog Input Pins 6
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
32 KB (ATmega328P) of which 0.5 KB
Flash Memory
used by bootloader
SRAM 2 KB (ATmega328P)
EEPROM 1 KB (ATmega328P)
Clock Speed 16 MHz
LED_BUILTIN 13
Programming an Arduino:
The Arduino Uno can be programmed with the (Arduino Software (IDE)). Select
"Arduino/Genuino Uno from the Tools > Board menu (according to the
microcontroller on your board). For details, see the reference and tutorials.
The ATmega328 on the Arduino Uno comes preprogrammed with
a bootloader that allows you to upload new code to it without the use of an external
hardware programmer. It communicates using the original STK500 protocol
(reference, C header files).
You can also bypass the bootloader and program the microcontroller through the
ICSP (In-Circuit Serial Programming) header using Arduino ISP or similar;
see these instructions for details.
The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is
available in the Arduino repository. The ATmega16U2/8U2 is loaded with a DFU
bootloader, which can be activated by:
On Rev1 boards: connecting the solder jumper on the back of the board (near the
map of Italy) and then rese ing the 8U2.
On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to
ground, making it easier to put into DFU mode.
Memory of Uno:
The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader). It also has 2
KB of SRAM and 1 KB of EEPROM (which can be read and written with
the EEPROM library).
See the mapping between Arduino pins and ATmega328P ports. The mapping for the
Atmega8, 168, and 328 is identical.
Each of the 14 digital pins on the Uno can be used as an input or output, using
pinMode(),digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each
pin can provide or receive 20 mA as recommended operating condition and has an
internal pull-up resistor (disconnected by default) of 20-50k ohm. A maximum of
40mA is the value that must not be exceeded on any I/O pin to avoid permanent
damage to the microcontroller.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of
resolution (i.e. 1024 different values). By default they measure from ground to 5 volts,
though is it possible to change the upper end of their range using the AREF pin and
the analogReference() function.
RASPBERRY PI 3 MODEL 3:
The Raspberry Pi 3+ uses a Broadcom BCM2837B0 SoC with a 1.4 GHz 64-bit quad-
core ARM Cortex-A53 processor, with 512 KB shared L2 cache.
Raspberry Pi 3 have 1 GB of RAM.
Raspberry Pi 3 Specifications:
Chipset: Broadcom BCM2837
CPU: 1.2GHz quad-core 64-bit ARM cortex A53
Ethernet : 10/100 (Max throughput 100Mbps)
USB: Four USB 2.0 with 480Mbps data transfer
Storage: MicroSD card or via USB-attached storage
Wireless: 802.11n Wireless LAN (Peak transmit/receive throughput of
150Mbps), Bluetooth 4.1
Graphics: 400MHz VideoCore IV multimedia
Memory: 1GB LPDDR2-900 SDRAM
Expandability: 40 general purpose input-output pins
Video: Full HDMI port; Camera interface (CSI) & Display interface (DSI)
Audio: Combined 3.5mm audio out jack and composite video
The Central processing unit is the brain of the raspberry pi board and that is
responsible for carrying out the instructions of the computer through logical and
mathematical operations. The raspberry pi uses ARM11 series processor, which has
joined the ranks of the Samsung galaxy phone
The general purpose input & output pins are used in the raspberry pi to associate with
the other electronic boards. These pins can accept input & output commands based on
programming raspberry pi. The raspberry pi affords digital GPIO pins. These pins are
used to connect other electronic components. For example, you can connect it to the
temperature sensor to transmit digital data.
The XBee socket is used in raspberry pi board for the wireless communication
purpose
The power source cable is a small switch, which is placed on side of the shield. The
main purpose of the power source connector is to enable an external power source.
The Universal Asynchronous Receiver/ Transmitter is a serial input & output port.
That can be used to transfer the serial data in the form of text and it is useful for
converting the debugging code.
Arduino Mega: If your Arduino project has a lot of wires running all around, which
requires more than 20 pins, you can opt for an Arduino mega. Say you are working on
a 5x5 LED Cube which has a total of 30 inputs. Then you may find the Arduino Uno
or the Mini insufficient with 20GPIO pins. In such cases, you may either use a
Decoder IC74595 to increase the number of pins on your Arduino Uno or you may
buy an Arduino Mega instead, which reduces the fuss of extra wires, PCBs or ICs. To
make your project simpler and easier in such scenarios, you may even go for an
Arduino Mega 2560. The Arduino mega has 4 pairs of Tx and Rx pins so that you
may connect more serial communication devices.
Arduino Nano: If you are looking to get a cheaper intro into the field, or if you need
your product in a smaller size, then you may go for the Arduino mini. It has all the
functionalities of the Arduino Uno in a smaller size and is cheaper than the UNO. The
mini has a length of about 3cm and is hence suitable for compact projects like small
robots. But in the mini version, you still have the problem of the controller IC being
surface mounted on the board.
Arduino Uno: If you are a beginner trying to get into the world of Arduino, the best
option for you would be the Arduino Uno R3 which costs around Rs.1500. Or you can
also buy clone boards like Freeduino which you could get starting from Rs.500.
Arduino has 14 Digital pins and 6 Analog pins. So you have a total of 20 GPIO pins
(General Purpose Input Output pins), which is good enough for much of the beginner
and intermediate level projects. It also has a pair of Rx and Tx pins to connect Serial
Communication Devices. Apart from that, a separate pair of Rx and Tx pins can be
defined by including the header file SoftwareSerial.
The Arduino Uno R3 comes in two models; the normal version and the SMD version.
In the SMD version you have the Atmega328 controller IC as an SMD chip soldered
into the board, whereas in the normal version the IC is held on, the Arduino by an IC
Holder. The better option for beginners would be the Normal version. Even if you fry
your controller IC accidently while working on your project, you may restore normal
working by just replacing the IC. If you have an SMD Arduino, then you may end up
replacing the Arduino board if you get the IC fried up.
Choosing which board you want depends on the type of project you want to make, and
your experience in programming. If you have no experience in programming or
electronics, you will find the Arduino a steeper learning curve than the Raspberry Pi
as you will have to learn them both at the same time.
The Arduino is based on hardware, which means you won’t get far without some
components: LCDs, LEDs, resistors, motors etc. Depending upon what project you
want to do. You need no experience or components to get the Raspberry Pi to do
something. Just plug and play. If you want to make a hardware project, then the
Arduino is the best choice. If you want to make a software project, then the Raspberry
Pi is the way to go.
Chapter V
INTRODUCTION:
Different kinds of websites have different purposes depending on who the intended
audience is. Some websites are geared towards selling products and other websites are
geared towards providing practical information, while others are merely for
entertainment. Let’s take a look at some of the different types of websites that are out
there –
Our website “Agri Weather” comes under the ambit of informative/ practical
information websites category. Purpose of informative website is to convey specific
and helpful information to a specific user/ audience so that reader learns new things or
understands a topic better. These websites are geared around more actionable
information and may contain guidance, support information, instructions, directions et
cetera.
OBJECTIVE:
The objective with which this website is created and launched are pointed out below
as follows.
The name of the website is chosen as Agri Weather and put the ambit of
informative/practical information category and this has been done with a certain
motive. It has been designed in a manner perceivable by all and therefore easy to
collect data and information. This site gives update on various weather parameters few
of which are not typical but out of the box viz. Soil temperature, soil ph, solar
radiation et cetera, CO level along with standard parameters like air temperature, air
pressure, wind speed, relative humidity, air quality and other. And thereafter to create
a repository for future referencing and analysis.
In this section an elaborate stepwise algorithm is provided for the new learners on how
to initiate and process the design and implementation and then launching of a website.
Step 1: Start
Step 3: Figure out the minute specifications of the service and/or product.
Step 4: Start with the template design of the website and develop it simultaneously.
Step 5: Chalk out the Content of the Site and accordingly prepare the buttons of the
home page.
Step 6: Next step in to code and test the functionality of the website before validation.
Step 7: Set up the Search Engine Optimization (SEO) and Online promotion schemes
on various platforms.
Step 10: Look for feedback and short falls and rectify them and modify on the positive
feedbacks.
In the simplest terms, a website should be easy to grasp and comprehend so that the
user can in the very first go, knows what to find, where to find and how to find. And
for this purpose, the site map should be clearly framed out.
Fig 5.10: Process Flow Representation of Website Design & Development; P.C: webpagefx.com
DEVELOPMENT PLATFORM:
Wix.com Ltd. is an Israeli cloud-based web development platform that was first
developed and popularized by the Israeli company also called Wix. It allows users to
create HTML5 web sites and mobile sites through the use of online drag and
drop tools. Users may add functionality such as social plug-ins, e-commerce, online
marketing, contact forms, e-mail marketing, and community forums to their web sites
using a variety of Wix-developed and third-party applications.
SIMILAR PLATFORM:
Similar to wix.com, there are similar platform where we can design website templates
and launch it on the internet. All these different platforms come with the own pros and
cons. These platforms are however more or less the same. It is therefore on the
designer’s discretion on which of these several platforms to use. In the figures below,
few of the most popular and commonly used website designing platforms is shown.
The only bone of contention is after being launched, to make these websites more
reachable to people and the society, an annual charge has to be paid which is pretty
nominal based on the features they provide to the designers.
Fig 5.11: Few Platforms for designing web templates and launching of Sites
FUTURE PLAN:
Chapter VI
Android apps are written in the Java programming language and use Java core
libraries. They are first compiled to Android Studio to run on the Android virtual
machine, which is a virtual machine specially designed for mobile devices.
Developers may download the Android software development kit (SDK) from the
Android website. The SDK includes tools, sample code and relevant documents for
creating Android apps.
Novice developers who simply want to play around with Android programming can
make use of the App Inventor and AppyPie and other applications. Using this online
application, a user can construct an Android app as if putting together pieces of a
puzzle.
Currently 77% of the world’s population is online. With the rapid adoption of smart
phones and tablets businesses are faced with more and more opportunities every day
that will radically change how their service or product is delivered and accessed.
1. IDEA:
While every app starts with a core idea, your initial idea probably isn’t enough to
build an app which makes money or get an audience. You need to build an app which
caters to a large enough market yet is also specific enough to resonate with particular
users.
2. DESIGN:
Depending on your app budget and project scope, the design phase can be completed
in a single afternoon or can take a team thousands of hours. This is when you start
working on the look and feel of your app, since you already know the features and
outcomes you will seek to deliver to the user
4. TESTING:
With mobile app development, it’s a good idea to test as early and often. Doing this
will keep final costs low. The farther in you go into the development cycle the costlier
it becomes to fix bugs.
You should always refer to the original design and planning documents while building
out the various test cases.
5. LAUNCH:
The launch phase of the app development life cycle is critical to the success of your
app. Botch this phase, and all the hard work and money you have invested will go
down the drain. The objective of the launch phase is to get your app in the hands of as
many users as possible.
APPLICATION FUNDAMENTALS:
Android apps can be written using Kotlin, Java, and C++ languages. The Android
SDK tools compile your code along with any data and resource files into an APK,
an Android package, which is an archive file with an .apk suffix. One APK file
contains all the contents of an Android app and is the file that Android-powered
devices use to install the app.
Each Android app lives in its own security sandbox, protected by the following
Android security features:
The Android operating system is a multi-user Linux system in which each app is a
different user.
By default, the system assigns each app a unique Linux user ID (the ID is used only
by the system and is unknown to the app). The system sets permissions for all the files
in an app so that only the user ID assigned to that app can access them.
Each process has its own virtual machine (VM), so an app's code runs in isolation
from other apps.
AEIE 891 – B.E. – AEIE – UIT, BU Page 69
Smart Weather Station 2018
By default, every app runs in its own Linux process. The Android system starts the
process when any of the app's components need to be executed, and then shuts down
the process when it's no longer needed or when the system must recover memory for
other apps.
The Android system implements the principle of least privilege. That is, each app, by
default, has access only to the components that it requires to do its work and no more.
This creates a very secure environment in which an app cannot access parts of the
system for which it is not given permission. However, there are ways for an app to
share data with other apps and for an app to access system services:
It's possible to arrange for two apps to share the same Linux user ID, in which case
they are able to access each other's files. To conserve system resources, apps with the
same user ID can also arrange to run in the same Linux process and share the same
VM. The apps must also be signed with the same certificate.
An app can request permission to access device data such as the user's contacts, SMS
messages, the mountable storage (SD card), camera, and Bluetooth. The user has to
explicitly grant these permissions.
App components are the essential building blocks of an Android app. Each component
is an entry point through which the system or a user can enter your app. Some
components depend on others.
There are four different types of app components:
Activities
Services
Broadcast receivers
Content providers
Each type serves a distinct purpose and has a distinct lifecycle that defines how the
component is created and destroyed. The following sections describe the four types of
app components.
ACTIVITIES:
An activity is the entry point for interacting with the user. It represents a single screen
with a user interface. For example, an email app might have one activity that shows a
list of new emails, another activity to compose an email, and another activity for
reading emails. Although the activities work together to form a cohesive user
experience in the email app, each one is independent of the others. As such, a different
app can start any one of these activities if the email app allows it. For example, a
camera app can start the activity in the email app that composes new mail to allow the
user to share a picture
We implement an activity as a subclass of the Activity class.
SERVICES:
BROADCAST RECEIVERS:
A broadcast receiver is a component that enables the system to deliver events to the
app outside of a regular user flow, allowing the app to respond to system-wide
broadcast announcements. Because broadcast receivers are another well-defined entry
into the app, the system can deliver broadcasts even to apps that aren't currently
running. So, for example, an app can schedule an alarm to post a notification to tell
the user about an upcoming event... and by delivering that alarm to a Broadcast
Receiver of the app, there is no need for the app to remain running until the alarm
goes off. Many broadcasts originate from the system-for example, a broadcast
announcing that the screen has turned off, the battery is low, or a picture was captured.
Apps can also initiate broadcasts-for example, to let other apps know that some data
has been downloaded to the device and is available for them to use. Although
broadcast receivers don't display a user interface, they may create a status bar
notification to alert the user when a broadcast event occurs. More commonly, though,
a broadcast receiver is just a gateway to other components and is intended to do a very
minimal amount of work. For instance, it might schedule a JobService to perform
some work based on the event with JobScheduler.
A broadcast receiver is implemented as a subclass of BroadcastReciever and each
broadcast is delivered as an Intent object. For more information, see
the BroadcastReciever class.
CONTENT PROVIDERS:
A content provider manages a shared set of app data that you can store in the file
system, in a SQLite database, on the web, or on any other persistent storage location
that your app can access. Through the content provider, other apps can query or
modify the data if the content provider allows it. For example, the Android system
provides a content provider that manages the user's contact information. As such, any
app with the proper permissions can query the content provider, such
as ContactsContract.Data, to read and write information about a particular person. It
is tempting to think of a content provider as an abstraction on a database, because
there is a lot of API and support built in to them for that common case. However, they
have a different core purpose from a system-design perspective. To the system, a
content provider is an entry point into an app for publishing named data items,
identified by a URI scheme. Thus an app can decide how it wants to map the data it
contains to a URI namespace, handing out those URIs to other entities which can in
turn use them to access the data.
CONSTRUCTION OF APP:
Step 1: The first step is to take a responsive website that you want to convert in
android app important point to note is that it should be a responsive(mobile friendly)
website.
Here we are using our own
https://uitweatherstation.wixsite.com/agriweather
to convert into android application using WebView which is Mobile responsive site.
Step 3: Open res -> layout -> activity_main.xml (or) main.xml, create the
application interface and add webView element to it.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" /></RelativeLayout>
Step 4: Open src -> package -> MainActivity.java. Here firstly declare a webView
variable, make JavaScript enable and load the URL of the website.
package com.example.barai.agriweather;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
webView = (WebView)findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("http://mobile.dudasite.com/site/uitweatherstationwixsite");
webView.setWebViewClient(new WebViewClient());
}
@Override
public void onBackPressed() {
if(webView.canGoBack()) {
webView.goBack();
}else{
super.onBackPressed();
}
}
}
Step 5: Now to add back buttons to the application to need to add following code to
your MainActivity.java class.
@Override
public void onBackPressed() {
if(webView.canGoBack()) {
webView.goBack();
}else{
super.onBackPressed();
}
Step 6: Open AndroidManifest.xml file and add internet permission to it just after
the package name. It is required because the App will load data directly from the
website.
<uses-permission android:name="android.permission.INTERNET"></uses-
permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</manifest>
Chapter VII
PROJECT IMPLEMENTATION
In this section, we will discuss and elaborate on step wise implementation of the
project and hardwire assembly followed by coding, compiling, debugging and
execution of the codes to see and check whether the sensors are working as per our
expectation or not. Once each one of the sensors acts according to the desirable result,
the next step will be to upload the data into the web server so that others can have
access to these data via our designed website and android app named Agri Weather.
Along with allowing other people and users to have access to our data, we will also
create a data repository in csv file format and also the system will be able to provide a
graphical representation of the data recorded on time scale for easier understanding
and comprehension.
In section will provide a pictorial depiction of the assembled set – up of each one of
the measured parameters and will also show case the values obtained while the
programs were executed.
There are ten parameters in total which were considered in the Smart Weather Station
viz. Air Quality, CO in PPM, Soil Temperature, Air Temperature, Relative Humidity,
Soil Moisture Content, Atmospheric Pressure, Rain Fall, Light Intensity and Wind
Speed. Indirectly we are capable of measuring Solar Radiation which is a function of
the Solar Cells power generation and the area of cross section of the solar panels.
Also as the system is self – powered, we have solar panels attached to the system that
will generate enough solar energy to drive all our sensors and actuators.
The solar panel set up here itself is self-regulatory and is capable of adjusting its
panels according to the position of the sun so that the panels can be exposed to the
maximum solar intensity and enhance the conversion factors and efficiency levels.
The sensors that are used by us in this project implementation are LDR for light
intensity, DHT22 for humidity and temperature, LM35 for soil temperature, BMP180
for atmospheric pressure, BS1881 Hall Effect sensor for anemometer DS18B20 digital
water proof sensor for soil temperature, HC – SR04 US Sensor for rain fall
measurement via level measurement, BH1705 for measuring light intensity. Among
other sensors, ACS712 Hall Effect current sensor and ZMPT101B Voltage sensors are
also used.
Raspberry Pi 3 Model B, Arduino UNO, Arduino Nano and Arduino Mega2560 are
the controller units that are used to control the sensors and devices and as I/O
regulators.
The actuator elements used are L293D motor driver IC, 12 V DC motor, 5 V 13 Kg –
cm torque providing high speed servo motor, 5 V DC submersible pump and 2.4 inch
TFT LCD screen for display.
For power generation and storage, a 12 V 20 W Solar panel is used along with a 12 V
6Ah battery. As reserve and ancillary power supply, two 9 V lithium batteries are
used.
Among other components, 4X3 plywood board for accommodating the entire set - up,
wooden chassis for mounting the solar panels and suitable bearing for movement of
the solar panels and anemometer cups are used.
This is subsequent paragraphs we will elaborate the assembly of the individual set –
up with the output as obtained while executing the code section. The results obtained
are very much in congruence with the actual data which are cross referenced by other
measuring devices
The below diagram provides the block diagram representation of the Smart Weather
Station.
The soil moisture sensor consists of two probes which are used to measure the
volumetric content of water. The two probes allow the current to pass through the soil
and then it gets the resistance value to measure the moisture value.
When there is more water, the soil will conduct more electricity which means that
there will be less resistance. Therefore, the moisture level will be higher. Dry soil
conducts electricity poorly, so when there will be less water, then the soil will conduct
less electricity which means that there will be more resistance. Therefore, the moisture
level will be lower.
This sensor can be connected in two modes; Analog mode and digital mode. First, we
will connect it in Analog mode and then we will use it in Digital mode.
The Module also contains a potentiometer which will set the threshold value and then
this threshold value will be compared by the LM393 comparator. The output LED will
light up and down according to this threshold value.
The below figures represent the hardware setup and implementation and the runtime
output from the module.
The amount of water vapor in the air at any given time is usually less than that
required to saturate the air. The relative humidity is the percent of saturation humidity,
generally calculated in relation to saturated vapor density.
DHT11 or the DHT22 sensor for measuring temperature and humidity with the
Arduino board. DHT22 is the more expensive version which obviously has better
specifications. Its temperature measuring range is from -40 to +125 degrees Celsius
with +-0.5 degrees accuracy, while the DHT11 temperature range is from 0 to 50
degrees Celsius with +-2 degrees accuracy. Also the DHT22 sensor has better
humidity measuring range, from 0 to 100% with 2-5% accuracy, while the DHT11
humidity range is from 20 to 80% with 5% accuracy.
AEIE 891 – B.E. – AEIE – UIT, BU Page 88
Smart Weather Station 2018
Figures provided below represent the hardware set-up of the DHT22 module and the
runtime output of the same.
Here in our project we have used ultrasonic sensors to determine the height of the
container till which it is filled. The ultrasonic sensor is also fed to a controller which
performs two operations. Firstly it sends the data to the serial monitor for display and
recording from where it is uploaded in the web server and secondly it drives the
operation of a pump. The submersible motor is used to vacate the container upon
reaching up to a certain limit beyond which the container will overflow.
Figures below show the actual hardware set-up and the runtime output of this rain
gauge.
Soil temperature plays an important part of the soil ecology and as part of the
meteorological data. For measuring the soil temperature, we have used LM35 sensor.
The sensor is wrapped with water proof heat sink and then put inside the soil. The
other end of the sensor is fixed to Arduino mega for data collection and uploading.
Speed and direction of wind play a vital role in the weather vis – a – vis climate of a
region as evaporation and transpiration rates are greatly determined by them. Here in
our weather station, we therefore have designed a low cost anemometer to determine
and record the speed of wind by using hall-effect sensors. The set-up contains a rod
containing two magnets passing by a Hall-effect sensor and on top of the rod there are
four cups mounted to receive the wind and the rod is housed on ball bearing for
friction free rotation.
In a Hall-effect sensor, a thin strip of metal has a current applied along it. In the
presence of a magnetic field, the electrons in the metal strip are deflected toward one
edge, producing a voltage gradient across the short side of the strip (perpendicular to
the feed current). Hall-effect sensors have an advantage over inductive sensors in that,
while inductive sensors respond to a changing magnetic field which induces current in
a coil of wire and produces voltage at its output, Hall-effect sensors can detect static
(non-changing) magnetic fields.
In its simplest form, the sensor operates as an analog transducer, directly returning a
voltage. With a known magnetic field, its distance from the Hall plate can be
determined. Using groups of sensors, the relative position of the magnet can be
deduced.
We have used a US1881 hall – effect sensor that is an integrated Hall-Effect latched
sensor. Holding a magnet near the sensor will cause the output pin to toggle. This
makes for a robust presence sensor. A reed sensor also works nicely, but can be
limited by the glass encapsulation and size. A Hall-Effect sensor is much smaller, but
can handle less current than a reed switch.
The device includes an on-chip Hall voltage generator for magnetic sensing, a
comparator that amplifies the Hall voltage, and a Schmitt trigger to provide switching
hysteresis for noise rejection, and open-collector output. An internal bandgap
If a magnetic flux density larger than threshold Bop, DO is turned on (low). The
output state is held until a magnetic flux density reversal falls below Brp causing DO
to be turned off (high).
Figures below show the hardwire implementation and runtime output of the designed
anemometer.
In order to measure air temperature, DHT22 sensors are used in our project, which is a
dual sensor capable of measuring temperature and relative humidity.
A thermistor is actually a variable resistor that changes its resistance with change of
the temperature. These sensors are made by sintering of semi conductive materials
such as ceramics or polymers in order to provide larger changes in the resistance with
just small changes in temperature. The term “NTC” means “Negative Temperature
Coefficient”, which means that the resistance decreases with increase of the
temperature.
Measurements from a mercury barometer are usually made in inches of Mercury (in
Hg). An aneroid barometer can be used in place of a mercury barometer. It is easier to
move and is often easier to read. This instrument contains sealed wafers that shrink or
spread out depending on changes of atmospheric pressure.
sufficient to measure the temperature only once per second and to use this value for all
pressure measurements during the same period.
The below figures show the assembly of BMP180 module on the set – up and also
show the runtime output of the module.
We have used MQ135 sensor module for monitoring and recording of the air quality.
The MQ-135 gas sensor senses the gases like ammonia nitrogen, oxygen, alcohols,
aromatic compounds, sulfide and smoke. The boost converter of the chip MQ-3 gas
sensor is PT1301. The operating voltage of this gas sensor is from 2.5V to 5.0V. The
MQ-3 gas sensor has a lower conductivity to clean the air as a gas sensing material. In
the atmosphere we can find polluting gases, but the conductivity of gas sensor
increases as the concentration of polluting gas increases. MQ-135 gas sensor can be
implementation to detect the smoke, benzene, steam and other harmful gases. It has
potential to detect different harmful gases. The MQ-135 gas sensor is low cost to
purchase.
The air quality sensor is also a MQ-135 sensor for detecting venomous gases that are
present in the air in homes and offices. The gas sensor layer of the sensor unit is made
up of tin dioxide (SnO2); it has lower conductivity compare to clean hair and due to
air pollution the conductivity is increases. The air quality sensor detects ammonia,
nitrogen oxide, smoke, CO2 and other harmful gases. The air quality sensor has a
small potentiometer that permits the adjustment of the load resistance of the sensor
circuit. The 5V power supply is used for air quality sensor.
A carbon monoxide detector or CO detector is a device that detects the presence of the
carbon monoxide (CO) gas in order to prevent carbon monoxide poisoning. In the late
1990s Underwriters Laboratories changed their definition of a single station CO
detector with a sound device in it to a carbon monoxide (CO) alarm. This applies to all
CO safety alarms that meet UL 2034 standard; however for passive indicators and
system devices that meet UL 2075, UL refers to these as carbon monoxide detectors.
Here in our project we have utilized MQ7. Sensitive layer of MQ-7 gas sensitive
components is made of SnO2 with stability. So, it has excellent long term stability. Its
service life can reach 5 years under using condition. Resistance value of MQ-7 is
difference to various kinds and various concentration gases.
Figures below shows the MQ7 sensor in operation along with the runtime output.
Luminous intensity, the quantity of visible light that is emitted in unit time per unit
solid angle. The unit for the quantity of light flowing from a source in any one second
(the luminous power, or luminous flux) is called the lumen. The lumen is evaluated
with reference to visual sensation.
Figures below show the hardware assembly and runtime output from the module.
Solar radiation is radiant energy emitted by the sun from a nuclear fusion reaction that
creates electromagnetic energy. The spectrum of solar radiation is close to that of a
black body with a temperature of about 5800 K. About half of the radiation is in the
visible short-wave part of the electromagnetic spectrum. The other half is mostly in
the near-infrared part, with some in the ultraviolet part of the spectrum.
The device is typically used in agricultural applications, and is used in the calculation
of Evapotranspiration. Evapotranspiration is the potential for evaporation of moisture
from the soil (or the reverse of rainfall) and is a function solar energy, wind and
temperature.
A very cheap and efficient way of measuring solar radiation is by using a solar panel.
The formula of measuring solar radiation using solar panel is provided as under
Fig 7.22: Actual Solar Panel Set – Up for Solar Radiation Calculation
Here in this set – up, the objective is to make the solar panel rotate and revolve about
its axes to align itself according to the position of the sun in order to make maximum
sunlight incident on the panels.
For this, we have made a chassis capable of rotating and revolving about two axes, i.e.
one axis being from east to west with a rotation of 180° and the other axis being from
north to south with a rotation of 360°.
LDR sensors are mounted on the edges of the solar panel and a comparator circuit is
built that will compare the light intensity incident on the panel. The controller on
being fed with the comparator result will direct the actuator elements to position
themselves in such a manner such that the intensity is at balanced positon or place the
panel in alignment with the LDR receiving maximum intensity. As actuator elements,
we have used to servo motor on two different arms holding the panels for movement
from east to west.
The figures below represent the logical block diagram and the actual set – up diagram
of the tracking panels in real life scenario with measured results that proved more
efficient.
Fig 7.23: Block Diagram of Dual Axes Sun Tracking Solar Panel
After final set-up and comparison of the power ratings obtained it is found that the
tracking solar panels do produce 25% more efficiency than the fixed solar panels.
Chapter VIII
After the sensors sense data, the data are sent to the controller unit. The Arduino Mega
is connected to ESP8266 Wi – FI module. This ESP8266 send out the data to a
network server. Two channels with twelve field for twelve different parameters are
created on Thingspeak which is an open source IOT application and API where data
can be stored and later retrieved.
For the internet connection, the ESP8266 WiFi (serial) module is used because it is
small, cheap and easy to use, and for data logging the open data platform is used for
the Internet of Things "ThingSpeak".
The ESP8266-01 is the smallest ESP8266 module and only has 8 pins. Of these VCC,
GND, RST (reset) and CH_PD (chip select) are not I/O pins but are needed the
operation of the module. This leaves GPIO0, GPIO2, TX and RX available as possible
I/O pins, but even these have pre-assigned functions. The GPIO0 and GPIO2
determine what mode the module starts up in and the TX/RX pins are used to program
the module and for Serial I/O, commonly used for debugging. GPIO0 and GPIO2
need to have pull-up resistors connected to ensure the module starts up correctly.
Source Code:
The following code section is used to establish connection via Wi – Fi Module &
upload data to ThingSpeak.
#include <stdlib.h>
#include <SoftwareSerial.h>
int error;
int field1;
int field2;
int field3;
int field4;
int field5;
int field6;
int field7;
int field8;
int field9;
int field10;
int field11;
int field12;
int field13;
int field14;
int field15;
int field16;
void setup() {
Serial.begin(9600);
esp8266.begin(115200); //use default 115200 for esp8266.
esp8266.println("AT");
delay(5000);
if(esp8266.find("OK")){
connectWiFi();
}
// put your setup code here, to run once:
}
void loop() {
start: //label
error=0;
// put your main code here, to run repeatedly:
cmd += field3;
cmd += "&field4="; //field 4 for field 4 data
cmd += field4;
cmd += "&field5="; //field 5 for field 5 data
cmd += field5;
cmd += "&field6="; //field 6 for field 6 data
cmd += field6;
cmd += "&field7="; //field 7 for field 7 data
cmd += field7;
cmd += "&field8="; //field 8 for field 8 data
cmd += field8;
cmd += "\r\n\r\n";
esp8266.print("AT+CIPSEND=");
esp8266.println(cmd.length());
if(esp8266.find(">")){
esp8266.print(cmd);
Serial.print("Data Uploaded in Channel 1");
}
else{
esp8266.println("AT+CIPCLOSE");
Serial.println("Error Uploading Data in Channel 1");
}
}
esp8266.println(cmd);
delay(2000);
if(esp8266.find("Error")){
return;
}
cmd = api2 ;
cmd += "&field1="; //field 1 for field 9 data
cmd += field9;
cmd += "&field2="; //field 2 for field 10 data
cmd += field10;
cmd += "&field3="; //field 3 for field 11 data
cmd += field11;
cmd += "&field4="; //field 4 for field 12 data
cmd += field12;
cmd += "&field5="; //field 5 for field 13 data
cmd += field13;
cmd += "&field6="; //field 6 for field 14 data
cmd += field14;
cmd += "&field7="; //field 7 for field 15 data
cmd += field15;
cmd += "&field8="; //field 8 for field 16 data
cmd += field16;
cmd += "\r\n\r\n";
esp8266.print("AT+CIPSEND=");
esp8266.println(cmd.length());
if(esp8266.find(">")){
esp8266.print(cmd);
Serial.print("Data Uploaded in Channel 2");
}
else{
esp8266.println("AT+CIPCLOSE");
Serial.println("Error Uploading Data in Channel 2");
}
}
When programming the ESP8266 using the Arduino IDE, we sometimes encounter
these error messages as cited below.
GPIO1 (TX) is used as the Data line, because we will always get some debug
output on GPIO1 on power up. There is no way to suppress this output, but the
Clock line (RX) will be held high so none of this data will be clocked to the
slaves
When programming the ESP8266, the RX line is connected to the programmer's
output. At the end of the programming the ESP8266 reboots and 330 Protection
resistor prevents RX shorting the programmer's output drive.
The I2C series resistors provide similar protection for the TX, RX from shorts
on the I2C bus
The ESP8266 is 3.3V device so preferably 3.3V I2C slaves are used. Many, but not
all, I2C devices are 3.3V these days. “In general, in a system where one device is at a
higher voltage than another, it may be possible to connect the two devices via I2C
without any level shifting circuitry in between them. The trick is to connect the pull-
up resistors to the lower of the two voltages.” (SparkFun I2C tutorial).
Using I2C is a great way to add a multi-channel A-to-D converter to the ESP8266-01
which does not expose the single ADC input of the underlying module.
THINGSPEAK UPLOAD:
ThingSpeak server is an open data platform and API for the Internet of Things that
enables us to collect, store, analyze, visualize, and act on data from sensors.
We here will try and understand how data can be sent to THingSpeak via ESP8266 Wi
– FI Module from Arduino.
The devices and equipment that we will be requiring to attain the mentioned objective
are
Arduino UNO/Mega/Nano
Sensors whose data will be uploaded.
Thingspeak Account
ESP8266 Module.
http://exosite.com
https://www.carriots.com
https://www.grovestreams.com
https://thingspeak.com
http://openenergymonitor.org
Firstly, the easy part is done and i.e. creating an account with Thingspeak. Once that is
done, one can create channels each of which can have a maximum of eight fields
representing eight data set from eight different sensors. For more than eight sensors,
one therefore has to create more channels which thankfully has no upper limit.
As we create channels, two API keys viz. Write API key and Read API key are
generated which we will later use in our program so that our website can identify the
channel created.
From thingspeak, data is further exported to the website created viz. AgriWeather and
the android app viz. AgriWeather.
AEIE 891 – B.E. – AEIE – UIT, BU Page 117
Smart Weather Station 2018
3. We can edit HTML in any plain text editor such as Notepad. In the editor we
have to add the element we copied from our channel to our html file.
<html><head><title>ThingSpeak Embedded Plot</title></head>
<body>
<iframe width="450" height="260" style="border: 1px solid #cccccc;"
src="https://thingspeak.com/channels/250296/charts/1?bgcolor=%23ffffff&color=%2
3d62020&dynamic=true&results=50&type=line&update=15"></body></html>
A data repository is provided in the website from where data can be downloaded for
future use and reference.
Chapter IX
RATIOCINATION
Going through the chapter in this report, it has been clearly established, how much
important climate and hence weather is in our day to day life and activities. All the
ecological plans, schemes, initiatives and implementations are hugely guided by the
prevailing weather condition. Hence it is also very important to pick up the right
parameters while trying to analyze and predict the weather conditions. In chapter II of
this report, we have spoken in depth of the parameters and the sensors that are used
while implementing the Smart Weather Station. Now it is claimed to a Smart system,
it is also required for us to comprehensively understand the need and utility of
Information and Communication Technology (ICT) and Internet of Things (IoT).
These sections would help us design and architect the basic framework on which
communication would have be made possible. And talking about communication, it is
meant both way communication and interactive information exchange, so that other
researchers can access the data and feed their opinions, advices and suggestions along
with modifications into it.
The need to have a website and an Android based app will add the flexibility of access
and operation. The user and operator friendly GUI will make the platform more
informative and comprehensive. With that aim and target in mind, Agri Weather
website and app were created. And these features have brought the entire hardwire set-
up within the grasp of all those person who have access to internet and/or a smart
android phone.
The main focus around which all the above mentioned topics revolved was the
implementation of the weather station as a prototype model having the capacity and
capability of being Smart. The goal has been achieved as it was implemented on a
table top board with all the features coupled together as a singular operational unit.
Albeit it is a singular unit, options and provisions are made so that partwise
troubleshooting, repairing, replacement and modifications can be made as and when
necessary. The entire cost of building this prototype is INR 10000/- (Ten Thousand)
only where its similar counterparts are available in the market at double or triple its
cost. This low price construction with the additional features of IoT and website and
app makes the station stand apart and unique from others.
However, as the room for improvement is never saturated, we are looking forward to
making this prototype model even cheaper and more accurate and precise.
CHPATER X
SOURCE CODE
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
if (client.connect(server,80)) { // "184.106.153.149" or api.thingspeak.com
String postStr = apiKey;
postStr +="&field1=";
postStr += String(t);
postStr +="&field2=";
postStr += String(h);
postStr += "\r\n\r\n";
client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" degrees Celcius, Humidity: ");
Serial.print(h);
Serial.println("%. Send to Thingspeak.");
}
client.stop();
Serial.println("Waiting...");
// thingspeak needs minimum 15 sec delay between updates, i've set it to 30 seconds
delay (30000);
}
}
int BME280_Read(int address) //
{
int i=0;
Wire.beginTransmission(address);
Wire.requestFrom(address, 2);
while(Wire.available()) //
{
buff[i] = Wire.read(); // receive one byte
i++;
}
Wire.endTransmission();
return i;
}
void BME280_Init(int address)
{
Wire.beginTransmission(address);
Wire.write(0x10);//1lx reolution 120ms
Wire.endTransmission();
}
SFE_BMP180 pressure;
#define ALTITUDE 9.1 // Altitude of SparkFun's HQ in Boulder, CO. in meters
void setup()
{
Serial.begin(9600);
Serial.println("REBOOT");
// Initialize the sensor (it is important to get calibration values stored on the device).
if (pressure.begin())
Serial.println("BMP180 init success");
else
{
// Oops, something went wrong, this is usually a connection problem,
// see the comments at the top of this sketch for the proper connections.
Serial.println("BMP180 init fail\n\n");
while(1); // Pause forever.
}
}
void loop()
{
char status;
double T,P,p0,a;
// Loop here getting pressure readings every 10 seconds.
// If you want sea-level-compensated pressure, as used in weather reports,
// you will need to know the altitude at which your measurements are taken.
// We're using a constant called ALTITUDE in this sketch:
Serial.println();
Serial.print("provided altitude: ");
Serial.print(ALTITUDE,0);
Serial.print(" meters, ");
Serial.print(ALTITUDE*3.28084,0);
Serial.println(" feet");
// If you want to measure altitude, and not pressure, you will instead need
// to provide a known baseline pressure. This is shown at the end of the sketch.
// You must first get a temperature measurement to perform a pressure reading.
// Start a temperature measurement:
// If request is successful, the number of ms to wait is returned.
// If request is unsuccessful, 0 is returned.
status = pressure.startTemperature();
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
// Retrieve the completed temperature measurement:
// Note that the measurement is stored in the variable T.
// Function returns 1 if successful, 0 if failure.
status = pressure.getTemperature(T);
if (status != 0)
{
// Print out the measurement:
Serial.print("temperature: ");
Serial.print(T,2);
Serial.print(" deg C, ");
Serial.print((9.0/5.0)*T+32.0,2);
Serial.println(" deg F");
// Start a pressure measurement:
// The parameter is the oversampling setting, from 0 to 3 (highest res, longest
wait).
// If request is successful, the number of ms to wait is returned.
// If request is unsuccessful, 0 is returned.
status = pressure.startPressure(3);
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
// Retrieve the completed pressure measurement:
// Note that the measurement is stored in the variable P.
// Note also that the function requires the previous temperature measurement (T).
// (If temperature is stable, you can do one temperature measurement for a
number of pressure measurements.)
// Function returns 1 if successful, 0 if failure.
status = pressure.getPressure(P,T);
if (status != 0)
{
// Print out the measurement:
Serial.print("absolute pressure: ");
Serial.print(P,2);
Serial.print(" mb, ");
Serial.print(P*0.0295333727,2);
Serial.println(" inHg");
// The pressure sensor returns abolute pressure, which varies with altitude.
// To remove the effects of altitude, use the sealevel function and your current
altitude.
// This number is commonly used in weather reports.
// Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m.
// Result: p0 = sea-level compensated pressure in mb
}
else Serial.println("error starting temperature measurement\n");
delay(5000); // Pause for 5 seconds.
}
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);
/* uncomment this to get temperature in Fahrenheit
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();
*/
}
if(sensorValue2>=820)
Serial.print("Soil Sample 2 :very low moist");
else if(sensorValue2>=615 && sensorValue2<820)
Serial.print("Soil Sample 2 :low moist");
Serial.print(x);
Serial.print("mm");
Serial.print("\n");
//delay(5000);
if(height<=90)
digitalWrite(4,HIGH);
else
digitalWrite(4,LOW);
delay(5000);
}
}
c = a - b;
if (a > b)
{
c = map(c, 0, 1023, 0, 120);
d = map(c, 0, 1023, 120, 0);
//digitalWrite(3,HIGH);
//digitalWrite(4,LOW);
}
else if (a < b)
{
c = 0 - c;
c = map(c, 0, 1023, 120, 0);
d = map(c, 0, 1023, 0, 120);
//digitalWrite(3,LOW);
//digitalWrite(4,HIGH);
}
else {
servo1.detach();
servo2.detach();
//digitalWrite(3,LOW);
//digitalWrite(4,LOW);
}
if (e > f)
{
//c=map(c,0,1023,0,120);
//d=map(c,0,1023,120,0);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
}
else if (e < f)
{
//c=0-c;
//c=map(c,0,1023,120,0);
//d=map(c,0,1023,0,120);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
}
else {
//servo1.detach();
//servo2.detach();
digitalWrite(9, LOW);
digitalWrite(10, LOW);
}
Serial.print("a=");
Serial.print(a);
Serial.print("b=");
Serial.print(b);
Serial.print("e=");
Serial.print(e);
Serial.print("f=");
Serial.print(f);
Serial.print("\n");
servo1.write(c);
servo2.write(d);
delay(2000);
}
#include <DHT.h>;
#include <SFE_BMP180.h>
#include <Wire.h>
#include <math.h>
#define ALTITUDE 36
SFE_BMP180 pressure;
int rain;
int trigpin=9;
int echopin=10;
int relaypin=4;
float x;
long duration;
float height;
float realheight;
byte buff[2];
int co_value;
int limit;
int air_quality_Value;
float measure_vol;
float v;
int chk;
float hum;
float temp;
char status;
double T,P,p0,a;
int LM_val1;
int LM_val2;
void setup()
Serial.begin(9600);
pinMode(trigpin,OUTPUT);
pinMode(echopin,INPUT);
pinMode(relaypin, OUTPUT);
dht.begin();
Wire.begin();
pressure.begin();
half_revolution = 0;
rpm = 0;
timeold = 0;
Wire.beginTransmission(address);
Wire.endTransmission();
int i=0;
Wire.beginTransmission(address);
Wire.requestFrom(address, 2);
while(Wire.available()) //
i++;
Wire.endTransmission();
return i;
void rpm_fun()
half_revolution++;
Serial.print("wind speed=");
Serial.print(v);
Serial.print("\n");
void loop()
rain=analogRead(A7);
if(rain>=1000)
digitalWrite(trigpin,LOW);
delayMicroseconds(2);
digitalWrite(trigpin,HIGH);
delayMicroseconds(10);
digitalWrite(trigpin,LOW);
duration=pulseIn(echopin,HIGH);
height=duration*0.34/2;
realheight=135-height;
x=0.205*realheight;
Serial.print(height);
Serial.print("Rainfall: ");
Serial.print(x);
Serial.print("mm");
Serial.print("\n");
if(height<=90)
digitalWrite(4,HIGH);
else
digitalWrite(4,LOW);
int i;
uint16_t val=0;
BME280_Init(BME280address);
delay(200);
if(2==BME280_Read(BME280address))
val=((buff[0]<<8)|buff[1])/1.2;
Serial.print(val,DEC);
Serial.print(ALTITUDE,0);
status = pressure.startTemperature();
if (status != 0)
delay(status);
status = pressure.getTemperature(T);
if (status != 0)
Serial.print("temperature_bmp180: ");
Serial.print(T,2);
status = pressure.startPressure(3);
if (status != 0)
delay(status);
status = pressure.getPressure(P,T);
if (status != 0)
Serial.print(P,2);
a = pressure.altitude(P,p0);
Serial.print(a,0);
co_value = analogRead(A0);
measure_vol=(float)air_quality_Value/1024*5,0;
Serial.print(air_quality_Value);
Serial.print("\n");
Serial.print("CO QUANTITY=");
Serial.print(co_value);
Serial.print("\n");
Serial.print("VOLUME=");
Serial.print(co_value);
v=(0.15*rpm*60)/1000;
timeold = millis();
half_revolution = 0;
hum = dht.readHumidity();
temp= dht.readTemperature();
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print(temp);
Serial.println(" Celsius");
LM_val1 = analogRead(A3);
LM_val2 = analogRead(A4);
Serial.print("SOIL_TEMPRATURE_sample1 = ");
Serial.print(cel1);
Serial.print("*C");
Serial.println();
Serial.print("SOIL_TEMPRATURE_sample2 = ");
Serial.print(cel2);
Serial.print("*C");
Serial.println();
int sensorValue1=analogRead(A5);
int sensorValue2=analogRead(A6);
if(sensorValue1>=820)
else
Serial.print("\n");
//Serial.println(sensorValue1);
if(sensorValue2>=820)
else
Serial.print("\n");
//Serial.println(sensorValue2);
REFERENCES
1. www.iotLeague.com
2. http://www.bitscope.com/blog/FM/?p=GF10B
3. https://tutorials-raspberrypi.com/raspberry-pi-sensors-overview-50-important-
components/
4. http://www.instructables.com/id/Raspberry-Pi-Temperature-Humidity-Network-
Monitor/
5. http://www.uugear.com/portfolio/read-dht1122-temperature-humidity-sensor-
from-raspberry-pi/
6. https://potentiallabs.com/cart/grove-pi-shield-raspberry-pi-online-india - GrovePi
7. http://www.instructables.com/id/GroveWeatherPi-Raspberry-Pi-Based-Weather-
Station-/
8. https://www.raspberrypi.org/blog/school-weather-station-project/
9. www.searchitchannel.techtarget.com
10.http://www.datasheet4u.com/
11.https://circuitdigest.com/internet-of-things-iot-projects
12.https://circuitdigest.com/microcontroller-projects/raspberry-pi-iot-weather-station-
to-monitor-temperature-humidity-pressure
13.https://www.webconfs.com/1191/guide-how-to-create-a-website-development-
process-for-your-clients/
14.https://www.a1dezine.com/articles/page/3/
15.https://www.webpagefx.com/blog/web-design/a-6-step-general-process-for-
producing-a-website/
16.http://imcreator.com/
17.https://wordpress.com/
18.https://get.weebly.com/
19.https://www.squarespace.com/
20.http://wix.com
21.https://developer.android.com/studio/intro/
22.http://www.alldatasheet.com/
23.https://datasheet-alldatasheet-com.soft112.com/
24.https://www.epa.gov/air-quality...process/managing-air-quality-ambient-air-
monitoring
25.https://www.elprocus.com/mq-135-alcohol-sensor-circuit-and-working/
26.https://en.wikipedia.org/wiki/Carbon_monoxide_detector
27.https://www.sparkfun.com/datasheets/Sensors/Biometric/MQ-7.pdf
28.https://www.ambientweather.com/solarradiation.html
29.https://www.britannica.com/science/luminous-intensity
30.https://www.windows2universe.org/earth/Atmosphere/measuring_press.html
31.https://wiki.eprolabs.com/index.php?title=Pressure_Sensor-BMP_180
32.http://www.circuitstoday.com/arduino-soil-moisture-sensor
33.http://hyperphysics.phy-astr.gsu.edu/hbase/Kinetic/relhum.html
34.https://howtomechatronics.com/tutorials/arduino/dht11-dht22-sensors-temperature-
and-humidity-tutorial-using-arduino/
35.https://en.wikipedia.org/wiki/Hall_effect_sensor
36.https://www.sparkfun.com/products/9312
37.https://stackoverflow.com/questions/16948537/adding-permissions-in-
androidmanifest-xml-in-android-studio
38.https://developer.android.com/guide/topics/manifest/manifest-intro
39.https://developer.android.com/guide/webapps/webview
40.https://google-developer-training.gitbooks.io/android-developer-fundamentals-
course-practicals/content/en/Unit%201/21_p_create_and_start_activities.html
41.https://stackoverflow.com/questions/6077141/how-to-go-back-to-previous-page-if-
back-button-is-pressed-in-webview
42.http://www.instructables.com/id/Arduino-IOT-Temperature-and-Humidity-With-
ESP8266-/
43.http://www.instructables.com/id/Send-sensor-data-DHT11-BMP180-to-
ThingSpeak-with-a/
DATA SHEET