Vous êtes sur la page 1sur 67

DAM SAFTEY SYSTEM

MINI PROJECT REPORT Submitted by

ABIN JOSEPH
In partial fulfillment for the award of the degree of BACHELOR OF TECHNOLOGY IN ELECTRONICS AND COMMUNIATION ENGINEERING

VISWAJYOTHI COLLEGE OF ENGINEERING AND TECHNOLOGY VAZHAKULAM


(Affiliated to Mahatma Gandhi University, Kottayam)

2009 2013 BATCH

VISWAJYOTHI COLLEGE OF ENGINEERING AND TECHNOLOGY VAZHAKULAM


(Affiliated to Mahatma Gandhi University, Kottayam)

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

BONAFIDE CERTIFICATE
This is to certify that the mini project report entitled ... is the bonafide report of mini project work done

by (Reg. No :..) of sixth semester Electronics and Communication Engineering in partial fulfillment for the award of the degree of Bachelor of Technology in Electronics and Communication Engineering of Mahatma Gandhi University.

Mr. Manu Jose


Mini Project Guide

Prof. Jose P Varghese


HOD (ECE)

Examiners:

ABSTRACT

The most recent issue faced by people in kerala is the distrust about the safety of the dam mullaperiyar. The main issue behind this is the insufficient knowledge of the current condition of dam and lack of safety measures provided in the dam. Our project will provide an optimum solution for this issue. In this project a PIC16F877A will be the main controller. This project includes a water level detector, vibration detector and a water flow detector apart from a gsm transmitter & receiver. According to this project whenever the water level rises above a threshold level, the water level detector alerts the controller which in turn drive the motor to open the shutter so as to reduce the water level below the threshold. Whenever the water level reduces below threshold, the shutter gets closed automatically. A vibration sensor is included so as to detect an earthquake ant to take safety measures. Whenever an earthquake occurs, the vibration sensor detects it and open the shutters in order to reduce pressure on the walls and also send an alert showing dam is in danger which is displayed on major towns which are supposed to be the victims of the disaster occurs if the dam collapse using a gsm module and led display. Unfortunately if the dam collapses, we are supposed to inform people who are living in areas which are supposed to be affected by the disaster. Whenever the dam collapses, the water flow detector alerts the controller and the controller sends messages showing dam collapsed to the major towns which is displayed there in an lcd screen along with a buzzer. This alerts the people to move to safe places. The main advantage of this safety system is that, people can be alerted immediately about the state of the dam and the dam safety can be ensured upto certain satisfactory level.

ACKNOWLEDGEMENT
We are bounded to thank GOD ALMIGHTY for his grace and blessings he showered on us throughout this Endeavour. We express our sincere thanks to our Principal Dr. K.T MATHEW for his kind Co operation in all aspects of our project. We are very much grateful to Prof. JOSE P. VARGHESE, Head of Department, Electronics and Communication Engineering, for helping me to take up this venture and for fostering the excellent academic climate in the Department. It is with pleasure and a deep sense of gratitude that we acknowledge here the invaluable guidance and constant encouragement given by our guide Mr. KRISHNENDU K & Mr. MANU JOSE, Lecturers, Electronics and communication Engineering. We are thankful to all staffs of Electronics Department Laboratories for all their help and support. We are indebted to all others, who were constantly suggesting better way to process our work. Our project would not have been a success without the prayers and blessings of our parents.

ABIN JOSEPH

DAM SAFTEY SYSTEM

Dam Safety System

CONTENTS
LIST OF ABBREVATIONS..2 LIST OF FIGURES.3 LIST OF TABLES .....4 1. INTRODUCTION...5 2. BLOCK DIAGRAM...6 3. BLOCK DIAGRAM DESCRIPTION....7 3.1 POWER SUPPLY.....7 3.2 MICROCONTROLLER ..8 4. CIRCUIT DIAGRAM....10 5. CIRCUIT EXPLANATION...12 6. WORKING OF THE CIRCUIT.26 7. SOFTWARE DESCRIPTION27 8. ALGORITHM.28 9. PCB FABRICATION.30 10. PCB LAYOUT...33 11. COST ESTIMATION....36 12. RESULTS...37 13. CONCLUSION AND FUTURE ENHANCEMENT ..38 14. REFERENCE..39 APPENDIX.......40

ECE Dept. VJCET

Dam Safety System

LIST OF ABBREVATIONS

1. A/D : Analog to Digital conversion 2. BAP : Battery Assisted Power 3. CPU : Central Processing Unit 4. CRT : Cathode Ray Tube 5. EN : Enable 6. IC : Integrated Circuit 7. UV : Ultra Violet 8. LED : Light Emitting Diode 9. MCU : Micro Controller Unit 10. MIPS : Million Instructions Per Second 11. PCB : Printed Circuit Board 12. PIC : Peripheral Interface Controller 13. RAM : Random Access Memory 14. RFID : Radio Frequency Identification 15. RMS : Root Mean Square 16. RS : Register Select 17. RW : Read Write 18. TTL : Transistor Transistor Logic

ECE Dept. VJCET

Dam Safety System

LIST OF FIGURES
Fig. No Title Page No

2.1a Block Diagram of main circuit...6 2.1b Block Diagram Of Receiving Section.......6 2.2 Block Diagram Of power supply ciruit...6 3.1 LM78XX IC....8 3.2 Pin Diagram of PIC 16F877A....9 4.1 Transmitter Circuit Diagram...10 4.2 Receiver Circuit Diagram....11 5.2 MAX 232 pin diagram....14 5.3 L293D pin diagram .....15 5.4 GSM Modem...16 5.5 LCD Display....18 5.6 Vibration Sensor..20 5.7 Floating Switch....21 5.8 Water Level Sensor.22 5.9 DC Motor 24 10.1 Transmitter PCB Schematic.......32 10.2 Transmitter PCB Layout ........33 10.3 Receiver PCB Schematic ........33 10.4 Receiver PCB Layout .......34

ECE Dept. VJCET

Dam Safety System

LIST OF TABLES

Table No.

Title

Page No

5.1 RS232 Voltage levels13 5.2 L293D parameters.15 5.3 GSM Modem Parameters16 5.4 LCD pin description.19 11.1 Components cost table..36

ECE Dept. VJCET

Dam Safety System

1.INTRODUCTION
Dams are the back bone of the modern world as it holds the major role in power generation and acts as a major source of water supply for agricultural as well as industrial needs. So the existence of dams are very important for the rapid development of any place. In fact it is also very important to keep the dam safe as it can act as a water bomb if it collapses and can wipe out the entire area. Recently we are hearing many issues related with the safety of dam, and in the history we can see many situations where dam acts as a mass killer. So the installation of a safety system is very important. This project presents such a safety system which ensures the entire evaluation of dam parameters and ensures the safe operation of the dam. The main objective of this project is to keep the dam as well as the people around it safe. The major parameter that influences the stability and safety of a dam is its water level, also an earthquake near the dam can result in a big disaster. In this project these are the main parameters we are checking and taking necessary precautions if needed. it is also very important to alert the people if the dam collapses unfortunately. This project also deals with alerting people in case of a disaster. This system continuously evaluates the water level and controls the water level using automatic shutter system. It alerts people and opens shutter in case of an earthquake, and also informs all if the dam collapses. We use a GSM module for communication required. It consists of two sections , a transmitter at the dam and receiver at a distant place. This system ensures the total safety of the dam.

ECE Dept. VJCET

Dam Safety System

2. BLOCK DIAGRAM
The main parts of this project are represented as block diagrams. Here we have a transmitting section and a receiving block. All parts are connected to the centre PIC. The 3 sensors used water level sensor, vibration sensor and a water flow sensor. A GSM module is connected to the PIC for communication and in the receiver section in addition to GSM module we use an LCD display and a buzzer.

Water level detector

PIC 16F877A
Vibration detector

GSM module

Motor Driver IC Water level detector

Fig 2.1 a. Block diagram of main circuit

PIC 16F877A
GSM module

Buzzer

LCD Display

Fig 2.1 b. Block diagram of receiver section

ECE Dept. VJCET

Dam Safety System

3. BLOCK DIAGRAM DESCRIPTION


3.1 POWER SUPPLY IC regulators are versatile and relatively inexpensive and are available with features such as current/voltage boosting, internal short circuit current limiting, thermal shutdown and floating operation for high voltage applications. The regulated circuit is used to maintain constant output level. The integrated circuit regulator, sometimes called the three terminal regulators contains the circuitry for reference source error amplitude control device and overload protection all in a single IC chip. They are connected between output of a filter and input to the load. The 78xx series consist of three terminal positive voltage regulators. With adequate heat sinking they can deliver output current in excess of 1A. For proper operation, there should be a common ground between the input and output voltage. The capacitor C2 is used to improve the transient response of the filter. As per the Indian standards, the supply through the mains is 230 volts, 50 hertz ac. For this project, the power requirements are +5V dc voltage levels. In order to obtain the required output from the voltage regulators like 7805 etc, a minimum of 7.5V dc input is required. So we use a 12-0-12V, I amp transformer to step down the mains voltage to 12 volt (rms). The secondary of the transformer is feds to a bridge rectifier circuit for converting ac to dc volt. The pulsating output thus obtained has to be filtered to get the steady dc voltage. A capacitor filter of 4700 microfarad, 25V is used. Using regulator ICs 7805 and7812 the required voltage levels are obtained. We use this regulated supply for the working of the device.

ECE Dept. VJCET

Dam Safety System

Unregulated i/p

IN

LM7805IC

OUT

Regulated o/p

GND Ci Co

FIG3.1LM78XX IC The diode used in the rectifier circuit is 1N4007 power diodes. Here we have used 78xx series regulator which are three terminal, positive fixed voltage series regulators. The capacitor Ci is connected to the input of the regulator to eliminate inductive effect due to long distribution leads. The output capacitor Co improves the transient response.

3.2 MICROCONTROLLER The microcontroller used here is pic16f877A. PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller. Here 16 means it is a midrange type microcontroller. F means it uses flash memory. 877 indicates the product id. It is the brain of the entire system. All actions are controlled by this microcontroller. It should be programmed before use. It is a 40 pin microcontroller. Also it is of low cost. It has 8kB program memory. The CPU speed is 5 MIPS. PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability. 8 ECE Dept. VJCET

Dam Safety System

Fig 3.2: PIN DIAGRAM OF PIC16F877A

PICs have a set of registers that function as general purpose RAM. Special purpose control registers for on-chip hardware resources are also mapped into the data space. The addressability of memory varies depending on device series, and all PIC devices have some banking mechanism to extend addressing to additional memory. Later series of devices feature move instructions which can cover the whole addressable space, independent of the selected bank. In earlier devices, any register move had to be achieved via the accumulator

ECE Dept. VJCET

Dam Safety System

4. CIRCUIT DIAGRAM

FIG 4.1 MAIN CIRCUIT transmitter section)

10

ECE Dept. VJCET

Dam Safety System

11

ECE Dept. VJCET

Dam Safety System

5. CIRCUIT EXPLANATION
The circuit consists of a pic16f877A microcontroller, a water level sensor, vibration sensor, floating sensor, MAX232 IC, L293D IC, LCD display and a GSM modem . The working of each circuit elements is explained below.

5.1 PIC16F873 MICROCONTROLLER Separate code and data spaces (Harvard architecture) for devices other than PIC32, which has Von Neumann architecture. It has a small number of fixed length instructions Most instructions are single cycle execution (2 clock cycles, or 4 clock cycles in 8bit models), with one delay cycle on branches and skips One accumulator (W0), the use of which (as source operand) is implied (i.e. is not encoded in the opcode) All RAM locations function as registers as both source and/or destination of math and other functions. A hardware stack for storing return addresses A fairly small amount of addressable data space (typically 256 bytes), extended through banking Data space mapped CPU, port, and peripheral registers The program counter is also mapped into the data space and writable (this is used to implement indirect jumps).

There is no distinction between memory space and register space because the RAM serves the job of both memory and registers, and the RAM is usually just referred to as the register file or simply as the registers.

The control voltage is changed from 0V to +5V by variable resistor. The voltage is inputted to the analog port of PIC. In this circuit RA0/AN0 (pin13) is used for the analog input port. Because it isn't using VREF+ and VREF-, the minimum of the A/D conversion is Vss=0V and the upper limit is Vdd=+5V. The value of the variable resistor can be decided as you like. I used the B type of 10K ohm. The control voltage is taken in at the 1ECE Dept. VJCET

12

Dam Safety System millisecond period by CCP2 to work as compare mode.

5.2 MAX 232 IC


The MAX232 is an integrated circuit that converts signals from an RS232 serial port to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals. The drivers provide RS-232 voltage level outputs (approx. 7.5 V) from a single + 5 V supply via on-chip charge pumps and external capacitors. This makes it useful for implementing RS232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range, as power supply design does not need to be made more complicated just for driving the RS-232 in this case. The receivers reduce RS-232 inputs (which may be as high as 25 V), to standard 5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V. The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors - 0.1 F in place of the 1.0 F capacitors used with the original device

RS232 Line Type & Logic Level Data Transmission (Rx/Tx) Logic 0 Data Transmission (Rx/Tx) Logic 1 Control Signals(RTS/CTS/DTR/DSR) Logic 0 Control Signals(RTS/CTS/DTR/DSR) Logic 1

RS232 Voltage +3 V to +15V -3 V to -15V -3 V to -15V +3 V to +15V

TTL Voltage 0V 5V 5V 0V

Table5.1: RS 232 VOLTAGE LEVELS

13

ECE Dept. VJCET

Dam Safety System

Fig 5.2: MAX 232 PIN DIAGRAM

5.3 L293D IC The Device is a monolithic integrated high voltage, high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoids, DC and stepping motors) and switching power transistors. To simplify use as two bridges each pair of channels is equipped with an enable input. A separate supply input is provided for the logic, allowing operation at a lower voltage and internal clamp diodes are included. This device is suitable for use in switching applications at frequencies up to 5 kHz. The L293D is assembled in a 16 lead plastic package which has 4 center pins connected together and used for heat sinking The L293DD is assembled in a 20 lead surface mount which has 8 center pins connected together and used for heat sinking.

14

ECE Dept. VJCET

Dam Safety System

Fig 5.3: L293D IC PIN DIAGRAM

ABSOLUTE MAXIMUM RATINGS

Symbol Vs Vss Vi Ven Io Ptot Tstg

Parameter Supply voltage Logic Supply Voltage Input Voltage Enable Voltage Peak Output Current (100 ms non repetitive) Total Power Dissipation at Tpins Storage and Junction Temperature

Value 36 36 7 7 1.2 4 -40 to 150

Unit V V V V V A

Table5.2: L293D PARAMETERS

15

ECE Dept. VJCET

Dam Safety System

5.4 GSM MODULE This is a plug and play GSM Modem with a simple to interface serial interface. Use it to send SMS, make and which can be used to easily interface the modem to micro controllers and computers. receiving calls, and do other GSM operations by controlling it through simple AT commands from micro controllers and computers. It uses the highly popular SIM300 module for all its operations. It comes with a standard RS232 interface. The modem consists of all the required external circuitry required to start experimenting with the SIM300 module like the power regulation, external antenna, SIM Holder, etc.

FIG 5.4: GSM MODEM

The key features are tabulated

Feature Power supply Power saving Frequency bands

Implementation Single supply voltage 3.4V - 4.5V power consumption in SLEEP mode to 2.5mA SIM300 Tri-band: EGSM 900, DCS 1800, PCS 1900. The band can be set by AT COMMAND, and default band is EGSM 900 and DCS 1800

16

ECE Dept. VJCET

Dam Safety System

GSM class Transmit power

Small MS Class 4 (2W) at EGSM900 Class 1 (1W) at DCS1800 and PCS 1900

Temperature range

Normal operation: -20C to +55C Restricted operation: -25C to -20C and +55C to +70C z Storage temperature -40C to +80C

SIM interface External antenna

Supported SIM card: 1.8V ,3V Connected via 50 Ohm antenna connector or antenna pad Table5.3: GSM MODEM PARAMETERS

Power supply The power supply of SIM300 is from a single voltage source of VBAT= 3.4V...4.5V. In some case, the ripple in a transmit burst may cause voltage drops when current consumption rises to typical peaks of 2A, So the power supply must be able to provide sufficient current up to 2A. For the VBAT input, a local bypass capacitor is recommended. A capacitor (about 100F, low ESR) is recommended. Multi-layer ceramic chip (MLCC) capacitors can provide the best combination of low ESR and small size but may not be cost effective. A lower cost choice may be a 100 F tantalum capacitor (low ESR) with a small (1 F to 10F) ceramic in parallel, which is illustrated as following figure. And the capacitors should put as closer as possible to the SIM300 VBAT pins. The following figure is the recommended circuit.

5.5 LCD Display LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16*2 LCD display is very basic module and is very commonly used in various devises and circuits. These modules are preferred over seven segment and other multi segment LEDs. The reason being: LCDs are economical , easily programmable, have no limitation of displaying special and even custom characters(unlike in seven segment), animations and so on 17 ECE Dept. VJCET

Dam Safety System A 16*2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5*7 pixel matrix. This LCD has two registers, namely Command and Data The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing the screen, setting the cursor position, controlling display etc. the data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD The minimum power supply required is 0.3 V and the maximum power supply required is 7V. The supply current is in the order of 1.5 to 3 milli ampere .

FIG 5.5: LCD DISPLAY

18

ECE Dept. VJCET

Dam Safety System

PIN DESCRIPTION

Pin no: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Symbol Vss Vdd Vo RS R/ W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 A/Vee K

Function GND + 3V or + 5V Contrast Adjustment H/L Register Select Signal H/L Read/Write Signal H L Enable Signal H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line + 4.2V for LED/Negative Voltage Output Power Supply for B/L (OV)

Table5.4: LCD PIN DESCRIPTION

5.6 VIBRATION SENSOR The vibration sensor is used for testing the impact forceIt has high vibration detection sensitivity and the environmental of sound signal suppression, which has strong ability to engage in interference. The vibration sensor works on the principle of piezoelectric effect, whenever force is applied across a crystal, a corresponding output is obtained. This output is amplified and used in vibration sensors. 19 ECE Dept. VJCET

Dam Safety System

FIG 5.6: VIBRATION SENSOR It is consisted of piezoelectric element, spring oscillator, Sensitivity adjustment knob, and led. We can regulate the knob to adjust the sensitivity. For example when adjusting the knob clockwise, the sensitivity increases, oppositely it reduces and outputs alarm signal, led will light while testing the certain scope shock This sensor uses open-collector output transistor drive mode, you can directly interface with MCU. Connecting the white line (output) to MCUs digital I/0, then upload code . First set the port of MCU as1(high),then pull -up resistor output DC12v.When the sensor detect the vibration signal,Q1 break over. The voltage of a drop from 12v to 0.1v and white line drop-down to0.8v, while MCU can detect low voltage. Specifications

Power requirements: DC 12v Device type: fang-wide solid-state control device Operating Temperature: -30 ~ 65 Dimensions:45mm*38mm*20mm

20

ECE Dept. VJCET

Dam Safety System 5.7 WATER LEVEL SENSOR (FLOATING SWITCH) Magnetic Float Switches are used to control distinct levels of a liquid. They are based on the float principle with individual contacts for every level to be monitored. A float with a built-in magnetic system actuates a small reed contact through the wall of the guide tube. Thus the switching operation is without direct contact to the liquid, free of wear and tear, and does not require any power supply. A float with a built-in magnet moves with the surface level of the medium being measured along a guide tube in which one or more reed switches are installed. The magnet actuates the contacts at the pre-set positions thus allowing the monitoring of individual filling levels. A float is fixed to a lever mounted so that it moves with the surface level of the medium being measured. A magnet fitted ti the other end of the lever then activates a reed switch inside the housing

FIG 5.7: FLOATING SWITCH

21

ECE Dept. VJCET

Dam Safety System Specifications


Float Length: 60mm Operating temperature: -20 ~ 75C (-4 ~ 167F) Max switching voltage: 100VDC Max Breakdown voltage: 220VDC Max switching current: 0.5A Max Carry current: 1.0A Max contact Resistance:100m Contact form: N/O (N/C) Cable length: 40cm (16'') Max contact rating: 10w Body material: plastic

5.8 WATER LEVEL SENSOR (THREE WIRE SENSOR) Three wires are used here in order to detect the water level. These wires in turn acts as switch when operated in water. This sensor has a wide range of temperature capabilities whereas its operation depends on the conductivity of the fluid. Whenever the conductivity reduces , the efficiency of the sensor also decreases.

FIG 5.8: WATER LEVEL SENSOR

22

ECE Dept. VJCET

Dam Safety System Whenever the water rises above a particular limit, the three wires are short circuited. Then it acts as a closed circuit and vice versa.

5.9 D C MOTOR A DC motor is used in order to simulate the working of a shutter. The motor works on the principle of electromagnetic induction. The relationship between torque vs speed and current is linear, as the load on a motor increases, Speed will decrease. As long as the motor is used in the area of high efficiency long life and good performance can be expected. However, using the motor outside this range will result in high temperature rises and deterioration of motor parts. If voltage in continuous applied to a motor in a locked rotor condition, the motor will heat up and fail in a relatively short time. Therefore it is important that there is some form of protection against high temperature rises. A motor's basic rating point is slightly lower than its maximum efficiency point. Load torque can be determined by measuring the current drawn when the motor is attached to a machine whose actual load value is known. We will select the most suitable motor for your application after receiving your information.

Specifications 1. Voltage: 12.0VDC 2. Output Speed: 200 +/- 10% RPM 3. No-Load output current: =< 50 mA 4. Rotation Output: CW / CCW 5. Noise: No Gear Noise 6. Stall output: : Slip Gear, Broken Gear is no allowed 7. Output shaft of the axial clearance: =< 0.1 ~ 0.3mm, Horizontal clearance requirement =< 0.05

23

ECE Dept. VJCET

Dam Safety System

FIG 5.9 DC MOTOR

24

ECE Dept. VJCET

Dam Safety System

6. WORKING OF THE CIRCUIT


6.1 TRANSMITTER SECTION In this project, there are two stations, transmitting station and the receiving station. The transmitting station is circuit placed in the dam. It consists a microcontroller, three sensors, a motor and a gsm module. The microcontroller regularly checks for the water level and other parameters like vibration to detect earthquake and heavy water rise to detect if the dam is collapsed. When the water level rises above certain level the microcontroller gives instructions to work the motor in order to open the dam. A L293D IC is used for serial communication. When the water level falls below threshold. The shutter closes automatically When the vibration detector detects vibrations, the controller instructs the work the motor to open the shutter in order to open the dam using IC L293D. Also it sends a message through GSM module to inform public about the earthquake and set them alert. Unfortunately, if the dam collapses the floating switch detects a heavy water flow and sends message to the receiver section placed in major towns to alert the public. A MAX232 IC is used for GSM communication

6.2 RECEIVER SECTION The receiver section consists of a microcontroller, LCD display and a buzzer. Whenever a message is received from the transmitting section starting with the password 123 the message is displayed on the LCD display with a buzzer. The signal is received here by using a GSM module driven by MAX232 IC. It will continue with the alert unless it resets manually.

25

ECE Dept. VJCET

Dam Safety System

7. SOFTWARE DESCRIPTION
SOFTWARE DEVELOPMENT PROCEDURE The design of the software include the following steps. Writing the program code Assemble the program code using an assembler Simulate the program using a simulator Correcting errors Creating an error free object code

Writing of the source code is doing in assembly language. The microcontroller can only execute binary codes that are not easy to understand and study by human beings, so assembly languages are developed in which mnemonics are used for representing a particular code. Assembly language is a human understandable language. The microcontroller only knows the machine language. To convert assembly level language in to machine level, assemblers are used. An assembler can read one source code written in assembly level language, and able to convert it in to object codes. A simulator can be used to perform program simulation for finding whether the program execution flow is correct or not. About MPLAB IDE MPLAB IDE is a Windows Operating System (OS) software program that runs on a PC to develop applications for Microchip microcontrollers and digital signal controllers. It is called an Integrated Development Environment, or IDE, because it provides a single integrated "environment" to develop code for embedded microcontroller. It comprise of a project manager provides integration and communication between the IDE and the language tools, text editor for writing or editing programs, assembler for converting source code to object code and simulator for program simulation. It provides a flexible and fast developing environment for reliable programs. In this project work; the design of the program was done using this software.

26

ECE Dept. VJCET

Dam Safety System

8. ALGORITHM
8.1 TRANSMITTER 1. START 2. ACTIVATE ALL PIC FUNCTIONS 3. ASSIGN PORTD.F1=0 4. CHECK PORTB.F1 AND PORTB.F2 ARE ZERO IF YES STEP 5 TO 6 ELSE STEP 7 TO 9 5. IF FLAG=0, DRIVE THE MOTOR , GIVE DELAY, TURN OFF MOTOR 6. ASSIGN FLAG=1 7. IF WATER LEVEL BELOW TRESHOLD (PORTB.F0=0) 8. TURN MOTOR ANTICLOCKWISE TO CLOSE SHUTTER 9. SET FLAG TO SERO 10. IF FLOATING SWITCH IS ACTIVATED (IE DAM IS COLLAPSED) 11. SEND SMS TO MAJOR TOWNS 13. IF THE VIBRATION SENSOR IS ACTIVATED (EARTHQUAKE) 14. SEND ALERT TO MAJOR TOWNS 15.DRIVE MOTOR TO OPEN SHUTTER 16. GIVE DELAY 17. CLOSE SHUTTER 18. END

SEND SMS 1. 2. 3. 4. 5. 6. 7. 8. START ACTIVATE GSM MODULE SET GSM MODULE TO SEND TEXT SET NUMBER AS 9497325002 DELETE EXISTING TEXT MESSAGES IF EARTHQUAKE IS DETECTED SEND 123DAM DANGER IF DAM IS COLLAPSED SEND 123DAM BROKEN END

27

ECE Dept. VJCET

Dam Safety System

8.2 RECEIVER 1. START 2. SET REGISTER SELECT AND DATA BITS FOR LCD 3. CLEAR LCD 4. DISPLAY DAM SAFTEY SYSTEM 5.CHECK FOR ANY MESSAGE FROM GSM MODULE 6. CHECK WETHER THE MESSGAGE STARTS WITH PASSWORD 7. IF YES DISPLAY THE MESSAGE 8. END

READ MESSAGE 1. 2. 3. 4. 5. 6. 7. 8. START SET GSM ON SET GSM TO RECEIVE DATA CHECK WETHER DATA IS READY IF YES READ BUFFER READ TEXT RETURN TEXT WORD BY WORD END

28

ECE Dept. VJCET

Dam Safety System

9. PCB FABRICATION

The fabrication of PCB involves the following steps: PREPARATION OF LAYOUT The layout is prepared using special software called PAD2PAD. The steps involved are following:

DRAWING THE CIRCUIT DIAGRAM First the circuit diagram is drawn using ORCAD capture. In this first a new project name is given and then workspace will be available to us. Here the required components are spaced in the required position and required connections are made using connection tools. The names for different components are also given. In this way complete the circuit diagram.

TRANSFERRING OF CIRCUIT DIAGRAM TO ORCAD LAYOUT After completing the circuit diagram it is annotated and the net list was created. Then open the ORCAD layout plus the file in which the circuit diagram is stored is opened, and then convert it into MNL file. Now the circuit diagram is transferred to layout plus.

MAKING LAYOUT USING LAYOUT PLUS For making the layout, open the corresponding MNL file of the circuit. The minimum cost is given to the top layer so that when we route the board the priority of the layer will be minimum. The width of the lines and the spacing between the lines are adjusted. Then we give the auto routing command so that the board will contain maximum of two player position. The bottom layer lines are made minimum by proper placing of the components and by manual routing. Thus the layer is prepared and the printout is taken.

29

ECE Dept. VJCET

Dam Safety System

PREPARATION OF LAYOUT The circuit diagram is drawn in ORCAD capture and layout is prepared by ORCAD layout plus as described in the layout making procedure. From the layout plus the mirrored image of the top layer is printed onto the butter paper a negative image. Then it is exposed to UV rays.

TRANSFERRING OF THE LAYOUT TO THE COPPER CLAD First the copper clad sheet of the required size is cut by using a cutting machine. The sheet is cleaned by using steel scrubber. After cleaning it is dipped into photo resist solution so that a film of photo resist is formed on the board. The copper clad sheet is placed in an oven for some time so that the photo resist film will fix to the surface of the board. The next step is to form an image of the layout on the copper clad sheet. Then it is placed on UV exposure unit so that the UV rays will fall on the photo resist over the board in the region of the layout where the negative is transparent. Then the board is washed gently in water for about 1.15 minute so that the chemical reaction takes place in the region exposed by UV rays. Then the board is washed in a dye. Then check the layout on the board with actual circuit. If there is any mistake, the above process is repeated. If the layout is correct, the board is ready for etching.

ETCHING THE BOARD When the board is ready for etching, the board is placed in ferric chloride solution. It's checked in regular intervals to prevent over etching and successive damage to board. After etching is complete, the board is taken out of the etch and washed in water to remove excess ferric chloride. Now the copper lines are exposed and the board is checked with the 30 ECE Dept. VJCET

Dam Safety System magnifying glass to see whether all the lines in the layout are clearly formed. Now the board is ready for tinning.

TINNING For tinning the PCB is cleaned well and the flux is applied to the surface. Then it is passed through the tinning machine. In tinning the copper lines are plated with alloy of tin and lead.

DRILLING After tinning the next process is drilling. In this holes of require size are drilled in PCB wherever needed using an electric drilling machine.

SOLDERING Soldering is the joining together of two metals to give physical bonding and good electrical conductivity. It is used primarily in electrical and electronic circuitry. Solder is a combination of metals, which are solid at normal room temperatures and become liquid at between 180 and 200C. Solder bonds well to various metals, and extremely well to copper.

31

ECE Dept. VJCET

Dam Safety System

10. PCB LAYOUT


10.1 TRANSMITTER SECTION

FIG 10.1 PCB SCHEMATIC

32

ECE Dept. VJCET

Dam Safety System

FIG 10.2 PCB LAYOUT

10.2 RECEIVER SECTION

FIG 10.3 RECEIVER PCB SCHEMATIC

33

ECE Dept. VJCET

Dam Safety System

FIG 10.4 RECEIVER PCB LAYOUT

34

ECE Dept. VJCET

Dam Safety System

11. COST ESTIMATION


Sl. No 1 2 3 4 5 6 7 8 Components Microcontroller IC IC Voltage Regulator Bridge Resistors Crystal Capacitors Specification PIC 16F877A MAX 232 L293D IC 7805 Bridge Rectifier 1K 8Mhz 1uF 33pF 1000uF 9 10 11 12 13 14 15 LED Serial Connector GSM Modem Floating Switch Vibration Sensor DC Motor IC Bases SEN126B1B 12v 16F877A, MAX232, L293D 9 pin SIM300 Qty 2 2 1 2 2 4 2 6 2 2 4 2 2 1 1 1 2 4 30 7000 320 120 185 15 20 Rate 320 24 10 8 24 2 10

TABLE 11.1: COMPONENT COST TABLE

35

ECE Dept. VJCET

Dam Safety System

12. RESULTS

The results were obtained on the expected lines. The circuit was tested and its output is verified. The system will works without any malfunctions and the mini project can be considered as a success. All the peripherals used in this device are easily available. So, manufacturing and possible replacement is easier. Also immense experiences and ideas for the future work are gained with our project. Thus the design, coding and implementation of the circuit can be considered to be done in the correct way.

36

ECE Dept. VJCET

Dam Safety System

13. CONCLUSION AND FUTURE SCOPE

The circuit was successfully implemented and the circuit works in the required manner. The water level detector correctly identifies the water level and the controller controls the shutter operation as planned. The circuit offers almost all possible security to the dam. All these system works fully automatically, some more modifications that can be added to this system in future are pressure sensor and water level meter, the pressure sensor can read the pressure exerted by the water on the dam walls and the digital display shows the correct reading on a digital screen. Some difficulties faced while doing this project are coding difficulties and PCB design difficulties. In future more functions can be added to this system such as pressure detector, display water level etc. The salient features of this project are 1. Although the initial cost is high, the cost associated with maintenance etc can be reduced. 2. Very compact implementation. 3. User friendly. 4. Reliability. 5. Improved security 6. Cost of running is very low

37

ECE Dept. VJCET

Dam Safety System

14. BIBLIOGRAPHY

1. www.electronicsforu.com 2. www.datasheets.com 3. www.wikipedia.com 4. www.electronicszone.com 5. www.circuitstoday.com 6. Martin P. Bates ,PIC Microcontrollers, Second Edition: An Introduction to Microelectronics , Newnes; 2 edition, 2004

38

ECE Dept. VJCET

Dam Safety System

APPENDIX

39

ECE Dept. VJCET

Dam Safety System

APPENDIX A - DATA SHEET OF PIC16F877

40

ECE Dept. VJCET

Dam Safety System

41

ECE Dept. VJCET

Dam Safety System

42

ECE Dept. VJCET

Dam Safety System

43

ECE Dept. VJCET

Dam Safety System

44

ECE Dept. VJCET

Dam Safety System

45

ECE Dept. VJCET

Dam Safety System

46

ECE Dept. VJCET

Dam Safety System

APPENDIX B - DATA SHEET OF MAX 232

47

ECE Dept. VJCET

Dam Safety System

48

ECE Dept. VJCET

Dam Safety System

49

ECE Dept. VJCET

Dam Safety System

SOURCE CODE :
TRANSMITTER unsigned char flag=0,mess_count=0,str[5]; const unsigned char At[]={'A','T','\r','\n','\0'}; const unsigned char ate[]={'A','T','E','0','\r','\n','\0'}; const unsigned char At_Text[]={'A','T','+','C','M','G','F','=','1','\r','\n','\0'}; const unsigned char At_Read[]={'A','T','+','C','M','G','R','=','1','\r','\n','\0'}; const unsigned char At_delete[]={'A','T','+','C','M','G','D','=','1','\r','\n','\0'}; const unsigned char At_send[]={'A','T','+','C','M','G','S','=','\0'}; unsigned char mob_numbers[]={'+','9','1','9','4','9','7','3','2','5','0','0','2','\0'}; unsigned int temp,x,y; unsigned char Rx_Buffer,Rx_Count,Time_Out=0, String_Array[10],mob_number[18]; void Send_Command(const unsigned char *ptr) { unsigned char Tx_Count=0; do { Uart1_Write(ptr[Tx_Count]); Tx_Count++; }while(ptr[Tx_Count]!='\0'); } void Init_Mobile() { Send_Command(At); Delay_ms(300); Send_Command(Ate); ECE Dept. VJCET

50

Dam Safety System Delay_ms(200); Send_Command(At_Text); Delay_ms(300); Send_Command(At_delete); Delay_ms(500); } void Init(void) { Uart1_Init(9600); TRISB=0xFF; Delay_ms(8000); Init_Mobile(); TRISD=0; PORTD=0; } void send_msg() { Send_Command(At_send); UART1_write_text(mob_numbers); UART1_Write(0x0D); Delay_ms(200); UART1_Write_Text("123Dam Broken"); UART1_Write(0x1A); Delay_ms(10000); } void send_msg1() { 51 ECE Dept. VJCET

Dam Safety System Send_Command(At_send); UART1_write_text(mob_numbers); UART1_Write(0x0D); Delay_ms(200); UART1_Write_Text("123Danger"); UART1_Write(0x1A); Delay_ms(10000); } void main() { Init(); flag=0; while(1) { PORTD.F1=0; if((PORTB.F0==0) && (PORTB.F1==0)) { if(flag==0) { PORTD.F1=1; PORTD.F7=1; PORTD.F6=0; Delay_ms(1000); PORTD.F7=0; PORTD.F6=0; flag=1; 52 ECE Dept. VJCET

Dam Safety System } } else if(PORTB.F0==0) { if(flag==1) { PORTD.F7=0; PORTD.F6=1; Delay_ms(1000); PORTD.F7=0; PORTD.F6=0; flag=0; } } else { if(flag==1) { PORTD.F7=0; PORTD.F6=1; Delay_ms(1000); PORTD.F7=0; PORTD.F6=0; flag=0; } } 53 ECE Dept. VJCET

Dam Safety System if(PORTB.F2==0) { PORTD.F1=1; send_msg(); } if(PORTB.F3==0) { PORTD.F1=1; send_msg1(); PORTD.F7=1; PORTD.F6=0; Delay_ms(1000); PORTD.F7=0; PORTD.F6=0; Delay_ms(3000); PORTD.F7=0; PORTD.F6=1; Delay_ms(1000); PORTD.F7=0; PORTD.F6=0; } Delay_ms(700); } }

54

ECE Dept. VJCET

Dam Safety System RECEIVER

sbit LCD_RS at RB7_bit; sbit LCD_EN at RB6_bit; sbit LCD_D4 at RB5_bit; sbit LCD_D5 at RB4_bit; sbit LCD_D6 at RB1_bit; sbit LCD_D7 at RB0_bit; sbit LCD_RS_Direction at TRISB7_bit; sbit LCD_EN_Direction at TRISB6_bit; sbit LCD_D4_Direction at TRISB5_bit; sbit LCD_D5_Direction at TRISB4_bit;sbit LCD_D6_Direction atTRISB1_bit;sbitLCD_D7_Direction at TRISB0_bit; char txt1[] = "DAM Security S/M"; unsigned char flag=0,mess_count=0,str[5]; const unsigned char At[]={'A','T','\r','\n','\0'}; const unsigned char ate[]={'A','T','E','0','\r','\n','\0'}; const unsigned char At_Text[]={'A','T','+','C','M','G','F','=','1','\r','\n','\0'}; const unsigned char At_Read[]={'A','T','+','C','M','G','R','=','1','\r','\n','\0'}; const unsigned char At_delete[]={'A','T','+','C','M','G','D','=','1','\r','\n','\0'}; unsigned char Rx_Buffer,Rx_Count,Time_Out=0, String_Array[10],mob_number[18]; void Send_Command(const unsigned char *ptr) { unsigned char Tx_Count=0; do { 55 ECE Dept. VJCET

Dam Safety System Uart1_Write(ptr[Tx_Count]); Tx_Count++; }while(ptr[Tx_Count]!='\0'); } void Init_Mobile() { Send_Command(At); Delay_ms(300); Send_Command(Ate); Delay_ms(200); Send_Command(At_Text); Delay_ms(300); Send_Command(At_delete); Delay_ms(500); Send_Command(At_delete); Delay_ms(500); } void Read_Message() { unsigned char Rx_Count=0,Rx_Buffer; Rx_Buffer=RCREG; Rx_Buffer=RCREG; Rx_Buffer=RCREG; RCSTA.CREN=0; RCSTA.CREN=1; Send_Command(At_Read); 56 ECE Dept. VJCET

Dam Safety System Delay_ms(5); Rx_Count=0; while(Uart1_Data_Ready()==0); Rx_Buffer=RCREG; while(Uart1_Data_Ready()==0); Rx_Buffer=RCREG; while(Uart1_Data_Ready()==0); Rx_Buffer=RCREG; if(Rx_Buffer=='E') { return; } while(Uart1_Data_Ready()==0); Rx_Buffer=RCREG; while(Uart1_Data_Ready()==0); Rx_Buffer=RCREG; while(Uart1_Data_Ready()==0); Rx_Buffer=RCREG; if(Rx_Buffer=='G') { Rx_Count=0; do { while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; }while(Rx_Buffer!=','); 57 ECE Dept. VJCET

Dam Safety System do { while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; mob_number[Rx_Count]= Rx_Buffer; Rx_Count++; }while(Rx_Buffer!=','); mob_number[Rx_Count-1]='\0'; do { while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; }while(Rx_Buffer!=0x0a); Rx_Count=0; while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; if(Rx_Buffer=='1') { while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; if(Rx_Buffer=='2') { while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; if(Rx_Buffer=='3') { 58 ECE Dept. VJCET

Dam Safety System Rx_Count=0; do { while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; String_Array[Rx_Count]=Rx_Buffer; Rx_Count++; if(Rx_Count>49) Rx_Count=0; }while(Rx_Buffer!=0x0a); } } } flag=1; String_Array[Rx_count-2]='\0'; Delay_ms(100); Send_Command(At_delete); Delay_ms(400); Send_Command(At_delete); Delay_ms(400);

} } void Init(void) { Uart1_Init(9600); Init_Mobile(); 59 ECE Dept. VJCET

Dam Safety System TRISD=0; } void main() {unsigned char k=0; PORTD=0; Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1,1,"I/O Intializing"); Delay_ms(3000); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1,1,"GSM Intializing"); Delay_ms(7000); Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1,1,txt1); k=0; while(1) { flag=0; if(k==1) { PORTD.F1=~PORTD.F1; } 60 ECE Dept. VJCET

Dam Safety System Read_Message(); if(flag==1) { k=1; flag=0; Lcd_Out(2,1," ");

Lcd_Out(2,1,String_Array); } Delay_ms(1000); } }

61

ECE Dept. VJCET

Dam Safety System

62

ECE Dept. VJCET

Vous aimerez peut-être aussi