You are on page 1of 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 i .

1a 2.2 3.4 5.9 10.LIST OF FIGURES Fig.1b 2.6 5.5 5.3 5.2 5.1 4. No 2.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 .2 5.3 10.2 10.7 5.2 4.1 10.8 5.

3 5.1 Title RS232 Voltage levels L293D parameters GSM Modem Parameters LCD pin description Components cost table Page No: 9 11 12 14 29 iii .2 5.1 5.4 11.LIST OF TABLES Table No: 5.

This system ensures the total safety of the dam. it is also very important to alert the people if the dam collapses unfortunately. 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. The main objective of this project is to keep the dam as well as the people around it safe. Recently we are hearing many issues related with the safety of dam.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. and in the history we can see many situations where dam acts as a mass killer. In this project these are the main parameters we are checking and taking necessary precautions if needed. a transmitter at the dam and receiver at a distant place.Dam Safety System CHAPTER 1 1. It consists of two sections . The major parameter that influences the stability and safety of a dam is its water level. So the existence of dams are very important for the rapid development of any place. 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. We use a GSM module for communication required. also an earthquake near the dam can result in a big disaster. VJCET . and also informs all if the dam collapses. 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. This project also deals with alerting people in case of a disaster. 1 ECE Dept.

Block diagram of main circuit PIC 16F877A GSM module Buzzer LCD Display Fig 2. Block diagram of receiver section 2 ECE Dept. vibration sensor and a water flow sensor.1 b. Here we have a transmitting section and a receiving block. Water level detector PIC 16F877A Vibration detector GSM module Motor Driver IC Water level detector Fig 2.1 a. The 3 sensors used water level sensor.Dam Safety System CHAPTER 2 BLOCK DIAGRAM The main parts of this project are represented as block diagrams. All parts are connected to the centre PIC. 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. VJCET .

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

Here we have used 78xx series regulator which are three terminal. All actions are controlled by this microcontroller. 4 ECE Dept. It should be programmed before use. The output capacitor Co improves the transient response. The capacitor Ci is connected to the input of the regulator to eliminate inductive effect due to long distribution leads. F means it uses flash memory. Here 16 means it is a midrange type microcontroller. extensive collection of application notes. VJCET . PIC is a family of Harvard architecture microcontrollers made by Microchip Technology. positive fixed voltage series regulators. Also it is of low cost. PICs are popular with both industrial developers and hobbyists alike due to their low cost. 3. The CPU speed is 5 MIPS.1LM78XX IC The diode used in the rectifier circuit is 1N4007 power diodes. It is a 40 pin microcontroller.Dam Safety System Unregulated i/p IN LM7805IC OUT Regulated o/p GND Ci Co FIG3.2 MICROCONTROLLER The microcontroller used here is pic16f877A. availability of low cost or free development tools. It has 8kB program memory. derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. and serial programming (and reprogramming with flash memory) capability. The name PIC initially referred to "Peripheral Interface Controller”. large user base. 877 indicates the product id. It is the brain of the entire system. wide availability.

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

1 MAIN CIRCUIT transmitter section) 6 ECE Dept. VJCET .Dam Safety System CHAPTER 4 CIRCUIT DIAGRAM FIG 4.

VJCET .2 RECEIVER SECTION 7 ECE Dept.Dam Safety System FIG 4.

with one delay cycle on branches and skips One accumulator (W0). vibration sensor. CTS and RTS signals. A hardware stack for storing return addresses A fairly small amount of addressable data space (typically 256 bytes). VJCET . floating sensor. port. 5. The control voltage is taken in at the 1-millisecond period by CCP2 to work as compare mode. The value of the variable resistor can be decided as you like. The drivers provide RS-232 voltage level outputs (approx. The MAX232 is a dual driver/receiver and typically converts the RX. The control voltage is changed from 0V to +5V by variable resistor. I used the B type of 10K ohm.1 PIC16F877A MICROCONTROLLER Separate code and data spaces (Harvard architecture) for devices other than PIC32. MAX232 IC. There is no distinction between memory space and register space because the RAM serves the job of both memory and registers. the use of which (as source operand) is implied (i.Dam Safety System CHAPTER 5 CIRCUIT EXPLANATION The circuit consists of a pic16f877A microcontroller. extended through banking Data space mapped CPU. and peripheral registers The program counter is also mapped into the data space and writable (this is used to implement indirect jumps). TX. a water level sensor. and the RAM is usually just referred to as the register file or simply as the registers. L293D IC.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. which has Von Neumann architecture. ± 7. In this circuit RA0/AN0 (pin13) is used for the analog input port. or 4 clock cycles in 8bit models). is not encoded in the opcode) All RAM locations function as registers as both source and/or destination of math and other functions. the minimum of the A/D conversion is Vss=0V and the upper limit is Vdd=+5V. Because it isn't using VREF+ and VREF-. 5.e.5 V) from a single 8 ECE Dept. The voltage is inputted to the analog port of PIC. LCD display and a GSM modem . It has a small number of fixed length instructions Most instructions are single cycle execution (2 clock cycles. The working of each circuit elements is explained below.

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.2: MAX 232 PIN DIAGRAM Table5.3 V. and a typical hysteresis of 0.0. to standard 5 V TTL levels. These receivers have a typical threshold of 1. as power supply design does not need to be made more complicated just for driving the RS-232 in this case. 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 . The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors . The receivers reduce RS-232 inputs (which may be as high as ± 25 V). 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.5 V.1 μF in place of the 1.Dam Safety System + 5 V supply via on-chip charge pumps and external capacitors.0 μF capacitors used with the original device Fig 5.

3: L293D IC PIN DIAGRAM 10 ECE Dept. This device is suitable for use in switching applications at frequencies up to 5 kHz. VJCET . high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoids. Fig 5.Dam Safety System 5. A separate supply input is provided for the logic. DC and stepping motors) and switching power transistors. 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. allowing operation at a lower voltage and internal clamp diodes are included.3 L293D IC The Device is a monolithic integrated high voltage. To simplify use as two bridges each pair of channels is equipped with an enable input.

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

VJCET .4V .4: GSM MODEM The key features are tabulated Table5.8V . The band can be set by AT COMMAND.3: GSM MODEM PARAMETERS Feature Power supply Power saving Frequency bands Implementation Single supply voltage 3. 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: -20°C to +55°C Restricted operation: -25°C to -20°C and +55°C to +70°C z Storage temperature -40°C to +80°C SIM interface External antenna Supported SIM card: 1.Dam Safety System FIG 5.3V Connected via 50 Ohm antenna connector or antenna pad 12 ECE Dept. PCS 1900. DCS 1800.5mA SIM300 Tri-band: EGSM 900.4.5V power consumption in SLEEP mode to 2.

5 to 3 milli ampere . A 16*2 LCD display is very basic module and is very commonly used in various devises and circuits. a local bypass capacitor is recommended. These modules are preferred over seven segment and other multi segment LEDs. The reason being: LCDs are economical .Dam Safety System Power supply The power supply of SIM300 is from a single voltage source of VBAT= 3.. low ESR) is recommended.4V. A lower cost choice may be a 100 µF tantalum capacitor (low ESR) with a small (1 µF to 10µF) ceramic in parallel. A capacitor (about 100µF. which is illustrated as following figure. And the capacitors should put as closer as possible to the SIM300 VBAT pins. animations and so on A 16*2 LCD means it can display 16 characters per line and there are 2 such lines. The following figure is the recommended circuit. This LCD has two registers. The supply current is in the order of 1. In some case. A command is an instruction given to LCD to do a predefined task like initializing it. VJCET . 13 ECE Dept. easily programmable..3 V and the maximum power supply required is 7V. The data is the ASCII value of the character to be displayed on the LCD The minimum power supply required is 0. 5.4. setting the cursor position. clearing the screen.5 LCD Display LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications.5V. In this LCD each character is displayed in 5*7 pixel matrix. For the VBAT input. So the power supply must be able to provide sufficient current up to 2A. controlling display etc. the ripple in a transmit burst may cause voltage drops when current consumption rises to typical peaks of 2A. have no limitation of displaying special and even custom characters(unlike in seven segment). namely Command and Data The command register stores the command instructions given to the LCD. Multi-layer ceramic chip (MLCC) capacitors can provide the best combination of low ESR and small size but may not be cost effective. the data register stores the data to be displayed on the LCD.

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 FIG 5.5: LCD DISPLAY PIN DESCRIPTION Table5.

FIG 5. The vibration sensor works on the principle of piezoelectric effect.6 VIBRATION SENSOR The vibration sensor is used for testing the impact force.It has high vibration detection sensitivity and the environmental of sound signal suppression.6: VIBRATION SENSOR 15 ECE Dept. a corresponding output is obtained. whenever force is applied across a crystal. This output is amplified and used in vibration sensors.2V for LED/Negative Voltage Output Power Supply for B/L (OV) 5. which has strong ability to engage in interference.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. VJCET .

and does not require any power supply. For example when adjusting the knob clockwise. 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. 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. They are based on the float principle with individual contacts for every level to be monitored.Dam Safety System It is consisted of piezoelectric element. free of wear and tear.8v. oppositely it reduces and outputs alarm signal.then pull -up resistor output DC12v. the sensitivity increases.7 WATER LEVEL SENSOR (FLOATING SWITCH) Magnetic Float Switches are used to control distinct levels of a liquid. Connecting the white line (output) to MCU‘s digital I/0.When the sensor detect the vibration signal. then upload code . First set the port of MCU as”1”(high). Specifications     Power requirements: DC 12v Device type: fang-wide solid-state control device Operating Temperature: -30℃ ~ 65℃ Dimensions:45mm*38mm*20mm 5.1v and white line drop-down to0. and led. Sensitivity adjustment knob. A magnet fitted ti the other end of the lever then activates a reed switch inside the housing 16 ECE Dept. led will light while testing the certain scope shock This sensor uses open-collector output transistor drive mode. spring oscillator. The magnet actuates the contacts at the pre-set positions thus allowing the monitoring of individual filling levels. you can directly interface with MCU. We can regulate the knob to adjust the sensitivity.Q1 break over. A float is fixed to a lever mounted so that it moves with the surface level of the medium being measured. while MCU can detect low voltage. VJCET . The voltage of a drop from 12v to 0.

7: FLOATING SWITCH Specifications            Float Length: 60mm Operating temperature: -20 ~ 75°C (-4 ~ 167°F) Max switching voltage: 100VDC Max Breakdown voltage: 220VDC Max switching current: 0.Dam Safety System FIG 5.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 .5A Max Carry current: 1.

the motor will heat up and fail in a relatively short time. Whenever the conductivity reduces . as the load on a motor increases. 18 ECE Dept. However.9 D C MOTOR A DC motor is used in order to simulate the working of a shutter. Therefore it is important that there is some form of protection against high temperature rises. FIG 5.8: WATER LEVEL SENSOR Whenever the water rises above a particular limit. the three wires are short circuited.Dam Safety System 5. using the motor outside this range will result in high temperature rises and deterioration of motor parts. Then it acts as a closed circuit and vice versa. As long as the motor is used in the area of high efficiency long life and good performance can be expected. These wires in turn acts as switch when operated in water. Speed will decrease. The motor works on the principle of electromagnetic induction. the efficiency of the sensor also decreases. If voltage in continuous applied to a motor in a locked rotor condition. This sensor has a wide range of temperature capabilities whereas its operation depends on the conductivity of the fluid. VJCET .8 WATER LEVEL SENSOR (THREE WIRE SENSOR) Three wires are used here in order to detect the water level. 5. The relationship between torque vs speed and current is linear.

0VDC 2. Load torque can be determined by measuring the current drawn when the motor is attached to a machine whose actual load value is known. Voltage: 12. Rotation Output: CW / CCW 5. VJCET .9 DC MOTOR 19 ECE Dept. Specifications 1. Output shaft of the axial clearance: =< 0. We will select the most suitable motor for your application after receiving your information.1 ~ 0. Output Speed: 200 +/. Noise: No Gear Noise 6.Dam Safety System A motor's basic rating point is slightly lower than its maximum efficiency point. Broken Gear is no allowed 7.10% RPM 3. Stall output: : Slip Gear.3mm. Horizontal clearance requirement =< 0. No-Load output current: =< 50 mA 4.05 FIG 5.

The transmitting station is circuit placed in the dam.2 RECEIVER SECTION The receiver section consists of a microcontroller. It will continue with the alert unless it reset’s manually. 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 motor and a gsm module. VJCET . transmitting station and the receiving station. 20 ECE Dept.Dam Safety System CHAPTER 6 WORKING OF THE CIRCUIT 6. there are two stations. 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. The signal is received here by using a GSM module driven by MAX232 IC. the controller instructs the work the motor to open the shutter in order to open the dam using IC L293D. It consists a microcontroller. 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. Also it sends a message through GSM module to inform public about the earthquake and set them alert. LCD display and a buzzer. The shutter closes automatically When the vibration detector detects vibrations. When the water level falls below threshold. three sensors. A L293D IC is used for serial communication.1 TRANSMITTER SECTION In this project. A MAX232 IC is used for GSM communication 6. When the water level rises above certain level the microcontroller gives instructions to work the motor in order to open the dam.

text editor for writing or editing programs. It is called an Integrated Development Environment. An assembler can read one source code written in assembly level language. or IDE. In this project work. 21 ECE Dept.1: SOFTWARE DEVELOPMENT PROCEDURE The design of the software include the following steps. The microcontroller only knows the machine language.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. VJCET . assembler for converting source code to object code and simulator for program simulation. assemblers are used. 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. Assembly language is a human understandable language. The microcontroller can only execute binary codes that are not easy to understand and study by human beings. the design of the program was done using this software. It comprise of a project manager provides integration and communication between the IDE and the language tools. To convert assembly level language in to machine level. because it provides a single integrated "environment" to develop code for embedded microcontroller. so assembly languages are developed in which mnemonics are used for representing a particular code.  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. It provides a flexible and fast developing environment for reliable programs.Dam Safety System CHAPTER 7 SOFTWARE DESCRIPTION 7. 7.

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

CLEAR LCD 4. 4. DISPLAY DAM SAFTEY SYSTEM 5. 6. 8. SET REGISTER SELECT AND DATA BITS FOR LCD 3. START 2. 3. CHECK WETHER THE MESSGAGE STARTS WITH PASSWORD 7.CHECK FOR ANY MESSAGE FROM GSM MODULE 6. 7.2 RECEIVER 1. 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. END READ MESSAGE 1. 5. IF YES DISPLAY THE MESSAGE 8. VJCET .Dam Safety System 8. 2.

The width of the lines and the spacing between the lines are adjusted. open the corresponding MNL file of the circuit. Thus the layer is prepared and the printout is taken. The steps involved are following: 9. Now the circuit diagram is transferred to layout plus.2 DRAWING THE CIRCUIT DIAGRAM First the circuit diagram is drawn using ORCAD capture. Then open the ORCAD layout plus the file in which the circuit diagram is stored is opened. The names for different components are also given. In this way complete the circuit diagram.Dam Safety System CHAPTER 9 PCB FABRICATION The fabrication of PCB involves the following steps: 9. In this first a new project name is given and then workspace will be available to us. VJCET . Then we give the auto routing command so that the board will contain maximum of two player position. 9. The bottom layer lines are made minimum by proper placing of the components and by manual routing. The minimum cost is given to the top layer so that when we route the board the priority of the layer will be minimum.4 MAKING LAYOUT USING LAYOUT PLUS For making the layout. Here the required components are spaced in the required position and required connections are made using connection tools. and then convert it into MNL file.3 TRANSFERRING OF CIRCUIT DIAGRAM TO ORCAD LAYOUT After completing the circuit diagram it is annotated and the net list was created. 24 ECE Dept.1 PREPARATION OF LAYOUT The layout is prepared using special software called PAD2PAD. 9.

8 TINNING For tinning the PCB is cleaned well and the flux is applied to the surface.Dam Safety System 9.7 ETCHING THE BOARD When the board is ready for etching. Then it is passed through the tinning machine. If the layout is correct. The next step is to form an image of the layout on the copper clad sheet. The sheet is cleaned by using steel scrubber. the board is ready for etching. Then it is exposed to UV rays. After etching is complete. 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.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 board is taken out of the etch and washed in water to remove excess ferric chloride. 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. From the layout plus the mirrored image of the top layer is printed onto the butter paper a negative image. After cleaning it is dipped into photo resist solution so that a film of photo resist is formed on the board. Now the board is ready for tinning. VJCET . 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. If there is any mistake.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. Then the board is washed in a dye. the above process is repeated. 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. It's checked in regular intervals to prevent over etching and successive damage to board. the board is placed in ferric chloride solution. 9. 9. 9. In tinning the copper lines are plated with alloy of tin 25 ECE Dept. Then check the layout on the board with actual circuit.

In this holes of require size are drilled in PCB wherever needed using an electric drilling machine.Dam Safety System and lead. and extremely well to copper. Solder bonds well to various metals.9 DRILLING After tinning the next process is drilling. Solder is a combination of metals. It is used primarily in electrical and electronic circuitry. which are solid at normal room temperatures and become liquid at between 180 and 200°C. 9. 26 ECE Dept.10 SOLDERING Soldering is the joining together of two metals to give physical bonding and good electrical conductivity. VJCET . 9.

VJCET .1 PCB SCHEMATIC FIG 10.2 PCB LAYOUT 27 ECE Dept.1 TRANSMITTER SECTION FIG 10.Dam Safety System CHAPTER 10 PCB LAYOUT 10.

Dam Safety System 10.2 RECEIVER SECTION FIG 10.4 RECEIVER PCB LAYOUT 28 ECE Dept. VJCET .3 RECEIVER PCB SCHEMATIC FIG 10.

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.1: COMPONENT COST TABLE Sl. MAX232. VJCET . 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.Dam Safety System CHAPTER 11 COST ESTIMATION TABLE 11.

All the peripherals used in this device are easily available. So. coding and implementation of the circuit can be considered to be done in the correct way.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. VJCET . manufacturing and possible replacement is easier. 30 ECE Dept. Thus the design. Also immense experiences and ideas for the future work are gained with our project.

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. 5. The circuit offers almost all possible security to the dam. VJCET . 3. 4. The salient features of this project are 1. display water level etc. Reliability. Some difficulties faced while doing this project are coding difficulties and PCB design difficulties.Dam Safety System CHAPTER 13 CONCLUSION AND FUTURE SCOPE The circuit was successfully implemented and the circuit works in the required manner. Very compact implementation. User friendly. some more modifications that can be added to this system in future are pressure sensor and water level meter. Although the initial cost is high. 2. All these system works fully automatically. Cost of running is very low 31 ECE Dept. The water level detector correctly identifies the water level and the controller controls the shutter operation as planned. Improved security 6. In future more functions can be added to this system such as pressure detector. the cost associated with maintenance etc can be reduced.

electronicsforu.electronicszone.PIC Microcontrollers. Newnes. www. Martin P. 2004 32 ECE Dept.com 4. 2 edition.com 6. Second Edition: An Introduction to Microelectronics .com 2. VJCET . www. Bates .com 5. www.com 3.wikipedia. www.Dam Safety System CHAPTER 14 BIBLIOGRAPHY 1.circuitstoday. www.datasheets.

VJCET .Dam Safety System APPENDIX 33 ECE Dept.

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

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

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

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

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

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

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

while(Uart1_Data_Ready()==0). Rx_Buffer=RCREG. Rx_Buffer=RCREG.} Rx_Buffer=RCREG. do { while(Uart1_Data_Ready()==0){. while(Uart1_Data_Ready()==0). Rx_Buffer=RCREG. Rx_Buffer=RCREG.Dam Safety System Send_Command(At_Read). 41 ECE Dept. while(Uart1_Data_Ready()==0). if(Rx_Buffer=='E') { return. Rx_Count=0. while(Uart1_Data_Ready()==0). } while(Uart1_Data_Ready()==0). Rx_Buffer=RCREG. Rx_Buffer=RCREG. if(Rx_Buffer=='G') { Rx_Count=0. VJCET . while(Uart1_Data_Ready()==0). Delay_ms(5).

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

} } } flag=1. Delay_ms(100). if(Rx_Count>49) Rx_Count=0. 43 ECE Dept. Send_Command(At_delete). Delay_ms(400). Send_Command(At_delete). String_Array[Rx_count-2]='\0'. } } void Init(void) { Uart1_Init(9600). Delay_ms(400). }while(Rx_Buffer!=0x0a). VJCET .Dam Safety System { Rx_Count=0. Rx_Count++. String_Array[Rx_Count]=Rx_Buffer. do { while(Uart1_Data_Ready()==0){.} Rx_Buffer=RCREG.

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

flag=0.1." "). } } 45 ECE Dept.String_Array). Lcd_Out(2. } Delay_ms(1000).Dam Safety System } Read_Message(). if(flag==1) { k=1. VJCET .1. Lcd_Out(2.