Sunteți pe pagina 1din 53

DAM SAFETY SYSTEM

MINI PROJECT REPORT Submitted by

ABIN JOSEPH ANIL JOSEPH JEFFIN GEORGE


In partial fulfillment for the award of the degree of BACHELOR OF TECHNOLOGY IN ELECTRONICS AND COMMUNICATION 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 DAM SAFETY SYSTEM is the bonafide report of mini project work done by ABIN JOSEPH (Reg. No :204562) of sixth semester Electronics and the

Communication Engineering in partial fulfillment for the award of

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.

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 & 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

CONTENTS
Chapter LIST OF FIGURES LIST OF TABLES 1 2 3 INTRODUCTION BLOCK DIAGRAM BLOCK DIAGRAM DESCRIPTION 3.1 POWER SUPPLY 3.2 MICROCONTROLLER 4 5 CIRCUIT DIAGRAM CIRCUIT EXPLENATION 5.1 PIC167877A CONTROLLER 5.2 MAX232 IC 5.3 L293D IC 5.4 GSM MODULE 5.5 LCD DISPLAY 5.6VIBRATION SENSOR 5.7 FLOATING SWITCH 5.8WATER LEVEL SENSOR 5.9 DC MOTOR 6 WORKING OF THE CIRCUIT 6.1 TRANSMITTER SECTION 6.2 RECEIVER SECTION 7 8 SOFTWARE DESCRIPTION ALGORITHM 8.1 TRANSMITTER 8.2 RECEIVER 9 10 PCB FABRICATION PCB LAYOUT 10.1 TRANSMITTER SECTION 10.2 RECEIVER SECTION 11 12 13 14 15 COST ESTIMATION RESULTS CONCLUSION BIBLIOGRAPHY APPENDIX

Title
LIST OF ABBREVATIONS

Page no:
1 1 1 1 2 3 3 4 6 8 8 8 10 11 13 15 16 18 18 20 20 20 21 22 22 23 24 27 27 28 29 30 31 32 33

LIST OF ABBREVATIONS
A/D : Analog to Digital conversion BAP : Battery Assisted Power CPU : Central Processing Unit CRT : Cathode Ray Tube EN : Enable IC : Integrated Circuit UV : Ultra Violet LED : Light Emitting Diode MCU : Micro Controller Unit MIPS : Million Instructions Per Second PCB : Printed Circuit Board PIC : Peripheral Interface Controller RAM : Random Access Memory RFID : Radio Frequency Identification RMS : Root Mean Square RS : Register Select RW : Read Write TTL : Transistor Transistor Logic

LIST OF FIGURES

Fig. No 2.1a 2.1b 2.2 3.2 4.1 4.2 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 10.1 10.2 10.3 10.4

Title Block Diagram of main circuit Diagram Of Receiving Section Block Diagram Of power supply ciruit Pin Diagram of PIC 16F877A Transmitter Circuit Diagram Receiver Circuit Diagram MAX 232 pin diagram L293D pin diagram GSM Modem LCD Display Vibration Sensor Floating Switch Water Level Sensor DC Motor Transmitter PCB Schematic Transmitter PCB Layout Receiver PCB Schematic Receiver PCB Layout

Page No 2 2 4 5 6 7 9 10 12 14 15 17 18 19 27 27 28 28

ii

LIST OF TABLES
Table No: 5.1 5.2 5.3 5.4 11.1 Title RS232 Voltage levels L293D parameters GSM Modem Parameters LCD pin description Components cost table Page No: 9 11 12 14 29

iii

Dam Safety System

CHAPTER 1 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.

1 ECE Dept. VJCET

Dam Safety System

CHAPTER 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

2 ECE Dept. VJCET

Dam Safety System

CHAPTER 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.

3 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 reprogramming with flash memory) capability.

4 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

5 ECE Dept. VJCET

Dam Safety System

CHAPTER 4 CIRCUIT DIAGRAM

FIG 4.1 MAIN CIRCUIT transmitter section)

6 ECE Dept. VJCET

Dam Safety System

FIG 4.2 RECEIVER SECTION

7 ECE Dept. VJCET

Dam Safety System

CHAPTER 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 PIC16F877A 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 1-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 RS-232 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 8 ECE Dept. VJCET

Dam Safety System + 5 V supply via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-232 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

Fig 5.2: MAX 232 PIN DIAGRAM

Table5.1: RS 232 VOLTAGE LEVELS 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 9 ECE Dept. VJCET RS232 Voltage +3 V to +15V -3 V to -15V -3 V to -15V +3 V to +15V TTL Voltage 0V 5V 5V 0V

Dam Safety System

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.

Fig 5.3: L293D IC PIN DIAGRAM

10 ECE Dept. VJCET

Dam Safety System Table5.2: L293D PARAMETERS

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 = 90 C Storage and Junction Temperature

Value 36 36 7 7 1.2 4 -40 to 150

Unit V V V V V A C

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.

11 ECE Dept. VJCET

Dam Safety System

FIG 5.4: GSM MODEM

The key features are tabulated Table5.3: GSM MODEM PARAMETERS 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 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 12 ECE Dept. VJCET

Dam Safety System

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 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 .

13 ECE Dept. VJCET

Dam Safety System

FIG 5.5: LCD DISPLAY

PIN DESCRIPTION Table5.4: LCD PIN DESCRIPTION Pin no: 1 2 3 4 5 6 7 8 Symbol Vss Vdd Vo RS R/ W E DB0 DB1 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 14

Dam Safety System

9 10 11 12 13 14 15 16

DB2 DB3 DB4 DB5 DB6 DB7 A/Vee K

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)

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.

FIG 5.6: VIBRATION SENSOR 15 ECE Dept. VJCET

Dam Safety System 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

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

16 ECE Dept. VJCET

Dam Safety System

FIG 5.7: FLOATING SWITCH

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

17 ECE Dept. VJCET

Dam Safety System 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 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. 18 ECE Dept. VJCET

Dam Safety System 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

FIG 5.9 DC MOTOR

19 ECE Dept. VJCET

Dam Safety System

CHAPTER 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.

20 ECE Dept. VJCET

Dam Safety System

CHAPTER 7 SOFTWARE DESCRIPTION


7.1: 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. 7.2: 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.

21 ECE Dept. VJCET

Dam Safety System

CHAPTER 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

22 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

23 ECE Dept. VJCET

Dam Safety System

CHAPTER 9 PCB FABRICATION

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

9.2 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.

9.3 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.

9.4 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.

24 ECE Dept. VJCET

Dam Safety System

9.5 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.

9.6 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. 9.7 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 magnifying glass to see whether all the lines in the layout are clearly formed. Now the board is ready for tinning.

9.8 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 25 ECE Dept. VJCET

Dam Safety System and lead.

9.9 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.

9.10 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.

26 ECE Dept. VJCET

Dam Safety System

CHAPTER 10 PCB LAYOUT


10.1 TRANSMITTER SECTION

FIG 10.1 PCB SCHEMATIC

FIG 10.2 PCB LAYOUT

27 ECE Dept. VJCET

Dam Safety System

10.2 RECEIVER SECTION

FIG 10.3 RECEIVER PCB SCHEMATIC

FIG 10.4 RECEIVER PCB LAYOUT 28 ECE Dept. VJCET

Dam Safety System

CHAPTER 11 COST ESTIMATION


TABLE 11.1: COMPONENT COST TABLE 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

29 ECE Dept. VJCET

Dam Safety System

CHAPTER 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.

30 ECE Dept. VJCET

Dam Safety System

CHAPTER 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

31 ECE Dept. VJCET

Dam Safety System

CHAPTER 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

32 ECE Dept. VJCET

Dam Safety System

APPENDIX

33 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);

34 ECE Dept. VJCET

Dam Safety System Send_Command(Ate); 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() 35 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; 36 ECE Dept. VJCET

Dam Safety System flag=1; } } 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; } 37 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); } }

38 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 39 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; 40 ECE Dept. VJCET

Dam Safety System Send_Command(At_Read); 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; 41 ECE Dept. VJCET

Dam Safety System }while(Rx_Buffer!=','); 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') 42 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); 43 ECE Dept. VJCET

Dam Safety System Init_Mobile(); 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; 44 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); } }

45 ECE Dept. VJCET

S-ar putea să vă placă și