Академический Документы
Профессиональный Документы
Культура Документы
CHAPTER 1. INTRODUCTION
1.1 GENERAL
The main aim of the project is to design a system which will monitor and control
the water level in the dams and also intimates the concerned authority when the water
level exceeds the limit.
1.2 OBJECTIVE
The main objective of this project is to design an embedded based control
warning system limited condition by making use of sensor. This system use sensors to
detect the variation in the water level using logic controller. The controller uses the
embedded system to work as the computing platform.
The existing system uses manual operation to control and monitor the water level
Which is more manual and require more human involvement to monitor or to get the
exact location.
2.2 MICROPROCESSOR
2.3 MICROCONTROLLER
It includes a CPU, RAM, ROM, I/O ports, and timers like a standard computer,
but because they are designed to execute only a single specific task to control a single
system, they are much smaller and simplified so that they can include all the functions
required on a single chip. Unlike a microprocessor, which is a general-purpose chip used
to create a multi-function computer or device and requires multiple chips to handle
various tasks, this device is meant to be more self-contained and independent, and
functions as a tiny, dedicated computer. A microcontroller may also need an external
crystal to provide a clock, however some have an internal clock. Some microcontrollers
have two sections of flash memory; one to hold initialization (boot) code, and another to
store the application. This makes it easier to update the application code in-place.
2.4 ARDUINO
These peripheral boards are called shields, and are designed to stack on top of each
other. Example shields are motor control boards, general I/O boards, relay boards,
Ethernet boards, and LCD's, typically with a touch-screen.
In addition to the hardware described above, Arduino also come with a cross-
platform Integrated Development Environment (IDE) written in Java. It was designed to
introduce programming to artists and other beginners, much as the BASIC language did
50 years ago. A program for Arduino is called a sketch.
Arduino programs are written in C or C++, however many of the details are
hidden from the user: only two functions (called by the system) need to be defined to
make a program that continually loops (which is typically for embedded programs) The
IDE comes with a software library called "Wiring" which can be used for common
input/output operations.
There are many Advantages of Using Arduino over simple microcontroller. Some of
them are as follows:
1. Ready to use: Its ready to use structure makes it really easy to use. You dont have
to take care of burner, fuse settings, Serial Monitor Softwares etc.
2. Effortless functions: There are many functions present in the software of Arduino
which makes coding so easy and fast that is not possible with simple microcontroller.
3. Large Community: Well it is obvious now that everyone is using Arduino
nowadays thats why you can get help anytime from anywhere whenever you will
have stuck somewhere.
4. Inexpensive: Arduino boards are relatively inexpensive compared to other
microcontroller platforms. The pre-assembled Arduino modules cost less than 300
rupees.
The Project Water Level Meter for Alerting Population about floods by using
Atmega 2560 is designed to alert the population about flood situation to avoid the loss
of human life. The three water level sensors which is generally immersed in reservoirs
(mostly in flood affected areas). These water level sensors are pressure based (WL400)
sensor which senses the increase in water level based on the increasing level of pressure
in water. The three sensors are indicated for three levels.
These three sensors continuously monitor the level of water and send the status of
the level of water to Arduino board which in turn sends this information to the
concerned authority through GSM (Global System for Mobile Communication) modem
via SMS and also to the webpage of officials who are monitoring the continuous
situation of reservoir via ethernet module. If the official gets the information of level1,
then the situation is under control. If the official gets the information of level2, then the
situation of flood is going to arise, as water level is continuously increasing, this makes
the officials to take action to vacant the flood prone areas. The third level 3, informs the
official that flood has occurred. So, As the water level 2 is received, this helps to save
the human life, as it requires minimum 6 hours to fill the reservoir if continuously water
level is raising. This time is utilized to save the human life.
through 3 analog pins (A0, A1 and A2) which senses the water level and sends the
analog output to the Atmega 2560 microcontroller inbuilt in Arduino Mega board. There
are inbuilt Analog to Digital converters on the board which converts the analog output of
sensors to digital input of microcontroller.
These sensors continuously send the status of water level to microcontroller. This
status of water level is displayed on 16X2 LCD (Liquid Crystal Display), as it is
interfaced with Arduino mega board parallelly (through its six PWM digital pins).
Whenever the 16X2 LCD chip enable is active Low and read signal is active high the
LCD reads the characters from microcontroller and display it on LCD. The same status
is received to the concerned authority through GSM modem which is interfaced through
one of the serial ports of Arduino board. The GSM modem gets active when it receives
respective AT commands from the Microcontroller when it senses the status of water
level in reservoir. Whenever the AT command is received by GSM modem, according to
the AT command it sends the respective status to concerned official via SMS. The Serial
port(RS232) cannot be directly interfaced with Atmega 2560 Microcontroller, as the
voltage levels of GSM (Global System for Mobile Communication) and Atmega 2560
Microcontroller are different, so as to make the GSM (Global System for Mobile
Communication) modem communicate with Microcontroller or vice versa, MAX232
voltage level converter is being interfaced between them.
And at the Same time ethernet Module (ENC28J60) is also interfaced with
microcontroller through Serial peripheral interface(SPI) pins (50,51 and 52) of Arduino
board. When the ethernet receives the information about sensors that is being displayed
on the webpage on Personal computer which is again interfaced through serial port and
MAX232 voltage converter. In brief, whenever water level change is sensed the
information is displayed on LCD through parallel port and the same information is
received by concerned official through GSM via SMS or through webpage via ethernet
communication protocol on Personal computer. This makes the concerned official to
take action to avoid loss of human life in flood prone areas within the time limit.
CHAPTER 4. HARDWARE DESCRIPTION
Memory
The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB
is used for the boot loader), 8 KB of SRAM and 4 KB of EEPROM (which can be read
and written with the EEPROM library).
Communication
The Mega 2560 board has a number of facilities for communicating with a
computer, another board, or other microcontrollers. The ATmega2560 provides four
hardware UARTs for TTL (5V) serial communication. The Arduino Software (IDE)
includes a serial monitor which allows simple textual data to be sent to and from the
board. The RX and TX LEDs on the board will flash when data is being transmitted via
the ATmega8U2/ATmega16U2 chip and USB connection to the computer (but not for
serial communication on pins 0 and 1). A Software Serial library allows for serial
communication on any of the Mega 2560's digital pins. The Mega 2560 also supports
TWI and SPI communication. The Arduino Software (IDE) includes a Wire library to
simplify use of the TWI bus.
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. 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.
Rather than requiring a physical press of the reset button before an upload, the
Mega 2560 is designed in a way that allows it to be reset by software running on a
connected computer. One of the hardware flow control lines (DTR) of the ATmega8U2
is connected to the reset line of the ATmega2560 via a 100 nano-farad capacitor. When
this line is asserted (taken low), the reset line drops long enough to reset the chip. The
Arduino Software (IDE) uses this capability to allow you to upload code by simply
pressing the upload button in the Arduino environment. This means that the boot loader
can have a shorter timeout, as the lowering of DTR can be well-coordinated with the
start of the upload.
When the Mega 2560 board is connected to either a computer running Mac OS X
or Linux, it resets each time a connection is made to it from software (via USB). For the
following half-second or so, the boot loader is running on the ATMega2560. While it is
programmed to ignore malformed data (i.e. anything besides an upload of new code), it
will intercept the first few bytes of data sent to the board after a connection is opened. If
a sketch running on the board receives one-time configuration or other data when it first
starts, make sure that the software with which it communicates waits a second after
opening the connection and before sending this data.
.
Figure 4.2 ARDUINO MEGA Pin Diagram
Input and Output mapping between Arduino pins and Atmega2560 ports
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.
28 PG3 ( TOSC2 )
29 PG4 ( TOSC1 )
30 RESET RESET
31 VCC VCC
32 GND GND
33 XTAL2 XTAL2
34 XTAL1 XTAL1
35 PL0 ( ICP4 ) Digital pin 49
36 PL1 ( ICP5 ) Digital pin 48
37 PL2 ( T5 ) Digital pin 47
38 PL3 ( OC5A ) Digital pin 46 (PWM)
39 PL4 ( OC5B ) Digital pin 45 (PWM)
40 PL5 ( OC5C ) Digital pin 44 (PWM)
41 PL6 Digital pin 43
42 PL7 Digital pin 42
43 PD0 ( SCL/INT0 ) Digital pin 21 (SCL)
44 PD1 ( SDA/INT1 ) Digital pin 20 (SDA)
45 PD2 ( RXDI/INT2 ) Digital pin 19 (RX1)
46 PD3 ( TXD1/INT3 ) Digital pin 18 (TX1)
47 PD4 ( ICP1 )
48 PD5 ( XCK1 )
49 PD6 ( T1 )
50 PD7 ( T0 ) Digital pin 38
51 PG0 ( WR ) Digital pin 41
52 PG1 ( RD ) Digital pin 40
53 PC0 ( A8 ) Digital pin 37
54 PC1 ( A9 ) Digital pin 36
55 PC2 ( A10 ) Digital pin 35
56 PC3 ( A11 ) Digital pin 34
57 PC4 ( A12 ) Digital pin 33
58 PC5 ( A13 ) Digital pin 32
59 PC6 ( A14 ) Digital pin 31
The Arduino Mega2560 has a resettable poly fuse that protects your computers
USB ports from shorts and over current. Although most computers provide their own
internal protection, the fuse provides an extra layer of protection. If more than 500 mA is
applied to the USB port, the fuse will automatically break the connection until the short
or overload is removed. The Arduino Software (IDE) uses this capability to allow you to
upload code by simply pressing the upload button in the Arduino environment.
This setup has other implications. When the Mega 2560 board is connected to
either a computer running Mac OS X or Linux, it resets each time a connection is made
to it from software (via USB). For the following half-second or so, the boot loader is
running on the ATMega2560. While it is programmed to ignore malformed data (i.e.
anything besides an upload of new code), it will intercept the first few bytes of data sent
to the board after a connection is opened.
1. Serial 0: (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16
(TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL
serial data. Pins 0 and 1 are also connected to the corresponding pins of the
ATmega16U2 USB-to-TTL Serial chip.
2. External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt
4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an
interrupt on a low level, a rising or falling edge, or a change in level. PWM: 2 to 13
and 44 to 46. Provide 8-bit PWM output with the analogWrite() function.
IEEE std. 1149.1 compliant JTAG test interface, also used for accessing the On-chip
Debug system and programming and six software selectable power saving modes.
AVR is a family of microcontrollers developed by Atmel beginning in 1996.
These are modified Harvard architecture 8-bit RISC single-chip microcontrollers.
AVR was one of the first microcontroller families to use on-chip flash memory for
program storage, as opposed to one-time programmable ROM, EPROM, or
EEPROM used by other microcontrollers at the time. AVR microcontrollers find
many applications as embedded systems; they are also used in the Arduino line of
open source board designs.
The On-chip ISP Flash allows the program memory to be reprogrammed in-
system through an SPI serial interface, by a conventional non-volatile memory
programmer, or by an On-chip Boot program running on the AVR core. The boot
program can us easy interface to download the application program in the application
Flash memory.
The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, SPI
port, and interrupt system to continue functioning. The Power-down mode saves the
register contents but freezes the Oscillator, disabling all other chip functions until the
next interrupter Hardware Reset. In Power-save mode, the asynchronous timer
continues to run, allowing the user to maintain a timer base while the rest of the
device is sleeping.
In Standby mode, the Crystal/Resonator Oscillator is running while the rest of the
device is sleeping. This allows very fast start-up combined with low power
consumption. In Extended Standby mode, both the main Oscillator and the
Asynchronous Timer continue to run. Atmel offers the Q Touch library for
embedding capacitive touch buttons, sliders and wheels functionality into AVR
microcontrollers.
The water depth indicator is available in a 0-3' full scale range which is ideal for
measuring shallow flows or small water level changes. The 0-3' range is great for
measuring flows in sewers, storm drains, weirs, flumes, lakes, tanks or any water body
that is less than 3' deep. The 0-3' water monitoring sensor accurately measures small
changes in water, even when the water's depth is only a few inches deep. Other metal
foil type sensors typically have serious problems at low level ranges because of
crinkling, stretching and drifting.
Protective Cap
The water sensor also utilizes a stainless steel micro-screen cap to protect the
sensing element. This protective cap has hundreds of openings, making fouling the
sensor with silt, mud or sludge virtually impossible.
Global Water's Water Level Sensors are fully encapsulated with marine-grade
epoxy. The submersible pressure transducer's electronics are encased in marine grade
epoxy so that moisture can never leak in or work its way down the vent tube to cause
drift or level sensor failure (as is the case with other pressure sensors). The vent tube is
sealed directly to the sensing element, and any moisture that may enter the vent tube
only comes in contact with a silicon sensing device, not the electronics.
Output Signals
The WL400 water pressure sensors have a two-wire 4-20 mA output signal that
is linear with water depth. 10 to 36 VDC is required to operate the depth level sensor, so
the WL400 submersible pressure transducer can be operated from 12 or 24 VDC
systems. The 4-20 mA signal can run up to 3,000' from the sensor to the logging device.
Common twisted pair or electrical extension cord wire may be spliced to the vented
cable once the cable is out of the water. The 4-20 mA signal may be converted to 0.5 to
2.5 VDC by dropping the current signal across a 125-ohm resistor.
Features of WL400
1. High accuracy and reliability.
2. Completely submersible sensor and cable.
3. Compact, rugged design for easy installation.
4. Minimal maintenance and care.
5. Sensor compatible with most monitoring equipment
6. 4-20mA output
7. Vented cable for automatic barometric compensation
8. Multiple ranges available from 3 to 250 Wet-wet sensor eliminates vent tube
concerns Dynamic temperature compensation system Not affected by foam, wind
or rain
9. Monitors levels in groundwater wells, rivers, streams, tanks, lift stations and
open channels
Interfacing of Arduino with WL400
Ethernet Buffer
The Ethernet buffer contains transmit and receive memory used by the Ethernet
controller. The entire buffer is 8 Kbytes, divided into separate receive and transmit
buffer spaces. The sizes and locations of transmit and receive memory are fully
programmable by the host controller using the SPI interface. The relationship of the
buffer spaces is
Receive Buffer
The receive buffer constitutes a circular FIFO buffer managed by hardware. The
register pairs ERXSTH: ERXSTL and ERXNDH: ERXNDL serve as pointers to define
the buffers size and location within the memory. The byte pointed to by ERXST and
the byte pointed to by ERXND are both included in the FIFO buffer.
As bytes of data are received from the Ethernet interface, they are written into
the receive buffer sequentially. However, after the memory pointed to by ERXND is
written to, the hardware will automatically write the next byte of received data to the
memory pointed to by ERXST. As a result, the receive hardware will never write outside
the boundaries of the FIFO.
The host controller may program the ERXST and ERXND pointers when the
receive logic is not enabled. The pointers must not be modified while the receive logic is
enabled (ECON1.RXEN is set). If desired, the pointers may span the 1FFFh to 0000h
memory boundary; the hardware will still operate as a FIFO. The ERXWRPTH:
ERXWRPTL registers define a location within the FIFO where the hardware will write
bytes that it receives.
The pointer is read-only and is automatically updated by the hardware whenever
a new packet is successfully received. The pointer is useful for determining how much
free space is available within the FIFO. The ERXRDPT registers define a location
within the FIFO where the receive hardware is forbidden to write to. In normal
operation, the receive hardware will write data up to, but not including, the memory
pointed to by ERXRDPT
4.6 GLOBAL SYSTEM FOR MOBILE COMMUNICATION
Global system for mobile communication (GSM) is a globally accepted standard for
digital cellular communication. GSM is the name of a standardization group established
in 1982 to create a common European mobile telephone standard that would formulate
specifications for a pan-European mobile cellular radio system operating at 900 MHz.
reason for this is to limit the designers as little as possible but still to make it possible for
the operators to buy equipment from different suppliers. The GSM network is divided
into three major systems: the switching system (SS), the base station system (BSS), and
the operation and support system (OSS).
buys a subscription from one of the PCS operators, he or she is registered in the
HLR of that operator.
3. Mobile services switching center (MSC): The MSC performs the telephony
switching functions of the system. It controls calls to and from other telephone
and data systems. It also performs such functions as toll ticketing, network
interfacing, common channel signaling, and others.
4. Visitor location register (VLR): The VLR is a database that contains temporary
information about subscribers that is needed by the MSC in order to service
visiting subscribers. The VLR is always integrated with the MSC. When a
mobile station roams into a new MSC area, the VLR connected to that MSC will
request data about the mobile station from the HLR. Later, if the mobile station
makes a call, the VLR will have the information needed for call setup without
having to interrogate the HLR each time.
5. Authentication center (AUC): A unit called the AUC provides authentication
and encryption parameters that verify the user's identity and ensure the
confidentiality of each call. The AUC protects network operators from different
types of fraud found in today's cellular world.
6. Equipment identity register (EIR): The EIR is a database that contains
information about the identity of mobile equipment that prevents calls from
stolen, unauthorized, or defective mobile stations. The AUC and EIR are
implemented as stand-alone nodes or as a combined AUC/EIR node.
7. The Base Station System (BSS): All radio-related functions are performed in
the BSS, which consists of base station controllers (BSCs) and the base
transceiver stations (BTSs). BSC: The BSC provides all the control functions
and physical links between the MSC and BTS. It is a high-capacity switch that
provides functions such as handover, cell configuration data, and control of radio
frequency (RF) power levels in base transceiver stations. A number of BSCs are
served by an MSC. BTS: The BTS handles the radio interface to the mobile
station. The BTS is the radio equipment (transceivers and antennas) needed to
service each cell in the network. A group of BTSs are controlled by a BSC.
8. The Operation and Support System: The operations and maintenance center
(OMC) is connected to all equipment in the switching system and to the BSC.
The implementation of OMC is called the operation and support system (OSS).
The OSS is the functional entity from which the network operator monitors and
controls the system. The purpose of OSS is to offer the customer cost-effective
support for centralized, regional, and local operational and maintenance activities
that are required for a GSM network. An important function of OSS is to provide
a network overview and support the maintenance activities of different operation
and maintenance organizations.
GSM Modem
A GSM modem is a wireless modem that works with a GSM wireless network. A
wireless modem behaves like a dial-up modem. The main difference between them is
that a dial-up modem sends and receives data through a fixed telephone line while a
wireless modem sends and receives data through radio waves.
AT Commands
The working of GSM modem is based on commands, the commands always start with
AT (which means Attention) and finish with a <CR> character. For example, the dialing
command is ATD<number>; ATD3314629080; here the dialing command ends with
semicolon. The AT commands are given to the GSM modem with the help of PC or
controller. computers use AT commands to control modems.
Both GSM modems and dial-up modems support a common set of standard AT
commands. You can use a GSM modem just like a dial-up modem. In addition to the
standard AT commands, GSM modems support an extended set of AT commands. These
extended AT commands are defined in the GSM standards. With the extended AT
commands, you can do things like:
The number of SMS messages that can be processed by a GSM modem per minute is
very low , only about six to ten SMS messages per minute.
1. Frequency band: The frequency range specified for GSM is 1,850 to 1,990 MHz
(mobile station to base station).
2. Duplex distance: The duplex distance is 80 MHz. Duplex distance is the distance
between the uplink and downlink frequencies. A channel has two frequencies, 80
MHz apart.
5. Transmission rate: GSM is a digital system with an over-the-air bit rate of 270
kbps.
6. Access method: GSM utilizes the time division multiple access (TDMA) concept.
TDMA is a technique in which several different calls may share the same carrier.
Each call is assigned a particular time slot.
7. Speech coder: GSM uses linear predictive coding (LPC). The purpose of LPC is to
reduce the bit rate. The LPC provides parameters for a filter that mimics the vocal
tract. The signal passes through this filter, leaving behind a residual signal. Speech is
encoded at 13 kbps.
There are two basic types of services offered through GSM: telephony (also
referred to as teleservices) and data. Telephony services are mainly voice services that
provide subscribers with the complete capability to communicate with other subscribers.
1. short message services: A convenient facility of the GSM network is the short message
service. A message consisting of a maximum of 160 alphanumeric characters can be
sent to or from a mobile station. This service can be viewed as an advanced form of
alphanumeric paging with a number of advantages. If the subscriber's mobile unit is
powered off or has left the coverage area, the message is stored and offered back to the
subscriber when the mobile is powered on or has reentered the coverage area of the
network. This function ensures that the message will be received.
2. voice mail: This service is actually an answering machine within the network, which is
controlled by the subscriber. Calls can be forwarded to the subscriber's voice-mail box
and the subscriber checks for messages via a personal security code.
3. fax mail: With this service, the subscriber can receive fax messages at any fax machine.
The messages are stored in a service center from which they can be retrieved by the
subscriber via a personal security code to the desired fax number.
The GSM modem is serially interfaced with the controller with the help of MAX
232. Here max 232 acts as driver which converts TTL levels to the RS 232 levels. For
serial interface GSM modem requires the signal based on RS 232 levels. The T1_OUT
and R1_IN pin of MAX 232 is connected to the TX and RX pin of GSM modem
4.7 LIQUID CRYSTAL DISPLAY (LCD)
LCD (Liquid Crystal Display) screen is an electronic display module and find a
wide range of applications. A 16x2 LCD display is very basic module and is very
commonly used in various devices and circuits. The most commonly used Character
based LCDs are based on Hitachi's HD44780 controller or other which are compatible
with HD44580.
These modules are preferred over seven segments and other multi segment
LEDs. The reasons being: LCDs are economical; easily programmable; have no
limitation of displaying special & even custom characters (unlike in seven segments),
animations and so on.
A 16x2 LCD means it can display 16 characters per line and there are 2 such
lines. In this LCD, each character is displayed in 5x7 pixel matrix. This LCD has two
registers, namely, Command and Data. The command register stores the command
instructions given to the LCD.
Pin Description
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controllers has 16
Pins (two pins are extra in both for back-light LED connections). Pin description is
shown in the table below.
Table 4.7: Pin Configuration table for a 16X2 LCD character display
3 Vdd
Contrast adjustment
7 DB0
8 DB1
9 DB2
13 DB6
14 DB7
15 LED-(K)
Back light LED cathode terminal
16 LED+(A)
Back Light LED anode terminal
Data/Signals/Execution of LCD
LCD accepts two types of signals, one is data, and another is control. These
signals are recognized by the LCD module from status of the RS pin. Now data can be
read also from the LCD display, by pulling the R/W pin high. As soon as the E pin is
pulsed, LCD display reads data at the falling edge of the pulse and executes it, same for
the case of transmission.
LCD display takes a time of 39-43S to place a character or execute a
command. Except for clearing display and to seek cursor to home position it takes
1.53ms to 1.64ms. Any attempt to send any data before this interval may lead to failure
to read data or execution of the current data in some devices. Some devices compensate
the speed by storing the incoming data to some temporary registers.
The power supply section is the section which provide +5V for the components
to work. IC LM7805 is used for providing a constant power of +5V.The ac voltage,
typically 220V, is connected to a transformer, which steps down that ac voltage down to
the level of the desired dc output. A diode rectifier then provides a full-wave rectified
voltage that is initially filtered by a simple capacitor filter to produce a dc voltage. This
resulting dc voltage usually has some ripple or ac voltage variation.
A regulator circuit removes the ripples and also retains the same dc value even if
the input dc voltage varies, or the load connected to the output dc voltage changes. This
voltage regulation is usually obtained using one of the popular voltage regulator IC
units.
Transformer
Transformers convert AC electricity from one voltage to another with little loss
of power. Transformers work only with AC and this is one of the reasons why mains
electricity is AC. Step-up transformers increase voltage, step-down transformers reduce
voltage. Most power supplies use a step-down transformer to reduce the dangerously
high mains voltage (230V in India) to a safer low voltage. The input coil is called the
primary and the output coil is called the secondary.
There is no electrical connection between the two coils; instead they are linked
by an alternating magnetic field created in the soft-iron core of the transformer.
Transformers waste very little power so the power out is (almost) equal to the power in.
Note that as voltage is stepped down current is stepped up. The transformer will step
down the power supply voltage (0-230V) to (0- 6V) level. Then the secondary of the
potential transformer will be connected to the bridge rectifier, which is constructed with
the help of PN junction diodes. The advantages of using bridge rectifier are it will give
peak voltage output as DC.
Rectifier
There are several ways of connecting diodes to make a rectifier to convert AC to
DC. The bridge rectifier is the most important and it produces full-wave varying DC. A
full-wave rectifier can also be made from just two diodes if a center-tap transformer is
used, but this method is rarely used now that diodes are cheaper. A single diode can be
used as a rectifier but it only uses the positive (+) parts of the AC wave to produce half-
wave varying DC
Bridge Rectifier
When four diodes are connected as shown in figure, the circuit is called as bridge
rectifier. The input to the circuit is applied to the diagonally opposite corners of the
network, and the output is taken from the remaining two corners. Let us assume that the
transformer is working properly and there is a positive potential, at point A and a
negative potential at point B. the positive potential at point A will forward bias D3 and
reverse bias D4.
winding is connected to one side of the diode bridge network and the load to the other
side as shown below. The result is still a pulsating direct current but with double the
frequency.
Smoothing
Voltage Regulators
Negative voltage regulators are available, mainly for use in dual supplies. Most
regulators include some automatic protection from excessive current ('overload
protection') and overheating ('thermal protection'). Many of the fixed voltage regulator
ICs has 3 leads and look like power transistors, such as the 7805 +5V 1Amp regulator.
They include a hole for attaching a heat sink if necessary.
Powering an Arduino
There are 3 ways to power an Arduino; through USB, the barrel jack, or directly
into the VIN pin. Each option has pros and cons and the method used depends on the
project the Arduino is a part of.
1. USB
Powering an Arduino from a USB is the way used by most people. When an
Arduino is connected to a computer to load code, it also provides power for testing.
If a project involves interaction with the USB port, in order to send or receive serial
data for example, the USB is an easy, no hassle method. However, if a project is
mobile or not in close proximity to a computer, a different power option will need to
be considered.
2. Barrel Jack
The Arduino Uno, Mega and Ethernet (as well as the many of the older boards)
have a standard 2.1mm center positive barrel jack connector. This jack has a diode to
protect the Arduino from reversed polarity. This allows the Arduino to be easily
connected to an AC-to-DC adapter or a battery pack. The recommended input voltage
for this jack is 7 to 12 volts. Stationary projects that will be near a wall outlet can be
powered with a 9v or 12v wall wart power supply rated at either 1amp or 500ma.For a
mobile project, batteries can also be plugged into the barrel jack. The most basic option
is to create a 9v battery adapter.. To power a project with standard 1.5 volt alkaline AA
and AAA batteries requires at least a 6x battery holder.
3.VINPin
The VIN pin on Arduino boards can be used to tap into the power source plugged into
the barrel jack. Some shields will use this as their power source. The VIN pin is after the
polarity protection diode so keep in mind that the output will be about .6 to .7 volts less
than the input voltage
This pin can also be used as an input for power. The only difference between the barrel
jack and the VIN pin is that the VIN pin is after the polarity protection diode. This
means 2 things: first if the power is connected with polarity reversed it will destroy the
Arduino and second the power used by the Arduino will be slightly less, leading to
longer life if powered from a battery. Once again the type of project and components
will determine if this is the best route.
Personal computer is required to check the water level status continuously on webpage
developed for continuous monitoring of flood situation.
MAX 232
RS232
An RS-232 serial port was once a standard feature of a personal computer, used for
connections to modems, printers, mice, data storage, uninterruptible power supplies, and
other peripheral devices. However, RS-232 is hampered by low transmission speed,
large voltage swing, and large standard connectors. In modern personal
computers, USB has displaced RS-232 from most of its peripheral interface roles. Many
computers do not come equipped with RS-232 ports and must use either an external
USB-to-RS-232 converter or an internal expansion card with one or more serial ports to
connect to RS-232 peripherals
The standard defines how computers (it calls them Data Terminal Equipment or
DTEs) connect to modems (it calls them Data Communication Equipment or DCEs).
The standard says that computers should be fitted with a 25 way plug whilst modems
should have a 25 way D socket. The interconnecting lead between a computer and a
modem should be simply pin1-pin1, pin2-pin2, etc. The main signals and their direction
of flow are described below. It is important to note that a signal which is an output from
a computer is an input to a modem and vice versa.
This means that you can never tell from the signal name alone whether it is an
input or an output from a particular piece of equipment. Also, instead of being a DCE
device, a data acquisition device might be configured as DTE. In this case you need an
adaptor or the RS232 cable wired differently to normal. When the PC is connected to a
DTE instrument - called a null modem arrangement - some of the cable wires must cross
over. The RS-232 interface presupposes a common ground between the DTE and DCE.
This is a reasonable assumption when a short cable connects the DTE to the DCE, but
with longer lines and connections between devices that may be on different electrical
busses with different grounds, this may not be true.RS232 data is bi-polar.... +3 TO +12
volts indicates an "ON or 0-state (SPACE) condition" while A -3 to -12 volts indicates
an "OFF" 1-state (MARK) condition.... Modern computer equipment ignores the
negative level and accepts a zero voltage level as the "OFF" state. In fact, the "ON" state
may be achieved with lesser positive potential.
Fig 4.23:RS232
RS232 line type and logic level RS232 voltage TTL voltage to/from MAX232
Then select the type of Arduino you want to program, in our case its the Arduino
Mega.
5.3 CODING
The code you write for your Arduino are known as sketches. They
are written in C++. Every sketch needs two void type functions, setup() and
loop(). A void type function doesnt return any value. The setup() method is
ran once at the just after the Arduino is powered up and the loop() method is
ran continuously afterwards.
The setup() is where you want to do any initialisation steps, and in
loop() you want to run the code you want to run over and over again.
void setup()
{
void loop()
{
}
Now we have the basic skeleton in place we can now do the Hello, World
program of microcontrollers, a blinking an LED.
The pin numbers are listed next to the headers on the board in white.
The onboard LED we want to control is on pin 13.
In our code above the setup() method lets create a variable called
ledPin. In C++ we need to state why type our variable is before hand, in this
case its an integer, so its of type int.
void loop()
{
}
Each line is ended with a semicolon (;).
In the setup() method we want to set the ledPin to the output mode.
We do this by calling a special function called pinMode() which takes two
variables, the first the pin number, and second, whether its an input or
output pin. Since were dealing with an output we need to set it to a
constant called OUTPUT. If you were working with a sensor or input it
would be INPUT.
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
}
In our loop we are going to first switch off the LED to make sure our
program is being transferred to the chip and overriding the default.
We do this by calling another special method called digitalWrite(). This also
takes two values, the pin number and the level, HIGH or the on state or
LOW the off state.
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
digitalWrite(ledPin, LOW);
}
Plug your Arduino Mega board in to the USB cable and into your
computer. Now go back to the Tools > Serial Port menu and you should
see at least 1 new option. On my Mac 2 new serial ports appear.
They tty and cu are two ways that computers can talk over a serial
port. Both seem to work with the Arduino software so I selected the tty.*
one. On Windows you should see COM followed by a number. Select the
new one that appears.
Once you have selected your serial or COM port you can then press the
button with the arrow pointing to the right.
Once that happens you should see the TX and RX LEDs below the L LED flash.
This is the communication going on between the computer and the Arduino. The L may
flicker too. Once this dance is complete your program should be running. And your LED
should be off.
CHAPTER 6. CODING
attached to
const int analogInPin1 = A1; // Analog input pin that the potentiometer is
attached to
const int analogInPin2 = A2; // Analog input pin that the potentiometer is
attached to
int sensorValue0 = 0; // value read from the pot
int sensorValue1 = 0; // value read from the pot
int sensorValue2 = 0; // value read from the pot
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// initialize serial communications at 9600 bps:
Serial.begin(9600);
//lcd inital mesg
lcd.print("DAM WATER LEVEL ");
//3sec delay
delay(3000);
//sms inital
Serial.print("AT\r"); //Sets the GSM Module in Text Mode
delay(2000);
Serial.print("AT+CMGF=1\r"); //sms select
delay(2000);
Serial.print("AT+CMGS=\"9642699925\"\r");//mobile number
delay(2000);
Serial.print("DAM WATER LEVEL");//mesg
Serial.print((char)26);// ASCII code of CTRL+Z
delay(2000);
//clear lcd
//sms inital
Serial.print("AT\r"); //Sets the GSM Module in Text Mode
delay(2000);
Serial.print("AT+CMGF=1\r"); //sms select
delay(2000);
Serial.print("AT+CMGS=\"8790509218\"\r");//mobile number
delay(2000);
Serial.print("DAM WATER LEVEL");//
Serial.print((char)26);// ASCII code of CTRL+Z
delay(2000);
//clear lcd
lcd.clear();
}
void loop() {
// read the analog in value:
sensorValue0 = analogRead(analogInPin0);
//print sensor value
Serial.print("sensor0 = " ); //mesg on serial
Serial.print(sensorValue0); // print value
Serial.print("\n" ); //new line
lcd.setCursor(0, 0); // top left
lcd.print("L1:");
lcd.print(sensorValue0);
delay(1000);
if(sensorValue0==0)
{
lcd.clear();
Serial.print("LEVEL1\n" );
lcd.setCursor(0, 0); // bottom left
lcd.print("LEVEL 1!!!!!!!!!");
delay(2000);
lcd.setCursor(0, 0); // bottom left
lcd.print("SENDING SMS!!! ");
delay(2000);
if(sensorValue2==0)
{
lcd.clear();
Serial.print("LEVEL3\n" );
lcd.setCursor(0, 0); // bottom left
lcd.print("LEVEL 3!!!!!!!!!");
delay(2000);
lcd.setCursor(0, 0); // bottom left
lcd.print("SENDING SMS!!! ");
delay(2000);
Serial.print("AT\r"); //Sets the GSM Module in Text Mode
delay(2000);
Serial.print("AT+CMGF=1\r");
delay(2000);
Serial.print("AT+CMGS=\"9642699925\"\r");
delay(2000);
Serial.print("Water at level 3\n");
Serial.print("DANGER!!!!!!!!!!!!!");
Serial.print((char)26);// ASCII code of CTRL+Z
delay(2000);
}
delay(1000);
}
6.2 SOFTWARE CODE OF LCD
#include <LiquidCrystal.h>
int val0 = 0;
int val1 = 0;
int val2 = 0;
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
delay(3000);
lcd.clear();
void loop() {
// Serial.println("VIB:");
lcd.print("L1:");
lcd.print(val0);
delay(500);
// Serial.println("VIB:");
lcd.print(" L2:");
lcd.print(val1);
delay(500);
// Serial.println("VIB:");
lcd.print("L3:");
lcd.print(val2);
delay(500);
CHAPTER 7. FLOWCHART
7.1 FLOWCHART
7.2 ADVANTAGES
1. Cost effective: Arduino boards are relatively inexpensive compared to other
microcontroller platforms. The pre-assembled Arduino modules cost less than
300 rupees.
2. Ready to use: Its ready to use structure makes it really easy to use. You dont
have to take care of burner, fuse settings, Serial Monitor Softwares etc.
3. Effortless functions: There are many functions present in the software of
Arduino which makes coding so easy and fast that is not possible with simple
microcontroller.
4. Large Community: Well it is obvious now that everyone is using Arduino
nowadays thats why you can get help anytime from anywhere whenever you
will have stuck somewhere.
7.3 APPLICATIONS
1. Reservoirs for water level detection: In reservoirs, it is applicable where
continuous water level monitoring can be done.
2. Any low-lying flood prone areas: It can be used in any low- lying areas where
the danger of flood is always detected. This project helps to save human life in
any flood prone areas and also rural areas.
CONCLUSION
The implementation of the project entitled Water level Meter for alerting
population about floods using Atmega 2560 is successfully done. This project helps to
save many lives by alerting the people on time to vacate the flood prone areas. In detail
the description of hardware used in the project entitled Detecting and alerting the
people about flood situation is given here. This project helps to save many lives by
alerting the people on time to vacate the flood prone areas.
The Project Water Level Meter for Alerting Population about floods by using
Atmega 2560 is designed to alert the population about flood situation to avoid the loss
of human life. The three water level sensors which is generally immersed in reservoirs
(mostly in flood affected areas). These water level sensors are pressure based (WL400)
sensor which senses the increase in water level based on the increasing level of pressure
in water. The three sensors are indicated for three levels. In implementing this project we
have learnt about GSM modem, LCD interfacing and the issues related to interfacing the
devices.
While designing this project we have learnt about Arduino IDE, Sketches, types
of Arduino boards and the procedure of implementing the code on Arduino board. These
helped us in the successful implementation of the project entitled Water level Meter for
alerting population about floods using Atmega 2560 .
BIBLIOGRAPHY
REFERENCES
[1] A. Shalom Hakkert, Victoria Gitelman, Eliah Ben-Shabat, Anevaluation of
crosswalk warning systems: effects on pedestrian andvehicle behavior, Transportation
Research Institute, TechnionIsrael Institute of Technology, Technion City, Haifa
32000, Israel,Transportation Research Part F 5 (2002) 275292
[2] Hitoshi Miyata, Makoto Ohki, Yasuyuki Yokouchi, Masaaki Ohkita ,Control of the
autonomous mobile robotDREAM-1 for a parallelparking, Department of Electrical
and Electronic Engineering,Faculty of Engineering, Tottori University, 4-101, Koyama-
Minami,Tottori 680, Japan, Mathematics and Computers in Simulation 41(1996) 129-
138
[3] Nikolaj Zimic, Miha Mraz, Decomposition of a complex fuzzycontroller for the
truck-and-trailer reverse parking problem,University of Ljubljana, Faculty of Computer
and Information Science,Trzaska cesta 25, SI-1000 Ljubljana, Slovenia, Mathematical
andComputer Modelling 43 (2006) 632645
[4] Massaki Wada, Student Member, Development of Advanced ParkingAssistance
System, IEEE, Kang Sup Yoon, Member, IEEE, andHideki Hashimoto, Member, IEEE,
IEEE Transactions on IndustrialElectronics, VOL. 50, NO. 1, Feb 2003
[5] Tsung-hua Hsu, Jing-Fu Liu, Pen-Ning Yu, Wang-Shuan Lee and Jia-Sing Hsu,
Development of an Automatic Parking System forVehicle, Automotive Research and
Testing Center, Changhua County,Taiwan, R.O.C., IEEE Vehicle Power and Propulsion
Conference(VPPC), September 3-5, 2008, Harbin, China.
WEBSITES
1. www.arduino.cc
2. www.engineeringsgarage.com
3. www.ieeeprojects.com
4. www.arduinoprojects.com
5. www.wikipedia.org.