Sei sulla pagina 1di 46

Abstract:-

This paper represents the initial steps in the development of a drinking


water quality monitoring system. This system is based on a wireless
sensors network to detect and locate in real time any change in water
quality, quantify its importance, evaluate its consequences and
determine the most appropriate actions to be taken to limit its effects.
First, we start with determining an optimal location of the quality control
points of the drinking water. Then, we move on to the development of an
anomalies detection algorithm which detects the contamination and
malicious acts in the drinking water distribution system. Finally, taking
into account the environmental parameters of our system, we propose a
data aggregation method in order to minimize the energy consumption
of the source nodes and to reduce the network load.

INTRODUCTION:-
The quality of drinking water is essential for public
health [1]. Hence, it’s necessary to prevent any intrusion into water
distribution systems and to detect pollution as soon as possible, whether
intentional or accidental [2]. The protection of the visible assets (water
storage tank, pumping station, treatment centers, etc.) can be realized by
traditional intrusion detection. As a result, the network becomes more
difficult to protect. In recent years, assistance and research programs
have been developed to improve the safety and security of drinking
water systems [3, 4]. Our project provides a new water quality
monitoring system for water distribution network based on wireless
sensor network (WSN). A detailed architecture of the system will be
explained in the next section. In section III, we present some works that
have been developed in the same context of our project. Then, we
describe in section IV our contribution to the proposed system. The fifth
section is devoted to the experimental results. Finally, we discuss
conclusions and perspectives.

Problem Statement:-
Water is the most widespread and important natural resource which
support the life on Earth. Oceans hold 97% of Earth’s surface as saline
water and the remaining 3% only occurs as fresh water, of this 2.4% is
frozen in glaciers and polar ice caps and the rest 0.6% is in liquid fresh
water forms and available in rivers, lakes, and ground water etc. (Figure
1.1). About 22% of liquid fresh water exists as ground water, which
constitutes about 97% of all liquid fresh water available for human use
which represents the availability of ground water is meager in Earth’s
total global water content (Foster, 1998). Hence in most of the countries,
the ground water is the major source of potable water. It is also widely
used for agriculture and industrial purposes in several nations. The
availability of ground water has great influence on human life as well as
other forms of life. Ground water is an important renewable natural
resource of socio-ecological significance. Particularly, ground water is
emerging as a formidable poverty-alleviation tool, which can be
delivered direct to poor community more cheaply, quickly and easily
than canal water (IWMI, 2001). Ground waterhas many advantage as it
is compared with surface water since it demands little or no treatment
and is available in plenty when surface water supply do not yield or
exist. The ground water resource is a sustainable source of water supply
if properly targeted and exploited, however uncertainties can be
expected in development and management due to complexities of
hydrogeological conditions.As South Andaman Island is one of the most
natural disaster prone zones, very frequent to earthquakes which are
often most destructive and also inherently poses various vulnerable
natural hazards such as catastrophic tsunamis, coastal floods and coastal
land subsidence etc.

The proposed study pertains to a part of South Andaman Island which


receives copious amount of rainfall, yet water scarcity prevails during
the summer season. The ground water resources of Andaman Islands are
not fully exploited is associated with numerous critical issues such as
dependency on temporal and areal distribution of precipitation, water
storage potential above and below the ground, peculiar hydrogeological
settings, sea water intrusion, coastal flood and lack of proper sustainable
development and management plan (Arenas and Huertas, 1986; Mondal
et al., 2012; Maury, 2012 and Maury and Balaji, 2014b). Moreover,
there is no proper conservation, regular monitoring and management of
aquifers which can lead to water scarcity, contamination and later on to
water crisis. In order to meet the progressive demand of water
requirement, the development andmanagement of ground water potential
zone is very essential by keeping eyes on specific issues and peculiar
hydrological conditions of South Andaman Island. Since, the ground
water studies of this island have not received much appreciation and
poorly attempted earlier. Further, good ground water database is not
available so far for South Andaman Island. It is expected the demand for
the water supply of South Andaman Island is to rise more than the
double of present requirement by the year 2025 (Maury and Balaji,
2014b). Therefore, in order to meet out the increasing demand and
supply, the delineation of ground water potential zone is essential. In this
context, the aim of the present research study is to spatially simulate and
evaluate various models of ground water importance by using various
geostatistical methods using high resolution surface and subsurface
techniques like Remote Sensing, Geophysical, Geotechnical and
Geochemical methods. These integrated techniques owing to their
versatility to permit more detailed understanding on the contrasting
hydrogeological settings of a highly diverse complex geological terrain.
This enables in developing regional hydrogeological models to evaluate
the qualitative and quantitative assessment of ground water potential
zones of South Andaman Island and to bring out appropriate strategies
for ground water development. The research substantiates and
demonstrates how synergistic approach of these techniques can be
applied with a greater success for the sustainable development and
management of ground water resources of South Andaman Island.

Source of Problem Statement:- Internet.

Literature Survey:-

Sr.No Papers Author Year Description


1 Monitoring system Alicja 2016 In this paper, we
as a tool for risk Balut, monitor the quality of
evslution in water Andrzej water and get the result
distribution system Urbaniak on IOT. And we
distribute the water by
connecting the flow
sensor.
2 Research on Chengyu 2014 In this paper, we use
placement of water Hu turbity sensor, ultrasonic
quality in water sensor, Ph sensor and
sensor in water flow sensor for monitor
distribution and distribution of
systems water.
3 Design and Dongling 2011 In this paper, we make
realization of Ma, the water quality
water quality Jian Cuil monitoring system and
information distribution. We
management distribute the water by
system using flow sensor. And
check by using turbity
sensor and ph sensor.
Applications:-
It is applicable for Building.
It is applicable for city.

Hardware:-
Turbity Sensor.
Ph Sensor.
Temperature Sensor
Atmega 328 microcontroller.
ESP8266 12E Wi-Fi Module
Relay Module
Connecting wires.

Software:-
Proteous
Arduino IDE.
Embedded C language.
References:-

[1] Lorna Fewtrel, Jamie Bartram, “Water Quality : Guidelines,


Standards and Health”. Published by IWA Publishing, London, UK, 2001.

[2] B. Tangena, P. Janssen, G. Tiesjema, E. van den Brandhof, M. Klein


Koerkamp, J. Verhoef, A. Filippi, and W. vanDelft, “A novel approach for
early warning of drinking water contamination events”. Water
Contamination Emergencies: Monitoring, Understanding and Acting,
pages 13. The Royal Society of Chemistry, 2011.

[3]A. Baáut, A. Urbaniak. „Network model as a tool for water supply


system security”.Gaz, woda i technikasanitarna, no. 9, 2013, pp.359-
363.(in Polish)

[4] R.M. Clark, S. Hakim, A. Ostfeld..“Handbook of Water and


Wastewater Systems Protection”.Springer, USA, 2011, pp.324-331.

[5] XingnanZhang,QingzhaiGeng and Yong Pang, “Study on the


integration of Water quality model and GIS,” Journal of Hydraulic
Engineering, vol.1 , pp.90-94, 2004.

[6] Zhen Liu,Debao Sun and Xuhua Yang, “Research and Development
of Geographic Information System of the Yellow River Water
Environment,” Journal of North China Institute of Water Conservancy
and Hydroelectric Power, vol.23, pp.53-56, 2002.
Background:-

In this section of the paper gives a writing survey of the current water
quality checking framework that gives a short clarification of the
frameworks that are as underneath: Fiona Regan, Antóin and Audrey
planned savvy water quality monitoring framework. In that framework
they made water quality brilliant sensors so the sensors send information
remotely to the gadget which gathers information from every one of the
hubs. This information is given to the remote server through GPRS
system and client can see information remotely. This framework is
exceptionally versatile, speedier and easy to understand, however it is
exorbitant as a result of keen sensors. Moreover, the extent of sensors
are not solid for water tap. ZulhaniRasin and Mohd Rizal Abdullah built
up a water quality monitoring framework utilizing Zigbee based remote
sensor organize. In proposing framework the sensors are associated with
a solitary circuit which is associated with the Zigbee ZMN2405HP
module. The recipient side Zigbee is associated with the PC that
demonstrates the GUI of the system circuit. In this framework the high
power Zigbee is utilized and it can be connected to little region organize,
additionally the base station is fundamental for information stockpiling.
NazleeniSamihaHaron, MohdKhuzaimi B Mahamad, Izzatdin Abdul
Aziz, MazlinaMehat built up a water quality monitoring framework for
dispensing with cost expending occupations of manual checking. In this
framework the deliberate information of water quality checking sensors
are gathered by the information pack which offers information to the
information preparing unit through GSM modem. In information
preparing unit the information from various sensors are separated and it
is constantly contrasted and the perfect parameters of the sensor esteem.
In the event that the water isn't meeting its quality parameter esteem the
ready flag is there which is associated with the bell. This framework is
not dependable for long separation additionally it will apply to just
single unit of water source. A Ning.,planned monitoring framework for
water quality. In this framework the water quality sensors gather
information, from mechanical water and civil water stockpiling, are
assembled at the sub-station at which the information are handled. This
prepared information are sent to the fundamental station through
Ethernet systems running on TCP/IP and from the primary station that
information is again separated and given to the earth division and open
office utilizing the web. This framework has expanded information
exactness, unwavering quality and effectiveness, additionally it gives
viable information administration and completely incorporated data
frameworks. In any case, the disadvantage is that it can't give constant
checking of water parameters.
Qiao Tie-Zhu, Song Le planned Online Monitoring System of Water
Quality Based on GPRS. The framework is utilized to prepare the
example and send the pertinent information to the checking focus by
means of the GPRS information transmission. The point of building up
this framework is the remote checking of water quality parameter and
makes it continuous and speedier than past framework utilized for water
quality monitoring, likewise to control water quality.
Dong He, Li-Xin Zhang built up The Water Quality Monitoring System
Based on WSN. This framework in light of remote sensor arrange that
comprises of Wireless Water Quality Monitoring Network and Remote
Data Center. The remote sensor system is based on Zigbee arrange
convention. WSN test the water quality, and sends the information to the
Internet with the assistance of the GPRS DTU, having worked in TCP/IP
convention utilized for information transmission. With the assistance of
web information is gathered at a remote server farm and broke down and
utilized for further preparing. This framework can be a long haul, steady
and continuous provincial water quality screen. This framework is
minimal effort for little territory, yet for vast range it will turn out to be
expensive.
NazleeniSamiha, planned Remote Water Quality Monitoring System
utilizing Wireless Sensors. In proposing framework the remote water
quality sensors send information carefully to the information obtaining
pack which gathers the information transmitted from all sensors. The got
advanced information is handled by the information securing pack and
prepared information send to the database at which the handled
information is contrasted and the resilience estimation of that
information. On the off chance that the water quality parameters cross
their limit esteem, then the ready message will send utilizing the GSM
module, generally information keep ceaselessly contrasting and its
resilience esteem. This procedure is essentially produced for monitoring
the water of lakes or lake.
Kulkarni Amruta, TurkaneSatish created Solar Powered Water Quality
Monitoring framework utilizing remote Sensor Network. In this
framework the WSN innovation controlled utilizing sun oriented board.
The framework comprises hub and base station in which the hub gathers
that get from the distinctive remote sensor. The hub is associated with
the base station through the Zigbee innovation that fueled by the sunlight
based board. This framework is ease yet in the event that the sun
oriented board can't be charged due to the some environment impact
then the framework will quit working. From, all above specify procedure
we come to realize that each unique framework comprise some
impediment however it can't meet the point of ongoing, minimal effort
consistent checking of water quality parameters. Along these lines, to
conquer this confinement, that lead us to be created and plan the new
technique that will minimal effort, ongoing and easy to use.

Block Diagram:
PH Sensor LCD 16x2

Temperature sensor Arduino


Relay

Conductivity sensor

Wifi Module

PH Sensor
PH is a measure of acidity or alkalinity of a solution, the pH scale ranges
from 0 to 14. The pH indicates the concentration of hydrogen [H] + ions
present in certain solutions. It can accurately be quantified by a sensor
that measures the potential difference between two electrodes: a
reference electrode (silver / silver chloride) and a glass electrode that is
sensitive to hydrogen ion. This is what form the probe. We also have to
use an electronic circuit to condition the signal appropriately and we
can use this sensor with a micro-controller, such as Arduino.

Here are some examples of everyday substances and their pH:


Substance pH approximate
Lemon juice 2,4 – 2,6
Cola drink 2,5
Vinegar 2,5 – 2,9
Orange or apple juice 3,5
Beer 4,5
Coffee 5,0
Tea 5,5
Milk 6,5
Water 7,0
Saliva 6,5 – 7,4
Blood 7,38 – 7,42
Seawater 8,0
Soap 9,0 a 10,0
Bleach 13

Pinout of signal conditioning module:

To Temperature
Do Limit pH Signal
Po Analog pH value
G Analog GND
G Supply GND
V+ Supply (5V)
Turbidity sensor

Turbidity is the quantitative measure of suspended particles in a


fluid. It can be soil in water or chocolate flakes in your favorite
milk shake. While chocolate is something we soo want in our
drinks, soil particles are totally undesired. Keeping aside the
potable purposes, there are several industrial and household
solutions that make use of water in some or other manner - for
instance, a car uses water to clean the windshield, a power plant
needs it to cool the reactors, washing machines and dish washers
depend on water like fish. Now the question arises here: how do
these machines get to know about the turbidity? We are blessed
with nature’s evolutionary gift of senses to find out soil in the
water, but what about your washing machines? No eyes to see, to
tongue to taste, no skin to feel but just a plastic body with some
buttons and motor inside. How does it so smart to work as per soil
suspension?? (If you are wondering does it even do that, the
answer is a big yes!)The answer to this is a 4.7 cm gadget:
Turbidity Sensor, which along with a micro controller unit, takes
care of turbidity measurements. Crafted with plastic and some
metal-alloy traces, turbidity sensor uses light to convey
information about turbidity in water.

When viewed from front, the turbidity sensor appears like an


Android bot. Two horn like structure, a top to bottom mono
material body. A black colored cap is placed at the bottom of the
sensor. Thick alloyed contact legs provide means for various
connectors to hold to the sensor. A white plastic slab protects the
legs from damage and act as a fixture for good clamping of the
sensor.

The plastic used to make outer structure can survive high


temperature variations as well as mechanical abrasions.

The gravity arduino turbidity sensor detects water quality by


measuring the levels of turbidity. It uses light to detect suspended
particles in water by measuring the light transmittance and
scattering rate, which changes with the amount of total
suspended solids (TSS) in water. As the TTS increases, the liquid
turbidity level increases.
Turbidity sensors are used to measure water quality in rivers and
streams, wastewater and effluent measurements, control
instrumentation for settling ponds, sediment transport research
and laboratory measurements.
This liquid sensor provides analog and digital signal output
modes. The threshold is adjustable when in digital signal mode.
You can select the mode according to your MCU.
Specification

 Operating Voltage: 5V DC
 Operating Current: 40mA (MAX)
 Response Time : <500ms
 Insulation Resistance: 100M (Min)
 Output Method:
 Analog output: 0-4.5V
 Digital Output: High/Low level signal (you can adjust the
threshold value by adjusting the potentiometer)
 Operating Temperature: 5℃~90℃
 Storage Temperature: -10℃~90℃
 Weight: 30g
 Adapter Dimensions: 38mm*28mm*10mm/1.5inches
*1.1inches*0.4inches

DS18B20 Temperature Sensor


Pin Configuration

No: Pin Description


Name

1 Ground Connect to the ground of the circuit

2 Vcc Powers the Sensor, can be 3.3V or 5V

3 Data This pin gives output the temperature value which can be read usin
wire method

DS18B20 Sensor Specifications

 Programmable Digital Temperature Sensor


 Communicates using 1-Wire method
 Operating voltage: 3V to 5V
 Temperature Range: -55°C to +125°C
 Accuracy: ±0.5°C
 Output Resolution: 9-bit to 12-bit (programmable)
 Unique 64-bit address enables multiplexing
 Conversion time: 750ms at 12-bit
 Programmable alarm options
 Available as To-92, SOP and even as a waterproof sensor

Note: Read further to know why these parameters are important. Also
the DS18B20 datasheet can be found at the bottom of the page
Alternative Temperature Sensors
Thermocouple, TMP100, LM75, DHT11, SHT15, LM35DZ, TPA81,
D6T

DS18B20 Equivalent Sensors


DS18S20

Where to use DS18B20 Sensor


The DS18B20 is a 1-wire programmable Temperature sensor from
maxim integrated. It is widely used to measure temperature in hard
environments like in chemical solutions, mines or soil etc. The
constriction of the sensor is rugged and also can be purchased with a
waterproof option making the mounting process easy. It can measure a
wide range of temperature from -55°C to +125° with a decent accuracy
of ±5°C. Each sensor has a unique address and requires only one pin of
the MCU to transfer data so it a very good choice for measuring
temperature at multiple points without compromising much of your
digital pins on the microcontroller.

How to use the DS18B20 Sensor


The sensor works with the method of 1-Wire communication. It requires
only the data pin connected to the microcontroller with a pull up resistor
and the other two pins are used for power as shown below.
The pull-up resistor is used to keep the line in high state when the bus is
not in use. The temperature value measured by the sensor will be stored
in a 2-byte register inside the sensor. This data can be read by the using
the 1- wire method by sending in a sequence of data. There are two types
of commands that are to be sent to read the values, one is a ROM
command and the other is function command. The address value of each
ROM memory along with the sequence is given in the datasheet below.
You have to read through it to understand how to communicate with the
sensor.
If you are planning to interface it with Arduino, then you need not
worry about all these. You can develop the readily available library and
use the in-built functions to access the data.

Applications

 Measuring temperature at hard environments


 Liquid temperature measurement
 Applications where temperature has to be measured at multiple
points
5V 5-Pin Relay

Relay Pin Configuration

Pin Pin Name Description


Number

1 Coil End 1 Used to trigger(On/Off) the Relay, Normally


one end is connected to 5V and the other end to
ground

2 Coil End 2 Used to trigger(On/Off) the Relay, Normally


one end is connected to 5V and the other end to
ground

3 Common (COM) Common is connected to one End of the Load


that is to be controlled

4 Normally Close (NC) The other end of the load is either connected to
NO or NC. If connected to NC the load remains
connected before trigger
5 Normally Open (NO) The other end of the load is either connected to
NO or NC. If connected to NO the load remains
disconnected before trigger

Features of 5-Pin 5V Relay

 Trigger Voltage (Voltage across coil) : 5V DC


 Trigger Current (Nominal current) : 70mA
 Maximum AC load current: 10A @ 250/125V AC
 Maximum DC load current: 10A @ 30/28V DC
 Compact 5-pin configuration with plastic moulding
 Operating time: 10msec Release time: 5msec
 Maximum switching: 300 operating/minute (mechanically)

Equivalent Relays
3V Relay, 12V Relay, 1-channel Relay module, 4-channel Relay
Module.

How to use a Relay


Relays are most commonly used switching device in electronics. Let us
learn how to use one in our circuits based on the requirement of our
project.
Before we proceed with the circuit to drive the relay we have to consider
two important parameter of the relay. Once is the Trigger Voltage, this
is the voltage required to turn on the relay that is to change the contact
from Common->NC to Common->NO. Our relay here has 5V trigger
voltage, but you can also find relays of values 3V, 6V and even 12V so
select one based on the available voltage in your project. The other
parameter is your Load Voltage & Current, this is the amount of
voltage or current that the NC,NO or Common terminal of the relay
could withstand, in our case for DC it is maximum of 30V and 10A.
Make sure the load you are using falls into this range.

The above circuit shows a bare-minimum concept for a relay to operate.


Since the relay has 5V trigger voltage we have used a +5V DC supply to
one end of the coil and the other end to ground through a switch.
This switch can be anything from a small transistor to a microcontroller
or a microprocessor which can perform switching operating. You can
also notice a diode connected across the coil of the relay, this diode is
called the Fly back Diode. The purpose of the diode is to protect the
switch from high voltage spike that can produced by the relay coil. As
shown one end of the load can be connected to the Common pin and the
other end is either connected to NO or NC. If connected to NO the load
remains disconnected before trigger and if connected to NC the load
remains connected before trigger.

Applications of Relay

 Commonly used in switching circuits.


 For Home Automation projects to switch AC loads
 To Control (On/Off) Heavy loads at a pre-determined time/condition
 Used in safety circuits to disconnect the load from supply in event of
failure
 Used in Automobiles electronics for controlling indicators glass
motors etc.

ATMega328P Microcontroller

ATMEGA328P is high performance, low power controller from


Microchip. ATMEGA328P is an 8-bit microcontroller based on AVR
RISC architecture. It is the most popular of all AVR controllers as it is
used in ARDUINO boards.

ATMega328 Pin Configuration


ATMEGA328P is a 28 pin chip as shown in pin diagram above. Many
pins of the chip here have more than one function. We will describe
functions of each pin in below table.
Pin Pin name Description Secondary Function
No.

1 PC6 (RESET) Pin6 of Pin by default is used as RESET pin. PC6


PORTC only be used as I/O pin when RSTDIS
Fuse is programmed.

2 PD0 (RXD) Pin0 of RXD (Data Input Pin for USART)


PORTD USART Serial Communication Interface
[Can be used for programming]

3 PD1 (TXD) Pin1 of TXD (Data Output Pin for USART)


PORTD USART Serial Communication Interface
[Can be used for programming]

INT2( External Interrupt 2 Input)

4 PD2 (INT0) Pin2 of External Interrupt source 0


PORTD

5 PD3 Pin3 of External Interrupt source1


(INT1/OC2B) PORTD

OC2B(PWM - Timer/Counter2 Ou
Compare Match B Output)

6 PD4 (XCK/T0) Pin4 of T0( Timer0 External Counter Input)


PORTD XCK ( USART External Clock I/O)
7 VCC Connected to positive voltage

8 GND Connected to ground

9 PB6 Pin6 of XTAL1 (Chip Clock Oscillator pin 1


(XTAL1/TOSC1) PORTB External clock input)
TOSC1 (Timer Oscillator pin 1)

10 PB7 Pin7 of XTAL2 (Chip Clock Oscillator pin 2)


(XTAL2/TOSC2) PORTB TOSC2 (Timer Oscillator pin 2)

11 PD5 Pin5 of T1(Timer1 External Counter Input)


(T1/OC0B) PORTD

OC0B(PWM - Timer/Counter0 Ou
Compare Match B Output)

12 PD6 Pin6 of AIN0(Analog Comparator Positive I/P)


(AIN0/OC0A) PORTD

OC0A(PWM - Timer/Counter0 Ou
Compare Match A Output)

13 PD7 (AIN1) Pin7 of AIN1(Analog Comparator Negative I/P)


PORTD

14 PB0 Pin0 of ICP1(Timer/Counter1 Input Capture Pin)


(ICP1/CLKO) PORTB

CLKO (Divided System Clock. The divi


system clock can be output on the PB0 pin

15 PB1 (OC1A) Pin1 of OC1A (Timer/Counter1 Output Comp


PORTB Match A Output)

16 PB2 (SS/OC1B) Pin2 of SS (SPI Slave Select Input). This pin is


PORTB when controller acts as slave.
[Serial Peripheral Interface (SPI)
programming]

OC1B (Timer/Counter1 Output Comp


Match B Output)

17 PB3 Pin3 of MOSI (Master Output Slave Input). W


(MOSI/OC2A) PORTB controller acts as slave, the data is received
this pin. [Serial Peripheral Interface (SPI)
programming]
OC2 (Timer/Counter2 Output Comp
Match Output)

18 PB4 (MISO) Pin4 of MISO (Master Input Slave Output). W


PORTB controller acts as slave, the data is sen
master by this controller through this pin.

[Serial Peripheral Interface (SPI)


programming]

19 PB5 (SCK) Pin5 of SCK (SPI Bus Serial Clock). This is the cl
PORTB shared between this controller and o
system for accurate data transfer.
[Serial Peripheral Interface (SPI)
programming]

20 AVCC Power for Internal ADC Converter

21 AREF Analog Reference Pin for ADC

22 GND GROUND

23 PC0 (ADC0) Pin0 of ADC0 (ADC Input Channel 0)


PORTC

24 PC1 (ADC1) Pin1 of ADC1 (ADC Input Channel 1)


PORTC

25 PC2 (ADC2) Pin2 of ADC2 (ADC Input Channel 2)


PORTC

26 PC3 (ADC3) Pin3 of ADC3 (ADC Input Channel 3)


PORTC

27 PC4 (ADC4/SDA) Pin4 of ADC4 (ADC Input Channel 4)


PORTC SDA (Two-wire Serial Bus Data Input/ou
Line)

28 PC5 (ADC5/SCL) Pin5 of ADC5 (ADC Input Channel 5)


PORTC SCL (Two-wire Serial Bus Clock Line)
Features

ATMEGA328P – Simplified Features

CPU 8-bit AVR

Number of Pins 28

Operating Voltage (V) +1.8 V TO +5.5V

Number of 23
programmable I/O lines

Communication Master/Slave SPI Serial Interface(17,18,19 PINS) [Can


Interface used for programming this controller]
Programmable Serial USART(2,3 PINS) [Can be used
programming this controller]
Two-wire Serial Interface(27,28 PINS)[Can be used
connect peripheral devices like Servos, sensors and mem
devices]

JTAG Interface Not available

ADC Module 6channels, 10-bit resolution ADC

Timer Module Two 8-bit counters with Separate Prescaler and comp
mode, One 16-bit counter with Separate Prescaler,comp
mode and capture mode.

Analog Comparators 1(12,13 PINS)


DAC Module Nil

PWM channels 6

External Oscillator 0-4MHz @ 1.8V to 5.5V


0-10MHz @ 2.7V to 5.5V
0-20MHz @ 4.5V to 5.5V

Internal Oscillator 8MHz Calibrated Internal Oscillator

Program Memory Type Flash

Program Memory or 32Kbytes[10000 write/erase cycles]


Flash memory

CPU Speed 1MIPS for 1MHz

RAM 2Kbytes Internal SRAM

EEPROM 1Kbytes EEPROM

Watchdog Timer Programmable Watchdog Timer with Separate


chipOscillator

Program Lock Yes

Power Save Modes Six Modes[Idle, ADC Noise Reduction, Power-save, Pow
down, Standby and Extended Standby]
Operating Temperature -40°C to +105°C(+105 being absolute maximum, -40 be
absolute minimum)

ATMEGA328P Replacements
ATMEGA8

ATMEGA328P Alternatives
ATMEGA16, ATMEGA32, ATMEGA8535

Where to Use ATMEGA328P


Although we have many controllers ATMEGA328P is most popular of
all because of its features and cost. ARDUINO boards are also
developed on this controller because of its features.

 With program memory of 32 Kbytes ATMEGA328P applications are


many.
 With various POWER SAVING modes it can work on MOBILE
EMBEDDED SYSTEMS.
 With Watchdog timer to reset under error it can be used on systems
with minimal human interference.
 With advanced RISC architecture, the controller executes programs
quickly.
 Also with in chip temperature sensor the controller can be used at
extreme temperatures.

These all features add together promoting ATMEGA328P further.


How to Use ATMEGA328P
ATMEGA328 is used similar to any other controller. All there to do is
programming. Controller simply executes the program provided by us at
any instant. Without programming controller simply stays put without
doing anything.

As said, first we need to program the controller and that is done by


writing the appropriate program file in the ATMEGA328P FLASH
memory. After dumping this program code, the controller executes this
code and provides appropriate response.
Entire process of using an ATMEGA328P goes like this:

1. List the functions to be executed by controller.


2. Write the functions in programming language in IDE programs.

You can download the IDE program for free in company websites. IDE
program for AVR controllers is ‘ATMEL STUDIO’. Link for ATMEL
STUDIO is given below.
(Usually Atmel Studio 6.0 for Windows7 [ http://atmel-
studio.software.informer.com/6.0/ ],
Atmel Studio 7 for Windows10 [ https://www.microchip.com/avr-
support/atmel-studio-7 ])

3. ATMEGA328P programming can also be done in ARDUINO IDE.


4. After writing the program, compile it to eliminate errors.
5. Make the IDE generate HEX file for the written program after
compiling.
6. This HEX file contains the machine code which should be written
in controller flash memory.
7. Choose the programming device (usually SPI programmer made
for AVR controllers) which establishes communication between
PC and ATMEGA328P. You can also program ATMEGA328P using
ARDUINO UNO board.
8. Run the programmer software and choose the appropriate hex
file.
9. Burn the HEX file of written program in ATMEGA328P flash
memory using this program.
10. Disconnect the programmer, connect the appropriate
peripherals for the controller and get the system started.

How to Use ATMega328P using Arduino


Since ATmega328P is used in Arduino Uno and Arduino nano boards,
you can directly replace the arduino board with ATmega328 chip. For
that first you need to install the Arduino bootloader into the chip (Or
you can also buy a chip with bootloader – ATMega328P-PU). This IC
with bootloader can be placed on Arduino Uno board and burn the
program into it. Once Arduino program is burnt into the IC, it can be
removed and used in place of Arduino board, along with a Crystal
oscillator and other components as required for the project. Below is
the pin mapping between Arduino Uno and ATmega328P chip.
Applications
There are hundreds of applications for ATMEGA328P:

 Used in ARDUINO UNO, ARDUINO NANO and ARDUINO MICRO


boards.
 Industrial control systems.
 SMPS and Power Regulation systems.
 Digital data processing.
 Analog signal measuring and manipulations.
 Embedded systems like coffee machine, vending machine.
 Motor control systems.
 Display units.
 Peripheral Interface system.
Arduino

Arduino can sense the environment by receiving input from a variety of


sensors and can affect its surroundings by controlling lights, motors,
and other actuators. The microcontroller on the board isprogrammed
using the Arduino programming language (based on Wiring) and the
Arduino development environment (based on Processing). Arduino
projects can be stand-alone or they can communicate with software on
running on a computer (e.g. Flash, Processing, MaxMSP).Arduino is a
cross-platoform program. You’ll have to follow different instructions for
your personalOS. Check on the Arduino site for the latest instructions.
http://arduino.cc/en/Guide/HomePage

Once we have downloaded/unzipped the arduino IDE, you can Plug the
Arduino to PC via USB cable.

Now you’re actually ready to “burn” first program on the arduino


board. To

select “blink led”, the physical translation of the well known


programming “hello

world”, select File>Sketchbook> Arduino-0017>Examples>

Digital>Blink Once you have your skecth you’ll see something very
close to the
screenshot on the right.In Tools>Board select MEGA Now you have to
go to Tools>SerialPort and select the right serial port, the one arduino
is attached to.
Figure 3.23 Arduino compilation

3.4.2 Wi-fi Module Esp 8266 12e


ESP-12E WiFi module is developed by Ai-thinker Team. core processor
ESP8266 in smaller sizes of the module encapsulates Tensilica L106
integrates industry-leading ultra low power 32-bit MCU micro, with the
16-bit short mode, Clock speed support 80 MHz, 160 MHz, supports the
RTOS, integrated Wi-Fi MAC/BB/RF/PA/LNA, on-board antenna. The
module supports standard IEEE802.11 b/g/n agreement, complete
TCP/IP protocol stack. Users can use the add modules to an existing
device networking, or building a separate network controller. ESP8266
is high integration wireless SOCs, designed for space and power
constrained mobile platform designers. It provides unsurpassed ability
to embed Wi-Fi capabilities within other systems, or to function as a
standalone application, with the lowest cost, and minimal space
requirement[8].
Figure 3.24 Wi-fi Module ESP8266

How to add ESP 8266 library file in Arduino:

Before we are able to compile and upload a demo example, we need to


prepare Arduino IDE to work with ESP8266 boards[9].

This is relatively simple. Follow the steps below:

• Start Arduino.

• Select File → Preferences as shown below:


Figure 3.25 File selection

• A dialog window would pop-up.

• The only thing we need to edit here is the field called “Additional
Boards Manager URLs:”. In the blank space we need to provide a link to
the .json file which would add ESP8266 support to Arduino. By the time
of writing the correct address is:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Figure 3.26 Link To Download

• Click “OK” to apply the changes and close the dialog window
• Navigate to Tools → Board → Boards Manager… and install the
esp8266 platform. A properly

installed library should show similar to this:

Figure 3.27 Library Installation

• Now at the bottom of the selector Tools → Board you should see
different ESP8266 boards available[5] .

This is shown below:


Figure 3.28 Board Selection

Features wi-fi module are as follows:


• 802.11 b/g/n
• Integrated low power 32-bit MCU
• Integrated 10-bit ADC
• Integrated TCP/IP protocol stack
• Integrated TR switch, balun, LNA, power amplifier and
matching network
• Integrated PLL, regulators, and power management units
• Supports antenna diversity
• WiFi 2.4 GHz, support WPA/WPA2
• Support STA/AP/STA+AP operation modes
• Support Smart Link Function for both Android and iOS devices
• SDIO 2.0, (H) SPI, UART, I2C, I2S, IR Remote Control,
PWM, GPIO
• STBC, 1x1 MIMO, 2x1 MIMO
• A-MPDU & A-MSDU aggregation & 0.4s guard interval
• Deep sleep power < 5uA
• Wake up and transmit packets in < 2ms
• Standby power consumption of < 1.0mW (DTIM3)
• +20 dBm output power in 802.11b mode
• Operating temperature range -40C ~ 125C
• FCC, CE, TELEC, WiFi Alliance, and SRRC certified

The parameters of wi-fi module are as follows:


Table 3.3 Parameters of Wi-fi module
Categories Items Values
Certificates FCC/CE/TELEC/SRRC
WiFi Protocles 802.11 b/g/n
Frequency Range 2.4G-2.5G (2400M-2483.5M)
802.11 b: +20 dBm
Tx Power 802.11 g: +17 dBm
WiFi Parameters 802.11 n: +14 dBm
802.11 b: -91 dbm (11 Mbps)
Rx Sensitivity 802.11 g: -75 dbm (54 Mbps)
802.11 n: -72 dbm (MCS7)

Types of Antenna PCB Trace, External, IPEX


Connector, Ceramic Chip
UART/SDIO/SPI/I2C/I2S/IR
Peripheral Bus Remote Control
GPIO/PWM
Operating Voltage 3.0~3.6V
Operating Current Average value: 80mA
Hardware Operating -40°~125°
Paramaters Temperature Range
Ambient Normal temperature
Temperature Range
Package Size 5x5mm
External Interface N/A
WiFi mode station/softAP/SoftAP+station
Security WPA/WPA2
Encryption WEP/TKIP/AES
Software Firmware Upgrade UART Download / OTA (via
Parameters network)
Ssoftware Supports Cloud Server
Development Development / SDK for
custom firmware
development
Network Protocols IPv4, TCP/UDP/HTTP/FTP
User Configuration AT Instruction Set, Cloud
Server, Android/ iOS App

Pin descriptions of wi-fi module are as follows:

Table 3.4 Pin Discription of ESP8266


NO. Pin Name Function
1 RST Reset the module
2 ADC A/D Conversion
result.Input voltage
range 0-1v,scope:0-
1024
3 EN tage range 0-
1v,scope:0-1024 3
EN C
4 IO16 GPIO16; can be used
to wake up the
chipset from deep
sleep mode.
5 IO14 GPIO14; HSPI_CLK
6 IO12 GPIO12;
HSPI_MISO
7 IO13 GPIO13;
HSPI_MOSI;
UART0_CTS
8 VCC 3.3V power supply
(VDD)
9 CS0 Chip selection
10 MISO Salve output Main
input
11 IO9 GPIO9
12 IO10 GBIO10
13 MOSI Main output slave
input
14 SCLK Clock
15 GND GND
16 IO15 GPIO15; MTDO;
HSPICS;
UART0_RTS
17 IO2 GPIO2;
UART1_TXD
18 IO0 GPIO0
19 IO4 GPIO4
20 IO5 GPIO5
21 RXD UART0_RXD;
GPIO3
22 TXD UART0_TXD;
GPIO1

Ultra Low Power Technology


ESP8266EX has been designed for mobile, wearable electronics and
Internet of Things applications with the aim of achieving the lowest
power consumption with a combination of several proprietary
techniques. The power saving architecture operates mainly in 3 modes:
active mode, sleep mode and deep sleep mode.
By using advance power management techniques and logic to power-
down functions not required and to control switching between sleep and
active modes, ESP8266EX consumes about than 60uA in deep sleep
mode (with RTC clock still running) and less than 1.0mA or less than
0.5mA to stay connected to the access point. When in sleep mode, only
the calibrated real-time clock and watchdog remains active. The real-
time clock can be programmed to wake up the ESP8266EX at any
required interval. The ESP8266EX can be programmed to wake up when
a specified condition is detected. This minimal wake-up time feature of
the ESP8266EX can be utilized by mobile device SOCs, allowing them
to remain in the low-power standby mode until WiFi is needed. In order
to satisfy the power demand of mobile and wearable electronics,
ESP8266EX can be programmed to reduce the output power of the PA
to fit various application profiles, by trading off range for power
consumption[8].

Major fields of ESP8266EX applications to Internet-of-Things include:


• Home Automation
• Home Appliances
• Smart Plug and lights
• Mesh Network
• Industrial Wireless Control
• Baby Monitors
• IP Cameras
• Sensor Networks
• Wearable Electronics
• WiFi Location-aware Devices
• Security ID Tags
• WiFi Position System Beacons

Potrebbero piacerti anche