RAILWAY TRACK SECURITY SYSTEM USING ARDUINO A Project report submitted to Jawaharlal Nehru Technological University Kakinada, Kakinada Bachelor of Technology In Electronics and Communication Engineering Submitted By C.VANITHA (16X91A0414) D. GURU MOUNIKA (16X91A0418) G.RAJA REDDY (16X91A0423) G.PRASAD (16X91A0422) Under the esteemed guidance of Mr.K.SUNEEL BABU,M.Tech., Assistant Professor. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING SRI SATYANARAYANA ENGINEERING COLLEGE::ONGOLE (An ISO 9001:2008 Certified Institution) (Approved by AICTE,New Delhi& Affiliated to J.N.T.University,KAKINADA) Ongole-523225.,A.P 2016-2020. SRI SATYANARAYANA ENGINEERING COLLEGE::ONGOLE (An ISO 9001:2008 Certified Institution) (Approved by AICTE,New Delhi& Affiliated to J.N.T.University,KAKINADA) Ongole-523225,A.P. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING CERTIFICATE This is to certify that the main project report titled “ RAILWAY TRACK SECURITY SYSTEM USING ARDUINO” is the bonafied work carried out by C.VANITHA (16X91A0414) D. GURU MOUNIKA (16X91A0418) G.RAJA REDDY (16X91A0423) G.PRASAD (16X91A0422) in partial fulfillment of the requirements for the award of Bachelor of Technology in Electronics and Communication Engineering by J.N.T.U.K, Kakinada during the academic year2019-2020. Project Guide Mr.K.SUNEEL BABU M.Tech., ASSISTANT PROFESSOR. Project Co-ordinator Mr.R.KOTESWARA RAO M.Tech., ASSOCIATE PROFESSOR. EXTERNAL EXAMINER. H.O.D Mr.D.JAYA NAYUDU M.E.,(PhD)., PROFESSOR. ACKNOWLEDGEMENT We would like to express our profound sense of gratitude and indebtedness to our project guide Mr.K.SUNEEL BABU M.Tech., Assistant professor of ECE department, SSN Engineering College, Ongole for the valuable guidance and inspiration rendered by him during this project work. Mere words would not be sufficient to place on record the erudite guidance, sustained encouragement constructive comments and inspiring discussions with him during course of this project work. We honorably express our thanks to our project coordinator sri R.KOTESWARA RAO M.Tech., Associate professor for providing us an atmost congenial atmosphere to carry out our work peacefully. We are highly grateful and indebted to Mr.D.JAYA NAYUDU M.E.,(PhD)., professor and Head of the Department of ECE, SSN Engineering College, Ongole for his support and valuable suggestions for completing this project. We would like to express our deep sense of gratitude to all staff members of Electronics and Communication Engineering Department, SSN Engineering College, Ongole for their support in various aspects in completing this project. We would like to place on record the valuable academic support given by our principal Sri Dr.C.VEERESH NAYAK M.Tech.,PhD., for completion of the course . We would like to place on record the deep sense of gratitude to sense of gratitude to Sri.Y.SATYA NARAYANA REDDY garu,Director, SSN group of institutions for providing necessary facilities to carry the concluded project work. We express our sincere gratitude and thanks to our honorable Secretary and Correspondent Sri. Y.RAMAKRISHNA REDDY garu, for providing us with good faculty and infrastructure and for his moral support throughout the course. We would like to convey gratitude to our parents whose prayers and blessings are always with us. In this regard we would like to thank my friends and others who helped us directly or indirectly for successful completion of the seminar presentation. C.VANITHA (16X91A0414) D.GURU MOUNIKA (16X91A0418) G.RAJA REDDY (16X91A0423) G.PRASAD (16X91A0422) i ABSTRACT Indian railways are one of the largest railway networks of the world. Despite the huge size, the rampant negligence and lack of maintenance have created a number of problems. The main problem being that, frequent cracks are found in the rail lines which cause derailments leading to huge loss of life and property. In fact, the year 2010 alone, reports around 21 train crashes leading to around 450 deaths. Having researched about the conventional methods of railway track detection includes ultrasonic and eddy current based approaches, we find that their expensive nature does not warrant their use in the current scenario. Hence, we aim to create a new LED-LDR based simple technique to detect cracks in rails that will be cheap enough, so that it can be put to mass usage. Our scheme consists of a railway line looking for cracks during night time when local railways don’t operate. This project will be powered by a DC to motor traverse the railway line. It will be equipped with a LED (Light Dependent Resistor) and LDR arrangement. When a crack is present in the railway line the light falls on the LDR and its resistance decreases. This is detected by a microcontroller which then turns ON buzzer. Then micro controller will track the location of crack then it will display the location on LCD as well as it will send the location values by using GSM. To indicate the exact fault location. ii INDEX CONTENTS PAGE NO. ACKNOWLEDGEMENT i ABSTRACT ii LIST OF FIGURES v LIST OF TABLES vii CHAPTER-1:INTRODUCTION 1.1 Overview 1 1.2 Literature survey 2 1.3 Problem Identification 3 1.4 Advantages 3 1.5 Applications 4 1.6 Outline of thesis 4 CHAPTER-2:EMBEDDED SYSYTEM 2.1 What is Embedded System 5 2.2 Need for Embedded System 6 2.3 Application Areas 7 CHAPTER-3:IMPLEMENTATION OF RAILWAY TRACK FAULT DETECTION SYSTEM 3.1 Block diagram 8 3.2 INPUTS 8 3.2.1 LED 8 3.2.2 LDR 15 3.2.3 GPS 19 3.3 Technology 27 3.3.1 Arduino 27 3.3.2 At,mega 328 3.4 OUTPUTS 32 37 3.4.2 LCD Module 37 3.4.3 GSM 39 3.5 POWER SUPPLY 42 3.5.1 Step down Transformer 44 3.5.2 Bridge Rectifier 44 3.5.3 Filter 46 3.5.4 Voltage regulator 49 3.6 Software and Hardware Tools 51 3.7 Working Principle 51 3.8 Flow Chart 52 CHAPTER-4:SOFTWARE USAGE 4.1 Arduino IDE 53 CHAPTER-5:RESULT ANALYSIS 56 FUTURE SCOPE 57 CONCLUSION 58 REFERENCES 59 APPENDIX-A:SOFTWARE CODING 60 LIST OF FIGURE Figure no. Title Page no. 3.1 Block diagram 8 3.2 Light Emitting Diode 9 3.3 P-N Junction 3.4 V-I Characteristics of LED 3.5 Circuit symbol of LDR 16 3.6 Working principle of LDR 17 3.7 Variation of LDR Resistance with 10 11 Variation in light Intensity 17 3.8 Light Intensity vs LDR Resistance 18 3.9 Light Dependent Resistor Circuit 19 3.10 GPS Satellite System 20 3.11 Arduino Board 28 3.12 Pin diagram 33 3.13 Buzzer 37 3.14 Circuit diagram for Buzzer 3.15 2*16 line Alphanumeric LCD Display 3.16 GSM Module 42 3.17 Power supply diagram 44 3.18 Step down Transformer 45 3.19 Half wave Rectifier 46 3.20 Full wave Rectifier 47 V 38 40 3.21 Bridge Rectifier 48 3.22 7805 voltage Rectifier 50 4.1 Arduino 1.8.0 window 53 4.2 Arduino 1.8.0 uploading blink window 5.1 Output picture of railway track fault Detection system 54 56 VI LIST OF TABLES Table no. Title Page no. 3.1 Colours and Wave lengths 12 3.2 Pin Description of Arduino 28 3.3 Arduino uno Technical specifications 3.4 Key parameters of Atmega 328 33 3.5 Pin Description of Atmega 328 35 3.6 Pin Details of 7805 IC VII 31 51 RAILWAY TRACK SECURITY SYSTEM CHAPTER 1 INTRODUCTION 1.1 OVERVIEW In today’s world, transport is a key necessity because in its absence it would be impossible for products to be consumed in areas which are not in the immediate vicinity of the production centres. Throughout history, transport has been a necessity for the expansion of trade. Economic prosperity can be achieved by increasing the rationality and capacity of transport systems. The proper operation and maintenance of transport infrastructure has a great impact on the economy. Transport, being one of the biggest drainers of energy, its sustainability and safety are issues of paramount importance. In all over world, rail transport occupies a prominent position in quenching the ever- burgeoning needs of a rapidly growing economy. However, in terms of the reliability and safety parameters, global standards have not yet been truly reached. For example in the Indian railway network, today has track length of 113,617 kilometres (70,598 mi). Over a route of 63,974 kilometres (39,752 mi) and 7,083 stations. It is the fourth largest railway network in the world exceeded only by those of the United States, Russia and China. The rail network traverses every length and breadth of India and is known carry over 30 million passengers and 2.8 million tons of freight daily. Though rail transport here is growing at a rapid pace, the associated safety infrastructure facilities have not kept up with the aforementioned proliferation. Here facilities are inadequate compared to the international standards and as a result, there have been frequent derailments that have resulted in severe loss of valuable human lives and property as well. To demonstrate the gravity of the problem, official statistics say that there have been 11 accidents in 2011 till the month of July alone, which leaves much to be desired. On further analysis of the factors that cause these rail accidents, recent statistics reveal that approximately 60% of all the rail accidents have derailments as their cause, of which about 90% are due to cracks on the rails either due to natural causes (like excessive expansion due to heat) or due to antisocial elements. Hence these cracks in railway lines have been a perennial problem, which has to be addressed with utmost attention due to the frequency of rail usages. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 1 RAILWAY TRACK SECURITY SYSTEM These cracks and other problems with the rails generally go unnoticed due to improper maintenance and the currently irregular and manual track line monitoring that is being carried out. The high frequency of trains and the unreliability of manual labour have put forth a need for an automated system to monitor the presence of crack on the railway lines being carried out. The high frequency of trains and the unreliability of manual labour have put forth a need for an automated system to monitor the presence of crack on the railway lines. The problem inherent in all these techniques is that the cost incurred is high. Hence this paper proposes to the a cheap, novel yet simple scheme with sufficient ruggedness suitable to the all over world that uses an LED-LDR arrangement to detect the crack in railway lines, which proves to be cost effective as compared to the existing methods. The important role played by transport in the development of an economy has been studied. In addition, statistics of the number of rail accidents and their corresponding causes have also been studied. 1.2 LITERATURE SURVEY Recently research and development of rail track inspection have received a great deal of attention to save passengers life. The prompt detection of the condition in rails that may lead to crack or rather a break now plays a critical role in the maintenance of rail. The project specification of implementation result of RCDS used simple components inclusive of crack detector IR LED-PHOTODIODE based setup. To design crack inspection system and utilized for low cost feature robot which is on embedded platform for finding the cracks. The obstacles and cracks are detected by utilizing sensors in the robot, which are then apprized to the train driver through the GSM utilizing radio frequency signals. Firstly, we had a survey of existing technologies of automatic track security. This survey helped us to understand which technologies are suitable for our system which will make more efficient and easy to use. From all the developed or established system worked only one or two parts of the whole system. Here, we give a short review of the technologies which are already developed. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 2 RAILWAY TRACK SECURITY SYSTEM 1.3 PROBLEM IDENTIFICATION : Collision is one of the major issues of train accidents in every country. To make an anticollision system, author provide a system by LED and LCD panel to find if two trains are in same track or different track This technology will identify the collision points and also send the distance of two train to the control room. It will monitor the system to slow down the speeds of trains. Obstacle detection is another important part of railway security system. For detecting obstacle system need to sense train arrival so author used vibration sensor. To sense the obstacle in the path of trains obstacle sensor is used and send signal to microcontroller. Author divided the rails into several blocks and all blocks consisted of laser sensors and microcontroller. The laser sensor mainly sends signal to train either to stop or continue to run. Vision based method is used for automatic railroad track inspection. In this system, camera plays a vital role to capture and collect the images and videos. Author used image processing and MUSIC algorithm in this system. Image processing helped to process the frame image and MUSIC algorithm helped to detect number of signal in the presence of noise. Railway track security is the prime concern of our project. We think if we can give proper security to the railway tracks, it will be so helpful for the transportation system of our country and this will also help a lot in the economic development of our country. GPS (Global Positioning System) to enable autonomous and reliable determination of the train position, to the velocity under practically all environmental conditions. Another ethnological approach for the train location function: the use of GNSS signals integrated with inertial sensors. 1.4 ADVANTAGES Create an intelligent on target tracking. Wireless monitoring and control system. Its cost very low compared to existing system. Very accurate detection. Transmitting signals are immediately transfer. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 3 RAILWAY TRACK SECURITY SYSTEM It also checks surface and near surface of the cracking position. Accidents reduced. 1.5 APPLICATIONS Railway track damage detection application. Wireless applications. Industrial and access control. Navy applications. 1.6 OUTLINE OF THESIS We would like to give a brief report about “ RAILWAY TRACK SECURITY SYSTEM USING ARDUINO ”. Chapter 1: Describes the introduction about our project. Here we explained about introduction, advantages and applications of this project. Chapter 2: Deals with the introduction of Embedded Systems. Here we explained about what is embedded systems, .need for embedded systems and its applications Chapter 3: Describes the total description of the block diagram. In this chapter all the blocks in the block diagram are explained. Chapter 4: Describes the ARDUINO IDE software. Chapter 5: Describes the circuit diagram and physical appearance of RAILWAY TRACK SECURITY SYSTEM USING ARDUINO. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 4 RAILWAY TRACK SECURITY SYSTEM CHAPTER-2 EMBEDDED SYSTEM 2.1 WHAT IS EMBEDDED SYSTEM An Embedded System is a combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a specific function. A good example is the microwave oven. Almost every household has one, and tens of millions of them are used every day, but very few people realize that a processor and software are involved in the preparation of their lunch or dinner. This is in direct contrast to the personal computer in the family room. It too is comprised of computer hardware and software and mechanical components (disk drives, for example). However, a personal computer is not designed to perform a specific function rather; it is able to do many different things. Many people use the term general-purpose computer to make this distinction clear. As shipped, a general-purpose computer is a blank slate; the manufacturer does not know what the customer will do wish it. One customer may use it for a network file server another may use it exclusively for playing games, and a third may use it to write the next great American novel. Frequently, an embedded system is a component within some larger system. For example, modern cars and trucks contain many embedded systems. One embedded system controls the anti-lock brakes, other monitors and controls the vehicle's to the of emissions, and a third displays information on the dashboard. In some cases, these embedded systems are connected by some sort of a communication network, but that is certainly not a requirement. At the possible risk of confusing you, it is important to point out that a general-purpose computer is itself made up of numerous embedded systems. For example, my computer consists of a keyboard, mouse, video card, modem, hard drive, floppy drive, and sound card-each of which is an embedded system. Each of these devices contains a processor and software and is designed to perform a specific function. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 5 RAILWAY TRACK SECURITY SYSTEM For example, the modem is designed to send and receive digital data over analog telephone line. That's it and all of the other devices can be summarized in a single sentence as well. If an embedded system is designed well, the existence of the processor and software could be completely unnoticed by the user of the device. Such is the case for a microwave oven, VCR, or alarm clock. In some cases, it would even be possible to build an equivalent device that does not contain the processor and software. This could be done by replacing the combination with a custom integrated circuit that performs the same functions in hardware. However, a lot of flexibility is lost when a design is hard-cooled in this way. It is must easier, and cheaper, to change a few lines of software than to redesign a piece of custom hardware. An embedded system is a computer system designed to perform one or a few dedicated functions often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range of enduser needs. Embedded systems control many devices in common use today. Embedded systems are controlled by one or more main processing cores that are typically either the of microcontrollers or digital signal processors (DSP). The key characteristic, however, is being dedicated to handle a particular task, which may require very powerful processors. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. 2.2 Need For Embedded System : The uses of embedded systems are virtually limitless, because every day new products are introduced to the market that utilizes embedded computers in novel ways. In recent years, hardware such as microprocessors, microcontrollers, and FPGA chips have become much cheaper. So when implementing a new form of control, it's wiser to just buy the generic chip and write your own custom software for it. Producing a custom-made chip to handle a particular task or set of tasks costs far more time and money. Many embedded computers even come with extensive libraries, so that "writing your own software" becomes a very trivial task indeed. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 6 RAILWAY TRACK SECURITY SYSTEM 2.3 APPLICATION AREAS Nearly 99 percent of the processors manufactured end up in embedded systems. The embedded system market is one of the highest growth areas as these systems are used in very Market segment consumer electronics, office automation, indrustrial automation, bio medical engineering, wireless communication, data communication, tele communication., transportation, military and so on. Automation Systems : In modern era, we all are aware of Automation systems. Whether you are at home or your office, if things are not automated then it can make your work quite difficult. We don’t need to go far, let’s take the example of remote control. It has made our life so easy now we can turn things on or off by simply clicking buttons on our remote control. Smart Home automation is a widely diverse application of embedded systems. Security Systems : Now coming towards security systems, these are all the fruits of embedded systems. These days we have sensors installed in our homes and even if you are not at home you can still get complete visuals camera feeds on your mobile from anywhere in the world. That became possible just because of Embedded Systems. APPLIANCES : Most of our home appliances, like kitchen appliances which we normally called electric products are actually embedded products, micro Ovens, Toasters, burners. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 7 RAILWAY TRACK SECURITY SYSTEM CHAPTER 3 IMPLEMENTATION OF RAILWAY TRACK FAULT DETECTION SYSTEM 3.1 BLOCK DIAGRAM LED 2 LDR 2 A LCD R D U LED 1 LDR 1 BUZZER I N O GSM GPS Fig.3.1: Block Diagram 3.2 Inputs 3.2.1 LED (Light Emitting Diode) A light-emitting diode (LED)is a two-lead semiconductor light source. It is a p-n junction diode that emits light when activated. When a suitable current is applied to the leads, electrons are able to recombine with electron holes within the device, releasing energy in the DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 8 RAILWAY TRACK SECURITY SYSTEM form of photons. This effect is called electroluminescence, and the color of the light (corresponding to the energy of the photon) is determined by the energy band gap of the semiconductor. LEDs are typically small (less than 1 mm2) and integrated optical components may be used to shape the radiation pattern. Appearing as practical electronic components in 1962, the earliest LEDs emitted lowintensity infrared light. Infrared LEDs are still frequently used as transmitting elements in remote-control circuits, such as those in remote controls for a wide variety of consumer electronics. The first visible-light LEDs were of low intensity and limited to red. Modern LEDs are available across the visible, ultraviolet, and infrared wavelengths, with very high brightness. Fig.3.2: Light Emitting Diode Early LEDs were often used as indicator lamps for electronic devices, replacing small incandescent bulbs. They were soon packaged into numeric readouts in the form of sevensegment displays and were commonly seen in digital clocks. Recent developments have DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 9 RAILWAY TRACK SECURITY SYSTEM produced LEDs suitable for environmental and task lighting. LEDs have led to new displays and sensors, while their high switching rates are useful in advanced communications technology. LEDs have many advantages over incandescent light sources, including lower energy consumption, longer lifetime, improved physical robustness, smaller size, and faster switching. Light-emitting diodes are used in applications as diverse as aviation lighting, automotive headlamps, advertising, general lighting, traffic signals, camera flashes, lighted wallpaper and medical devices. They are also significantly more energy efficient and, arguably, have fewer environmental concerns linked to their disposal. Unlike a laser, the color of light emitted from an LED is neither coherent nor monochromatic, but the spectrum is narrow with respect to human vision, and for most purposes the light from a simple diode element can be regarded as functionally monochromatic. Working Principle Fig.3.3: P-N junction The electrons dissipate energy in the form of heat for silicon and germanium diodes. A P-N junction can convert absorbed light energy into a proportional electric current. The same process is reversed here (i.e. the P-N junction emits light when electrical energy is applied to it). This phenomenon is generally called electroluminescence, which can be defined as the emission of light from a semiconductor under the influence of an electric field. The charge DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 10 RAILWAY TRACK SECURITY SYSTEM carriers recombine in a forward-biased P-N junction as the electrons cross from the N-region and recombine with the holes existing in the P-region. Free electrons are in the conduction band of energy levels, while holes are in the valence energy band. Thus the energy level of the holes is less than the energy levels of the electrons. Some portion of the energy must be dissipated to recombine the electrons and the holes. This energy is emitted in the form of heat and light. But in gallium arsenide phosphate (GaAsP) and gallium phosphate (Gap) semiconductors, the electrons dissipate energy by emitting photon. If the semiconductor is translucent, the junction becomes the source of light as it is emitted, thus becoming a light-emitting diode. However, when the junction is reverse biased, the LED produces no light and—if the potential is great enough, the device is damaged. Fig.3.4: V-I characteristics of LED The wavelength of the light emitted, and thus its color, depends on the band gap energy of the materials forming the p-n junction. In silicon or germanium diodes, the electrons and holes usually recombine by a non-radioactive transition, which produces no optical emission, because these are indirect band gap materials. The materials used for the LED have a direct band gap with energies corresponding to near-infrared, visible, or near-ultraviolet light. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 11 RAILWAY TRACK SECURITY SYSTEM LED development began with infrared and red devices made with gallium arsenide. Advances in materials science have enabled making devices with ever-shorter wavelengths, emitting light in a variety of colors. LEDs are usually built on an n-type substrate, with an electrode attached to the p-type layer deposited on its surface. P-type substrates, while less common, occur as well. Many commercial LEDs, especially GaN/InGaN, also use sapphire substrate. Efficiency and operational parameters Typical indicator LEDs are designed to operate with no more than 30–60 mill watts (mW) of electrical power. Around 1999, Philips limitless introduced power LEDs capable of continuous use at one watt. These LEDs used much larger semiconductor die sizes to handle the large power inputs. Also, the semiconductor dies were mounted onto metal slugs to allow for greater heat dissipation from the LED die. One of the key advantages of LED-based lighting sources is high luminous efficacy. White LEDs quickly matched and overtook the efficacy of standard incandescent lighting systems. In 2002, Lucile’s made five-watt LEDs available with luminous efficacy of 18–22 lumens per watt (lm/W). For comparison, a conventional incandescent light bulb of 60–100 watts emits around 15 lm/W, and standard fluorescent lights emit up to 100 lm/W. As of 2012, Philips had achieved the following efficacies for each color. The efficiency values show the physics – light power out per electrical power in. The lumen-per-watt efficacy value includes characteristics of the human eye and is derived using the luminosity function. Table No.3.1: Colors and Wavelengths Colour Red Wavelength Typical range efficiency (nm) Coefficient 620 < λ < 645 Typical efficacy (lm/w) 0.39 DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE 72 Page 12 RAILWAY TRACK SECURITY SYSTEM Red-orange 610 < λ < 620 0.29 98 Green 520 < λ < 550 0.15 93 Cyan 490 < λ < 520 0.26 75 Blue 460 < λ < 490 0.35 37 In September 2003, a new type of blue LED was demonstrated by Cree. This produced a commercially packaged white light giving 65 lm/W at 20 mA, becoming the brightest white LED commercially available at the time, and more than four times as efficient as standard incandescent. In 2006, they demonstrated a prototype with a record white LED luminous efficacy of 131 lm/W at 20 mA. Nichia Corporation has developed a white LED with luminous efficacy of 150 lm/W at a forward current of 20 mA. Cree's Lamp XM-L LEDs, commercially available in 2011, produce 100 lm/W at their full power of 10 W, and up to 160 lm/W at around 2 W input powers. In 2012, Cree announced a white LED giving 254 lm/W and 303 lm/W in March 2014.Practical general lighting needs high-power LEDs, of one watt or more. Typical operating currents for such devices begin at the 350 mA. These efficiencies are for the light-emitting diode only, held at low temperature in a lab. Since LEDs installed in real fixtures operate at higher temperature and with driver losses, realworld efficiencies are much lower. United States Department of Energy (DOE) testing of commercial LED lamps designed to replace incandescent lamps or CFLs showed that average efficacy was still about 46 lm/W in 2009 (tested performance ranged from 17 lm/W to 79 lm/W). DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 13 RAILWAY TRACK SECURITY SYSTEM Advantages Efficiency: LEDs emit more lumens per watt than incandescent light bulbs. The efficiency of LED lighting fixtures is not affected by shape and size, unlike fluorescent light bulbs or tubes. Color: LEDs can emit light of an intended color without using any color filters as traditional lighting methods need. This is more efficient and can lower initial costs. Size: LEDs can be very small (smaller than 2 mm and are easily attached to printed circuit boards. Warm-up time: LEDs light up very quickly. A typical red indicator LED to achieves full brightness in under a microsecond.LEDs used in communications devices can have even faster response times. Cycling: LEDs are ideal for uses subject to frequent on-off cycling, unlike incandescent and fluorescent lamps that fail faster when cycled often, or high intensity discharge lamp (HID lamps) that require a long time before restarting. Dimming: LEDs can very easily can be the dimmed either by pulse-width modulation or lowering the forward current. This pulse-width modulation is why LED lights, particularly headlights on cars, when viewed on camera or by some people, seem to flash or flicker. This is a type of stroboscopic effect. Cool light: In contrast to most light sources, LEDs radiate very little heat in the form of IR that can cause damage to sensitive objects or fabrics. Wasted energy is dispersed as heat through the base of the LED. Slow failure: LEDs mainly fail by dimming over time, rather than the abrupt failure of incandescent bulbs. Lifetime: LEDs can have a relatively long useful life. One report estimates 35,000 to 50,000 hours of useful life, though time to complete failure may be shorter or longer. Fluorescent tubes typically are rated at about 10,000 to 25,000 hours, depending partly on the conditions of use, and incandescent light bulbs at 1,000 to 2,000 hours. Several DOE demonstrations have shown that reduced maintenance costs from this DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 14 RAILWAY TRACK SECURITY SYSTEM extended lifetime, rather than energy savings, is the primary factor in determining the payback period for an LED product. Shock resistance: LEDs, being solid-state components, are difficult to damage with external shock, unlike fluorescent and incandescent bulbs, which are fragile Focus: The solid package of the LED can be designed to focus its light. Incandescent and fluorescent sources often require an external reflector to collect light and direct it in a usable manner. For larger LED packages total internal reflection (TIR) lenses are often used to the same effect. However, when large quantities of light are needed many light sources are usually deployed, which are difficult to focus or collimate towards the same target. Applications LED uses fall into four major categories: Visual signals where light goes more or less directly from the source to the human eye, to convey a message or meaning Illumination where light is reflected from objects to give visual response of these objects Measuring and interacting with processes involving no human vision Narrow band light sensors where LEDs operate in a reverse-bias mode and respond to incident light, instead of emitting light. 3.2.2 LDR (Light Dependent Resistor) The dominant of street lights, outside lights, a number of indoor home appliances, and so on are typically operated and maintained manually on many occasions. This is not only risky, however additionally leads to wastage of power with the negligence of personnel or uncommon circumstances in controlling these electrical appliances ON and OFF. Hence, we can utilize the light sensor circuit for automatic switch OFF the loads based on daylight’s intensity by employing a light sensor. This article discusses in brief about what is a light dependent resistor, how to make a light dependent resistor circuit and its applications. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 15 RAILWAY TRACK SECURITY SYSTEM Fig.3.5: Circuit Symbol of LDR An LDR or light dependent resistor is also known as photo resistors, photocell, and photoconductor. It is a one type of resistor whose resistance varies depending on the amount of light falling on its surface. When the light falls on the resistor, then the resistance changes. These resistors are often used in many circuits where it is required to sense the presence of light. These resistors have a variety of functions and resistance. For instance, when the LDR is in darkness, then it can be used to turn ON a light or to turn OFF a light when it is in the light. A typical light dependent resistor has a resistance in the darkness of 1MOhm, and in the brightness a resistance of a couple of KOhm. Working Principle of LDR This resistor works on the principle of photo conductivity. It is nothing but, when the light falls on its surface, then the material conductivity reduces and also the electrons in the valence band of the device are excited to the conduction band. These photons in the incident light must have energy greater than the band gap of the semiconductor material. This makes the electrons to jump from the valence band to conduction. These resistors are often used in many circuits where it is required to sense the presence of light. These resistors have a variety of functions and resistance. For instance, when the LDR is in darkness, then it can be used to turn ON a light or to turn OFF a light when it is in the light. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 16 RAILWAY TRACK SECURITY SYSTEM Fig.3.6: Working Principle of LDR These devices depend on the light, when light falls on the LDR then the resistance decreases, and increases in the dark. When a LDR is kept in the dark place, its resistance is high and, when the LDR is kept in the light its resistance will decrease. Fig.3.7: Variation of LDR Resistance with Variation in Light Intensity If a constant “V’ is applied to the LDR, the intensity of the light increased and current increases. The figure below shows the curve between resistance Vs illumination curve for a particular light dependent resistor. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 17 RAILWAY TRACK SECURITY SYSTEM Fig.3.8: Light Intensity vs LDR Resistance Types of light Dependent Resistors Light dependent resistors are classified based on the materials used. Intrinsic Photo Resistors These resistors are pure semiconductor devices like silicon or germanium. When the light falls on the LDR, then the electrons get excited from the valence band to the conduction band and number of charge carriers increases. Extrinsic Photo Resistors These devices are doped with impurities and these impurities create a new energy bands above the valence band. These bands are filled with electrons. Hence this decrease the band gap and small amount of energy is required in moving them. These resistors are mainly used for long wavelengths. Circuit Diagram of a Light Dependent Resistor The circuit diagram of a LDR is shown below. When the light intensity is low, then the resistance of the LDR is high. This stops the current flow to the base terminal of the transistor. So, the LED does not light. However, when the light intensity onto the LDR is high, then the DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 18 RAILWAY TRACK SECURITY SYSTEM resistance of the LDR is low. So current flows onto the base of the first transistor and then the second transistor. Consequently the LED lights. Here, a preset resistor is used to turn up or down to increase or decrease the resistance. Fig.3.9: Light Dependent Resistor Circuit Light Dependent Resistor Applications Light dependent resistors have a low cost and simple structure. These resistors are frequently used as light sensors. These resistors are mainly used when there is a need to sense the absence and presence of the light such as burglar alarm circuits, alarm clock, light intensity meters, etc. LDR resistors mainly involves in various electrical and electronic projects. For better understanding of this concept, here we are explaining some real time projects were the LDR resistors are used. 3.2.3 GPS (GLOBAL POSITIONING SYSTEM) The Global Positioning System (GPS) is a U.S. space-based radio navigation system that provides reliable positioning, navigation, and timing services to civilian users on a continuous worldwide basis -- freely available to all. For anyone with a GPS receiver, the system will provide location and time. GPS provides accurate location and time information for an unlimited number of people in all weather, day and night, anywhere in the world. The GPS is made up of three parts: 1. Satellites orbiting the Earth DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 19 RAILWAY TRACK SECURITY SYSTEM 2. Control and monitoring stations on Earth 3. The GPS receivers owned by users. GPS satellites broadcast signals from space that are picked up and identified by GPS receivers. Each GPS receiver then provides three-dimensional location (latitude, longitude, and altitude) plus the time. 1. SPACE SEGMENT 24+ satellites 20,200 km altitude 55 degrees inclination 12 hour orbital period 5 ground control stations Each satellite passes over a ground monitoring station every 12 hours Fig.3.10: GPS satellite system The space segment is composed of the orbiting GPS satellites or Space Vehicles (SV) in GPS parlance. The GPS design originally called for 24 SVs, this was modified to six planes with four satellites each. The orbital planes are centered on the Earth, not rotating with respect to the distant stars. The six planes have approximately 55° inclination (tilt relative to Earth's equator) and are separated by 60° right ascension of the ascending node (angle along the equator DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 20 RAILWAY TRACK SECURITY SYSTEM from a reference point to the 1orbit's intersection). The orbits are arranged so that at least six satellites are always within line of sight from almost everywhere on Earth's surface. The full constellation of 24 satellites that make up the GPS space segment are orbiting the earth about 20,200 km above us. They are constantly moving, making two complete orbits in less than 24 hours. These satellites are travelling at speeds of roughly 7,000 miles an hour. GPS satellites are powered by solar energy. They have backup batteries onboard to keep them running in the event of a solar eclipse, when there's no solar power. Small rocket boosters on each satellite keep them flying in the correct path. Here are some other interesting facts about the GPS satellites (also called NAVSTAR, the official U.S. Department of Defense name for GPS): The first GPS satellite was launched in 1978. A full constellation of 24 satellites was achieved in 1994. Each satellite is built to last about 10 years. Replacements are constantly being built and launched into orbit. A GPS satellite weighs approximately 2,000 pounds and is about 17 feet across with the solar panels extended. Transmitter power is only 50 watts or less. The orbits are arranged so that at any time, anywhere on Earth, there are at least four satellites "visible" in the sky. All satellites broadcast at the same two frequencies, 1.57542 GHz (L1 signal) and 1.2276 GHz (L2 signal). The satellite network uses a CDMA spread-spectrum technique where the low-bitrate message data is encoded with a high-rate pseudo-random (PRN) sequence that is different for each satellite. The receiver must be aware of the PRN codes for each satellite to reconstruct the actual message data. The C/A code, for civilian use, transmits data at 1.023 million chips per second, whereas the P code, for U.S. military use, transmits at 10.23 million chips per second. The L1 carrier is modulated by both the C/A and DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 21 RAILWAY TRACK SECURITY SYSTEM P codes, while the L2 carrier is only modulated by the P code. The P code can be encrypted as a so-called P(Y) code which is only available to military equipment with a proper decryption key. Both the C/A and P(Y) codes impart the precise time-of-day to the user 2. Control and monitoring stations on Earth Ground Stations (also known as the "Control Segment") These stations monitor the GPS satellites, checking both their operational health and their exact position in space. The master ground station transmits corrections for the satellite's ephemeris constants and clock offsets back to the satellites themselves. The satellites can then incorporate these updates in the signals they send to GPS receivers. There are five monitor stations: Hawaii, Ascension Island, Diego Garcia, Kwajalein, and Colorado Springs. Each GPS satellite regularly with a navigational update using dedicated or shared ground antennas (GPS dedicated ground antennas are located at Kwajalein, Ascension Island, Diego Garcia, and Cape Canaveral). These updates synchronize the atomic clocks on board the satellites to within a few nanoseconds of each other, and adjust the ephemeris of each satellite's internal orbital model. The updates are created by a Kalman filter, which uses inputs from the ground monitoring stations, space weather information, and various other inputs. Satellite maneuvers are not precise by GPS standards. So to change the orbit of a satellite, the satellite must be marked unhealthy, so receivers will not use it in their calculation. Then the maneuver can be carried out, and the resulting orbit tracked from the ground. Then the new ephemeris is uploaded and the satellite marked healthy again. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 22 RAILWAY TRACK SECURITY SYSTEM 3.The GPS receivers Receiver determines location, speed, direction, and time 3 satellite signals are necessary to locate the receiver in 3D space 4th satellite is used for time accuracy Position calculated within sub-centimeter scale Individuals may purchase GPS handsets that are readily available through commercial retailers. Equipped with these GPS receivers, users can accurately locate where they are and easily navigate to where they want to go, whether walking, driving, flying, or boating. Today's GPS receivers are extremely accurate, thanks to their parallel multichannel design. Garmin's 12 parallel channel receivers are quick to lock onto satellites when first turned on and they maintain strong locks, even in dense foliage or urban settings with tall buildings. Certain atmospheric factors and other sources of error can affect the accuracy of GPS receivers. Garmin® GPS receivers are accurate to within 15 meters on average. Newer Garmin GPS receivers with WAAS (Wide Area Augmentation System) capability can improve accuracy to less than three meters on average. No additional equipment or fees are required to take advantage of WAAS. Users can also get better accuracy with Differential GPS (DGPS), which corrects GPS signals to within an average of three to five meters. The U.S. Coast Guard operates the most common DGPS correction service. This system consists of a network of towers that receive GPS signals and transmit a corrected signal by DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 23 RAILWAY TRACK SECURITY SYSTEM beacon transmitters. In order to get the corrected signal, users must have a differential beacon receiver and beacon antenna in addition to their GPS. Our ancestors had to go to pretty extreme measures to keep from getting lost. They erected monumental landmarks, laboriously drafted detailed maps and learned to read the stars in the night sky. Things are much, much easier today. For less than $100, you can get a pocket-sized gadget that will tell you exactly where you are on Earth at any moment. As long as you have a GPS receiver and a clear view of the sky, you'll never be lost again. The user segment is composed of hundreds of thousands of U.S. and allied military users of the secure GPS Precise Positioning Service, and tens of millions of civil, commercial and scientific users of the Standard Positioning Service. In general, GPS receivers are composed of an antenna, tuned to the frequencies transmitted by the satellites, receiver-processors, and a highly stable clock (often a crystal oscillator). They may also include a display for providing location and speed information to the user. A receiver is often described by its number of channels: this signifies how many satellites it can monitor simultaneously. Originally limited to four or five, this has progressively increased over the years so that, as of 2007, receivers typically have between 12 and 20 channels. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 24 RAILWAY TRACK SECURITY SYSTEM The Global Positioning System is vast, expensive and involves a lot of technical ingenuity, but the fundamental concepts at work are quite simple and intuitive. When people talk about "a GPS," they usually mean a GPS receiver. The Global Positioning System (GPS) is actually a constellation of 24 Earth-orbiting satellites The U.S. military developed and implemented this satellite network as a military navigation system, but soon opened it up to everybody else. Each of these 3,000- to 4,000-pound solar-powered satellites circles the globe making two complete rotations every day. The orbits are arranged so that at any time, anywhere on Earth, there are at least four satellites "visible" in the sky. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 25 RAILWAY TRACK SECURITY SYSTEM A GPS receiver's job is to locate four or more of these satellites, figure out the distance to each, and use this information to deduce its own location. This operation is based on a simple mathematical principle called trilateration. Trilateration in three-dimensional space can be a little tricky, so we'll start with an explanation of simple two-dimensional trilateration. APPLICATIONS OF GPS GPS has become a mainstay of transportation systems worldwide, Providing navigation for aviation, ground, and maritime operations. Disaster relief and emergency services depend upon GPS for location and timing capabilities in their life-saving missions. Everyday activities such as banking, Mobile phone operations, and even The control of power grids, are facilitated by the accurate timing provided by GPS. Farmers, surveyors, geologists and countless others perform their work more efficiently, safely, economically, and accurately using the free and open GPS signals. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 26 RAILWAY TRACK SECURITY SYSTEM 3.3 Technology 3.3.1 Arduino Arduino Uno is a microcontroller board based on 8-bit ATmega328P microcontroller. Along with ATmega328P, it consists of other components such as crystal oscillator, serial communication, voltage regulator, etc. to support the microcontroller. Arduino Uno has 14 digital input/output pins (out of which 6 can be used as PWM outputs), 6 analog input pins, a USB connection, A Power barrel jack, an ICSP header and a reset button. The 14 digital input/output pins can be used as input or output pins by using pinMode() and digitalRead() and digitalWrite() functions in the arduino to the programming. Each pin operate at 5V and can provide or receive a maximum of 40mA current, and has an internal pullup resistor of 20-50 KOhms which are disconnected by default. Out of these 14 pins, some pins have specific functions as listed below: Serial Pins 0 (Rx) and 1 (TX): Rx and Tx pins are used to receive and transmit TTL serial data. They are connected with the corresponding ATmega328P USB to TTL serial chip. External Interrupt Pins 2 and 3: These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. PWM Pins 3, 5, 6, 9 and 11: These pins provide an 8-bit PWM output by using analogWrite() function. SPI Pins 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK): These pins are used for SPI communication. In-built LED Pin 13: This pin is connected with an built-in LED, when pin 13 is HIGH – LED is on and when pin 13 is LOW, it’s off. Along with 14 Digital pins, there are 6 analog input pins, each of which provides 10 bits of resolution, i.e. 1024 different values. They measure from 0 to 5 volts but this limit can be increased by using AREF pin with analog Reference () function. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 27 RAILWAY TRACK SECURITY SYSTEM Analog pin 4 (SDA) and pin 5 (SCA) also used for TWI communication using Wire library. Fig.3.11: Arduino Board Table No.3.2: Pin Description of Arduino Pin Category Pin Name Details Vin: Input voltage to Arduino when using an external power source. Power Vin,3.3V, 5V, GND 5V: Regulated power supply used to power microcontroller and other components on the board. 3.3V: 3.3V supply generated by on-board voltage regulator. Maximum current draw is 50mA. GND: ground pins. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 28 RAILWAY TRACK SECURITY SYSTEM Reset Reset Resets the microcontroller. Analog Pins A0 – A5 Input/output Pins Digital Pins 0 - 13 Can be used as input or output pins. Serial 0(Rx),1(Tx) Used to receive and transmit TTL serial data. Used to provide analog input in the range of 0-5V DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 29 RAILWAY TRACK SECURITY SYSTEM External Interrupts 2, 3 PWM 3, 5, 6, 9, 11 To trigger an interrupt. Provides 8-bit PWM output. 10(SS), 11(MOSI), SPI 12 (MISO) and Used for SPI communication. 13 (SCK) Inbuilt LED 13 To turn on the inbuilt LED. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 30 RAILWAY TRACK SECURITY SYSTEM TWI A4 (SDA), A5 (SCA) AREF AREF Used for TWI communication. To provide reference voltage for input voltage. Arduino Uno has a couple of other pins as explained below: AREF: Used to provide reference voltage for analog inputs with analog Reference () function. Reset Pin: Making this pin LOW, resets the microcontroller. Table No.3.3: Arduino Uno Technical Specifications Microcontroller Operating Voltage Recommended Input Voltage Input Voltage Limits Analog Input Pins ATmega328p – 8 bit AVR family microcontroller 5V 7-12V 6-20V 6 (A0 – A5) DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 31 RAILWAY TRACK SECURITY SYSTEM Digital I/O Pins 14 (Out of which 6 provide PWM output) DC Current on I/O Pins 40 Ma DC Current on 3.3V Pin 50 mA Flash Memory 32 KB (0.5 KB is used for Boot loader) SRAM 2 KB EEPROM 1 KB Frequency (Clock Speed) 16 MHz Arduino can be used to communicate with a computer, another arduino board or other microcontrollers. The ATmega328P microcontroller provides UART TTL (5V) serial communication which can be done using digital pin 0 (Rx) and digital pin 1 (TX). An ATmega16U2 on the board channels this serial communication over USB and appears as a virtual com port to software on the computer. The ATmega16U2 firmware uses the standard USB COM drivers, and no external driver is needed. However, on Windows, a .info file is required. The arduino software includes a serial monitor which allows simple textual data to be sent to and from the arduino board. There are two RX and TX LEDs on the arduino board which will flash when data is being transmitted via the USB-to-serial chip and USB connection to the computer (not for serial communication on pins 0 and 1). A Software Serial library allows for serial communication on any of the Uno's digital pins. The ATmega328P also supports I2C (TWI) and SPI communication. The Arduino software includes a Wire library to simplify use of the I2C bus. 3.3.2 Atmega328 The Atmega328 is a very popular microcontroller chip produced by Atmel. It is an 8-bit microcontroller that has 32K of flash memory, 1K of EEPROM, and 2K of internal SRAM. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 32 RAILWAY TRACK SECURITY SYSTEM The Atmega328 is one of the microcontroller chips that are used with the popular Arduino Duemilanove boards. The Arduino Duemilanove board comes with either 1 of 2 microcontroller chips, the Atmega168 or the Atmega328. Of these 2, the Atmega328 is the upgraded, more advanced chip. Unlike the Atmega168 which has 16K of flash program memory and 512 bytes of internal SRAM, the Atmega328 has 32K of flash program memory and 2K of Internal SRAM. Fig.3.12: Pin Diagram Specifications The Atmega328 has 28 pins. It has 14 digital I/O pins, of which 6 can be used as PWM outputs and 6 analog input pins. These I/O pins account for 20 of the pins. Table No.3.4: Key Parameters of Atmega328 Parameter CPU type Performance Value 8-bit AVR 20 MIPS at 20 MHz DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 33 RAILWAY TRACK SECURITY SYSTEM Flash memory 32 kB SRAM 2 kB EEPROM 1 kB 28 or 32 pin: PDIP-28, MLF-28, TQFP-32 Pin count MLF-32 Maximum operating frequency 20 MHz Number of touch channels 16 Hardware Touch Acquisition No Maximum I/O pins 23 External interrupts 2 USB Interface No – USB Speed The ATmega328 is a single-chip microcontroller created that is by Atmel in the megaAVR family (later Microchip Technology acquired Atmel in 2016). It has a modified Harvard architecture 8-bit RISC processor core. The Atmel 8-bit AVR RISC-based 32 kB ISP flash memory with the microcontroller read-while-write is used capabilities, to combines and1 kB EEPROM, 2 kB SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible timer/counters with compare modes, internal and external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface, SPI serial port, 6-channel and 10-bit A/D converter (8-channels in TQFP and QFN/MLF packages), programmable watchdog timer with internal oscillator, and five software selectable power saving modes. The device operates between 1.8-5.5 volts. The device achieves throughput approaching 1 MIPS per MHz DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 34 RAILWAY TRACK SECURITY SYSTEM As of 2013 the ATmega328 is commonly used in many projects and autonomous systems where a simple, low-powered, low-cost micro-controller is needed Perhaps the most common implementation of this chip is on the popular Arduino development platform, namely to the Arduino Uno and Arduino Nano model. As stated before, 20 of the pins function as I/O ports. This means they can function as an input to the circuit or as output. Whether they are input or output is set in the software. 14 of the pins are digital pins, of which 6 can function to give PWM output. 6 of the pins are for analog input/output.2 of the pins are for the crystal oscillator. This is to provide a clock pulse for the Atmega chip. A clock pulse is needed for synchronization so that communication can occur in synchrony between the Atmega chip and a device. The chip needs power so 2 of the pins, VCC and GND, provide it power so that it can operate. The Atmega328 is a low-power chip, so it only needs between 1.8-5.5V of power to operate. The Atmega328 chip has an analog-to-digital converter (ADC) inside of it. This must be or else the Atmega328 wouldn't be capable of interpreting analog signals. Because there is an ADC, the chip can interpret analog input, which is why the chip has 6 pins for analog input. The ADC has 3 pins set aside for it to function- AVCC, AREF, and GND. AVCC is the power supply, positive voltage, that for the ADC. The ADC needs its own power supply in order to work. GND is the power supply ground. AREF is the reference voltage that the ADC uses to convert an analog signal to its corresponding digital value. Analog voltages higher than the reference voltage will be assigned to a digital value of 1, while analog voltages below the reference voltage will be assigned the digital value of 0. Table No.3.5: Pin Description of Atmega328 Pin Number Description Function 1 PC6 Reset 2 PD0 Digital Pin (RX) 3 PD1 Digital Pin (TX) 4 PD2 Digital Pin DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 35 RAILWAY TRACK SECURITY SYSTEM 5 PD3 Digital Pin (PWM) 6 PD4 Digital Pin 7 VCC Positive Voltage (Power) 8 GND Ground 9 XTAL 1 Crystal Oscillator 10 XTAL 2 Crystal Oscillator 11 PD5 Digital Pin (PWM) 12 PD6 Digital Pin (PWM) 13 PD7 Digital Pin 14 PB0 Digital Pin 15 PB1 Digital Pin (PWM) 16 PB2 Digital Pin (PWM) 17 PB3 Digital Pin (PWM) 18 PB4 Digital Pin 19 PB5 Digital Pin 20 AVCC 21 AREF Reference Voltage 22 GND Ground 23 PC0 Analog Input 24 PC1 Analog Input 25 PC2 Analog Input 26 PC3 Analog Input 27 PC4 Analog Input 28 PC5 Analog Input Positive voltage for ADC (power) Since the ADC for the Atmega328 is a 10-bit ADC, meaning it produces a 10-bit digital value, it converts an analog signal to its digital value, with the AREF value being a reference for which digital values are high or low. Thus, a portrait of an analog signal is shown by this digital value; DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 36 RAILWAY TRACK SECURITY SYSTEM thus, it is its digital correspondent value. The last pin is the RESET pin. This allows a program to be rerun and start over. And this sums up the pin out of an Atmega328 chip. 3.4 Outputs 3.4.1 Buzzer Fig.3.13: Buzzer Basically, the sound source of a piezoelectric sound component is a piezoelectric diaphragm. A piezoelectric diaphragm consists of a piezoelectric ceramic plate which has electrodes on both sides and a metal plate (brass or stainless steel, etc.). A piezoelectric ceramic plate is attached to a metal plate with adhesives. Applying D.C. voltage between electrodes of a piezoelectric diaphragm causes mechanical distortion due to the piezoelectric effect. For a misshaped piezoelectric element, the distortion of the piezoelectric element expands in a radial direction. And the piezoelectric diaphragm bends toward the direction. The metal plate bonded to the piezoelectric element does not expand. Conversely, when the piezoelectric element shrinks, the piezoelectric diaphragm bends in the direction Thus, when AC voltage is applied across electrodes, the bending is repeated, producing sound waves in the air. Piezo buzzer is an electronic device commonly used to produce sound. Light weight, simple construction and low price make it usable in various applications like car/truck reversing indicator, computers, call bells etc. Piezo buzzer is based on the inverse principle of piezo electricity discovered in 1880 by Jacques and Pierre Curie. It is the phenomena of generating DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 37 RAILWAY TRACK SECURITY SYSTEM electricity when mechanical pressure is applied to certain materials and the vice versa is also true. Such materials are called piezo electric materials. Piezo electric materials are either naturally available or manmade. Piezoceramic is class of manmade material, which poses piezo electric effect and is widely used to make disc, the heart of piezo buzzer. When subjected to an alternating electric field they stretch or compress, in accordance with the frequency of the signal thereby producing sound. Fig.3.14: Circuit Diagram for Buzzer Certain materials will generate a measurable potential difference when they are made to expand or shrink in a particular direction. Increasing or decreasing the space between the atoms by squeezing, hitting, or bending the crystal can cause the electrons to redistribute themselves and cause electrons to leave the crystal, or create room for electrons to enter the crystal. A physical force on the crystal creates the electromotive force that moves charges around a circuit. The opposite is true as well: Applying an electric field to a piezoelectric crystal leads to the addition or removal of electrons, and this in turn causes the crystal to deform and thereby generate a small physical force. The piezoelectric effect can be employed in the construction of thin-form-factor speakers that are valuable alternatives to traditional electrodynamics speakers in spaceconstrained applications. These devices are referred to as both piezo speakers and ceramic speakers. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 38 RAILWAY TRACK SECURITY SYSTEM Apply an electric field to a piezoelectric material and it will change size. The piezoelectric material will shrink or grow as charges are introduced or removed, but the base material will not. This causes elastic deformation of the material toward or away from a direction that is perpendicular to the surface of the speaker. As soon as the electric field is removed from the piezoelectric material, it will return to its original shape. As the speaker flexes and strikes air molecules, it causes a chain reaction of collisions that eventually reaches your ear. If enough air molecules strike your ear, the nerve cells send a signal to your brain that you interpret as sound. 3.4.2 LCD MODULE To display interactive messages we are using LCD Module. We examine an intelligent LCD display of two lines, 16 characters per line that is interfaced to the controllers. The protocol (handshaking) for the display is as shown. Whereas D0 to D7th bit is the Data lines, RS, RW and EN pins are the control pins and remaining pins are +5V, -5V and GND to provide supply. Where RS is the Register Select, RW is the Read Write and EN is the Enable pin. The display contains two internal byte-wide registers, one for commands (RS=0) and the second for characters to be displayed (RS=1). It also contains a user-programmed RAM area (the character RAM) that can be programmed to generate any desired character that can be formed using a dot matrix. To distinguish between these two data areas, the hex command byte 80 will be used to signify that the display RAM address 00h will be chosen.Port1 is used to furnish the command or data type, and ports 3.2 to 3.4 furnish register select and read/write levels. The display takes varying amounts of time to accomplish the functions as listed. LCD bit 7 is monitored for logic high (busy) to ensure the display is overwritten. Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as for debugging purpose. The most common type of LCD controller is HITACHI 44780 which provides a simple interface between the controller & an LCD. These LCD's are very simple to interface with the controller as well as are cost effective. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 39 RAILWAY TRACK SECURITY SYSTEM Fig.3.15: 2x16 Line Alphanumeric LCD Display The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16 characters), 2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty characters per line). The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data lines depends on the mod1e of operation. If operated in 8-bit mode then 8 data lines + 3 control lines i.e. total 11 lines are required. And if operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7 lines are required. How do we decide which mode to use? It’s simple if you have sufficient data lines you can go for 8 bit mode & if there is a time constrain i.e. display should be faster then we have to use 8-bit mode because basically 4-bit mode takes twice as more time as compared to 8-bit mode. Pin 1 2 3 4 5 Symbol Function Vss Ground Vdd Supply Voltage Vo Contrast Setting RS Register Select R/W Read/Write Select DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 40 RAILWAY TRACK SECURITY SYSTEM 6 7-14 15 16 En DB0-DB7 Chip Enable Signal Data Lines A/Vee Gnd for the backlight K Vcc for backlight When RS is low (0), the data is to be treated as a command. When RS is high (1), the data being sent is considered as text data which should be displayed on the screen. When R/W is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively reading from the LCD. Most of the times there is no need to read from the LCD so this line can directly be connected to Gnd thus saving one controller line. The ENABLE pin is used to latch the data present on the data pins. A HIGH - LOW signal is required to latch the data. The LCD interprets and executes our command at the instant the EN line is brought low. If you never bring EN low, your instruction will never be executed. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 41 RAILWAY TRACK SECURITY SYSTEM COMMANDS USED IN LCD 3.4.3 GSM Definitions : The words, “Mobile Station” (MS) or “Mobile Equipment” (ME) are used for mobile terminals Supporting GSM services. A call from a GSM mobile station to the PSTN is called a “mobile originated call” (MOC) or “Outgoing call”, and a call from a fixed network to a GSM mobile station is called a “mobile Terminated call” (MTC) or “incoming call”. Fig.3.16:GSM Module DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 42 RAILWAY TRACK SECURITY SYSTEM What is GSM ? GSM (Global System for Mobile communications) is an open, digital cellular technology used for transmitting mobile voice and data services. What does GSM offer ? GSM supports voice calls and data transfer speeds of up to 9.6 kbit/s, together with the transmission of SMS (Short Message Service). GSM operates in the 900MHz and 1.8GHz bands in Europe and the 1.9GHz and 850MHz bands in the US. The 850MHz band is also used for GSM and 3G in Australia, Canada and many South American countries. By having harmonised spectrum across most of the globe, GSM’s international roaming capability allows users to access the same services when travelling abroad as at home. This gives consumers seamless and same number connectivity in more than 218 countries. Terrestrial GSM networks now cover more than 80% of the world’s population. GSM satellite roaming has also extended service access to areas where terrestrial coverage is not available. HISTORY In 1980’s the analog cellular telephone systems were growing rapidly all throughout Europe, France and Germany. Each country defined its own protocols and frequencies to work on. For example UK used the Total Access Communication System (TACS), USA used the AMPS technology and Germany used the C-netz technology. None of these systems were interoperable and also they were analog in nature. In 1982 the Conference of European Posts and Telegraphs (CEPT) formed a study group called the GROUPE SPECIAL MOBILE (GSM) The main area this focused on was to get the cellular system working throughout the world, and ISDN compatibility with the ability to incorporate any future enhancements. In 1989 the GSM transferred the work to the European Telecommunications Standards Institute (ETSI.) the ETS defined all the standards used in GSM. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 43 RAILWAY TRACK SECURITY SYSTEM 3.5 Power Supply Fig.3.17: Power Supply Diagram 3.5.1 Step down Transformer A Step down Transformer is a type of transformer, which converts a high voltage at the primary side to a low voltage at the secondary side. If we speak in terms of the coil windings, the primary winding of a Step down Transformer has more turns than the secondary winding. The following image shows a typical step down transformer. A Transformer is a static apparatus, with no moving parts, which transforms electrical power from one circuit to another with changes in voltage and current and no change in frequency. There are two types of transformers classified by their function: Step up Transformer and Step down Transformer. A Step up Transformer is a device which converts the low primary voltage to a high secondary voltage i.e. it steps up the input voltage. A Step down Transformer on the other hand, steps down the input voltage i.e. the secondary voltage is less than the primary voltage. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 44 RAILWAY TRACK SECURITY SYSTEM Principle of Working of a Transformer Fig.3.18: Step down Transformer An electrical transformer works on the principle of Mutual Induction, which states that a uniform change in current in a coil will induce an E.M.F in the other coil which is inductively coupled to the first coil. In its basic form, a transformer consists of two coils with high mutual inductance that are electrically separated but have common magnetic circuit. The following image shows the basic construction of a Transformer. The first set of the coil, which is called as the Primary Coil or Primary Winding, is connected to an alternating voltage source called Primary Voltage. The other coil, which is called as Secondary Coil or Secondary Winding, is connected to the load and the load draws the resulting alternating voltage (stepped up or stepped down voltage). The alternating voltage at the input excites the Primary Winding, an alternating current circulates the winding. The alternating current will result in an alternating magnetic flux, which passes through the iron magnetic core and completes its path. Since the secondary winding is also linked to the alternating magnetic flux, according to Faraday’s Law, an E.M.F is induced in the secondary winding. The strength of the voltage at the secondary winding is dependent on the number of windings through which the flux gets passed through. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 45 RAILWAY TRACK SECURITY SYSTEM Thus, without making an electrical contact, the alternating voltage in the primary winding is transferred to the secondary winding. Note: Depending on the construction of the transformer, the voltage at the secondary of the transformer may be equal, higher or lower than that at the primary of the transformer but the time period of the voltage i.e. its frequency will not change. 3.5.2 Bridge Rectifier Before going to bridge rectifier, we need to know what actually a rectifier is and what the need for a rectifier is. So first let’s take a look at the evolution of rectifiers. Evolution of rectifiers Rectifiers are mainly classified into three types: Half-wave rectifier, Centre tapped fullwave rectifier and Bridge rectifier. All these three rectifiers have a common aim that is to convert Alternating into Direct Current (DC). Not all these three rectifiers efficiently convert the Alternating Current (AC) into Direct Current (DC), only the centre tapped full-wave rectifier and bridge rectifier efficiently convert the Alternating Current (AC) into Direct Current (DC). Half wave rectifier In half wave rectifier, only 1 half cycle is allowed and the remaining half cycle is blocked. As a result, nearly half of the applied power is wasted in half wave rectifier. In addition to this, the output current or voltage produced by half wave rectifier is not a pure DC but a pulsating DC which is not much useful. Fig.3.19: Half Wave Rectifier DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 46 RAILWAY TRACK SECURITY SYSTEM Full wave rectifier The main advantage of centre tapped full wave rectifier is that it allows electric current during both positive and negative half cycles of the input AC signal. As a result, the DC output of the centre tapped full wave rectifier is double of that of a half-wave rectifier. In addition to this, the DC output of centre tapped full wave rectifier contains very fewer ripples. As a result, the DC output of the centre tapped full wave rectifier is smoother than the half wave rectifier. Fig.3.20: Full Wave Rectifier Bridge rectifier A bridge rectifier is a type of full wave rectifier which uses four or more diodes in a bridge circuit configuration to efficiently convert the Alternating Current (AC) into Direct Current (DC). DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 47 RAILWAY TRACK SECURITY SYSTEM Fig.3.21: Bridge Rectifier When input AC signal is applied across the bridge rectifier, during the positive half cycle diodes D1 and D3 are forward biased and allows electric current while the diodes D 2 and D4are reverse biased and blocks electric current. On the other hand, during the negative half cycle diodes D2 and D4 are forward biased and allow electric current while diodes D 1 and D3 are reverse biased and blocks electric current. During the positive half cycle, the terminal A becomes positive while the terminal B becomes negative. This causes the diodes D1 and D3 forward biased and at the same time, it causes the diodes D2 and D4 reverse biased. During the negative half cycle, the terminal B becomes positive while the terminal A becomes negative. This causes the diodes D2 and D4 forward biased and at the same time, it causes the diodes D1 and D3 reverse biased. We can observe that the direction of current flow across load resistor RL is same during the positive half cycle and negative half cycle. Therefore, the polarity of the output DC signal is same for both positive and negative half cycles. The output DC signal polarity may be either completely positive or negative. In our case, it is completely positive. If the direction of diodes is reversed then we get a complete negative DC voltage. Thus, a bridge rectifier allows electric current during both positive and negative half cycles of the input AC signal. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 48 RAILWAY TRACK SECURITY SYSTEM 3.5.3 Filter Filter is a filter circuit in which the first element is a capacitor connected in parallel with the output of the rectifier in a linear power supply. The capacitor increases the DC voltage and decreases the ripple voltage components of the output. The capacitor is often referred to as a smoothing capacitor or reservoir capacitor. The capacitor is often followed by other alternating series and parallel filter elements to further reduce ripple voltage, or adjust DC output voltage. It may also be followed by a voltage regulator which virtually eliminates any remaining ripple voltage, and adjusts the DC voltage output very precisely to match the DC voltage required by the circuit. Operation During the time the rectifier is conducting and the potential is higher than the charge across the capacitor, the capacitor will store energy from the transformer; when the output of the rectifier falls below the charge on the capacitor, the capacitor will discharge energy into the circuit. Since the rectifier conducts current only in the forward direction, any energy discharged by the capacitor will flow into the load. These results in output of a DC voltage upon which is superimposed a waveform referred to as the a sawtooth wave. The sawtooth wave is to the convenient linear approximation to the actual waveform, which is exponential for both charge and discharge. The crests of the sawtooth waves will be more rounded when the DC resistance of the transformer secondary is higher. 3.5.4 Voltage regulator The voltage regulator is simply an electronic or electrical device which can sustain the voltage of a power supply within suitable limits. The electrical equipments connected to the voltage source should bear the value of the voltage. So, the source voltage should be in a certain range which is acceptable for the connected equipments. This purpose is fulfilled by implementing a voltage regulator. It regulates the voltage regardless of the alteration in the input voltage or connected load. It works as a shield for protective devices from damage. It can regulate AC and DC voltages depending on the design. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 49 RAILWAY TRACK SECURITY SYSTEM Voltage sources in a circuit may have fluctuations resulting in not providing fixed voltage outputs. A voltage regulator IC maintains the output voltage at a constant value. 7805 IC, a member of 78xx series of fixed linear voltage regulators used to maintain such fluctuations, is a popular voltage regulator integrated circuit (IC). The xx in 78xx indicates the output voltage it provides. 7805 IC provides +5 volts regulated power supply with provisions to add a heat sink. In this tutorial, we will see about one of the most commonly used regulator IC’s, the 7805 Voltage Regulator IC. A regulated power supply is very much essential for several electronic devices due to the semiconductor material employed in them have a fixed rate of current as well as voltage. The device may get damaged if there is any deviation from the fixed rate. One of the important sources of DC Supply are Batteries. But using batteries in sensitive electronic circuits is not a good idea as batteries eventually drain out and lose their potential over time. Also, the voltage provided by batteries is typically 1.2V, 3.7V, 9V and 12V. This is good for circuits whose voltage requirements are in that range. But, most of the TTL IC’s work on 5V logic and hence we need a mechanism to provide a consistent 5V Supply. Here comes the 7805 Voltage Regulator IC to the rescue. It is an IC in the 78XX family of linear voltage regulators that produce a regulated 5V as output. Fig.3.22: 7805 Voltage Regulator DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 50 RAILWAY TRACK SECURITY SYSTEM Table No.3.6: Pin Details of 7805 IC Pin Function Description In this pin of the IC positive INPUT Input voltage (7V-35V) unregulated voltage is given in regulation. In this pin where the ground GROUND Ground (0V) is given. This pin is neutral for equally the input and output. The output of the regulated OUTPUT Regulated output 5V (4.8V-5.2V) 5V volt is taken out at this pin of the IC regulator. 3.6 Software and Hardware Tools ARDUINO 1.8.0 LED LDR ARDUINO IDE Buzzer 3.7 Working principle We aim to create a new LDR-LED based simple technique to detect cracks in rails that will be cheap enough, so that it can be put to mass usage. The automatic crack detection system is constructed using sensors; our scheme consists of a railway line for looking cracks during night. When local railways don’t operate. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 51 RAILWAY TRACK SECURITY SYSTEM This crack detection system consists of a LED and LDR assembly that functions as the rail crack detector. In our project design, the LED and LDR sensors are placed at both sides of vehicles. If there are no cracks, the LED light does not fall on the LDR and hence the LDR resistance is high. If there are no crack s on the track the LED light falls on the LDR, the resistance of the LDR gets reduced. This is detected by a microcontroller and the data will be displayed on LCD then turns on buzzer. 3.8 Flow Chart Start Read Sensor Detecting Cracks on the Tracks If Crack Present on Track LED Light not Falls on the LDR LED Light Falls on LDR Buzzer ON Stop DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 52 RAILWAY TRACK SECURITY SYSTEM CHAPTER-4 SOFTWARE USAGE 4.1 ARDUINO IDE The Arduino integrated development environment (IDE) then it is the a crossplatform application (for Windows, macOS, Linux) that is written in the programming language Java. It is used to write and upload programs to Arduino board. The source code for the IDE is released under the GNU General Public License, version 2. The Arduino IDE supports the languages C and C++ using special rules of code structuring. The Arduino IDE supplies the a software library from the Wiring project, which provides many common input and output procedures. User-written code only requires two basic functions, for starting the sketch and the main program loop, that are compiled and linked with a program stub main( ) into an executable cyclic executive program with the GNU tool chain, also included with the IDE distribution. Fig.4.1: Arduino 1.8.0 window DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 53 RAILWAY TRACK SECURITY SYSTEM The Arduino IDE employs the program argued to convert the executable code into a text file in hexadecimal encoding that is loaded into the Arduino board by a loader program in the board's firmware. This is the Arduino IDE once it’s been opened. It opens into a blank sketch where you can start programming immediately. First, we should configure the board and port settings to allow us to upload code. Connect your Arduino board to the PC via the USB cable. If you downloaded the Arduino IDE before plugging in your Arduino board, when you plugged in the board, the USB drivers should have installed automatically. The most recent Arduino IDE should recognize connected boards and label them with which COM port they are using. Select the Tools pull down menu and then Port.Here it should list all open COM ports, and if there is a recognized Arduino Board, it will also give its name. Select the Arduino board that you have connected to the PC. If the setup was successful, in the bottom right of the Arduino IDE, you should see the board type and COM number of the board you plan to program. Note: The Arduino Uno occupies the next available COM port; it will not always be COM3. Fig.4.2: Arduino 1.8.0 Uploading Blink window DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 54 RAILWAY TRACK SECURITY SYSTEM One common procedure to test whether the board you are using is properly set up is to upload the “Blink” sketch. This sketch is included with all Arduino IDE releases and can be accessed by the Filepull-down menu and going to Examples, 01.Basics, and then select Blink. Standard Arduino Boards include a surface-mounted LED labeled “L” or “LED” next to the “RX” and “TX” LEDs that is connected to digital pin 13. This sketch will blink the LED at a regular interval, and is an easy way to confirm if your board is set up properly and you were successful in uploading code. Open the “Blink” sketch and press the “Upload” button in the upper-left corner to upload “Blink” to the board. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 55 RAILWAY TRACK SECURITY SYSTEM CHAPTER-5 RESULT ANALYSIS During operation when there are no cracks then the LED light does not falls on the LDR and hence the LDR resistance is high. When the LED light falls on the LDR automatically the resistance of LDR will be automatically decreased then crack is detected then buzzer will be on and it will be displayed on LCD. Fig.5.1: Output picture of railway track fault detection system DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 56 RAILWAY TRACK SECURITY SYSTEM FUTURE SCOPE Here if the crack is dete1cted, then the system is automatically stop, in case of landmine is detect the system gives buzzer. But we are not sending any crack and mine location and image anywhere. By using various sensor network techniques we may also develop more and more reliable security systems applications in which continuously monitors the railway track through the sensors and detect any abnormality in the track. We may also send the latitude and longitude values of crack on the track to the mobile number by using GPS (Global Positioning System). DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 57 RAILWAY TRACK SECURITY SYSTEM CONCLUSION Here, we have presented the rationale, design of our LED-LDR based railway crack detection scheme. The authors hope that their idea can be implemented in large scale in the long run to facilitate better safety standards for rail tracks and provide effective testing infrastructure for achieving better results in the future. ning System) and GSM (Global system For Mobile) technology. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 58 RAILWAY TRACK SECURITY SYSTEM REFERENCES 1. K. Vijayakumar, S.R. Wylie, J. D. Cullen, C.C. Wright, A.I. AI- Shamma’a, “Non invasive rail track detection system using Microwave sensor”, Journal of App. Phy., 2009. 2. Qiao Jian-hua; Li Lin-sheng; Zhang Jing-gang; “Design of Rail Surface Crackdetecting System Based on Linear CCD Sensor”, IEEE Int. Conf. on Networking, Sensing and Control, 2008. 3. Richard J. Greene, John R. Yates and Eann A. Patterson, "Crack detection in rail using infrared methods", Opt. Eng. 46, 051013, May 2007. 4. Tranverse crack detection in rail head using low frequency eddy currents, Patent US6768298, www.google.com/patents/US6768298. DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 59 RAILWAY TRACK SECURITY SYSTEM APPENDIX-A SOFTWARE CODING #include <LiquidCrystal.h> #include<SoftwareSerial.h> SoftwareSerial mySerial(2,3); // rx,tx const int buzzer = 13; const int IR_SENSOR1 = 8; const int IR_SENSOR2 = 9; LiquidCrystal lcd(14, 15, 16, 17, 18, 19); int buttonState1 = 0; int buttonState2 = 0; char str1[70]; char *test="$GPGGA"; char logitude[10]; char latitude[10]; int ii,jj,kk; int temp1; void setup() { // lcd.begin(16,2); pinMode(IR_SENSOR1, INPUT); pinMode(IR_SENSOR2, INPUT); Serial.begin(9600); mySerial.begin(19200); pinMode(12, OUTPUT); pinMode(11, OUTPUT); pinMode(buzzer, OUTPUT); digitalWrite(buzzer,LOW); DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 60 RAILWAY TRACK SECURITY SYSTEM lcd.begin(16,2); lcd.clear(); lcd.setCursor(0, 0); lcd.println("LDR LED RAILWAY "); lcd.setCursor(0, 1); lcd.println("TRACK FAULT DTCN"); delay(2000); gps(); delay(1000); } void loop() { buttonState2 = digitalRead(IR_SENSOR1); buttonState1 = digitalRead(IR_SENSOR2); if (buttonState1 == LOW && buttonState2 == HIGH ) { digitalWrite(buzzer,HIGH); delay(1000); lcd.clear(); lcd.setCursor(0,0); lcd.println("LEFT TRACK FLT ..."); delay(2000); digitalWrite(buzzer,LOW); gps(); delay(1000); SendMessage(); delay(1000); // delay(2000); } else if (buttonState1 == HIGH && buttonState2 == LOW) DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 61 RAILWAY TRACK SECURITY SYSTEM { digitalWrite(buzzer,HIGH); delay(1000); lcd.clear(); lcd.setCursor(0,0); lcd.println("RIGHT TRACK FLT ..."); delay(2000); digitalWrite(buzzer,LOW); gps(); delay(1000); SendMessage(); delay(1000); // delay(2000); } else if (buttonState1 == LOW && buttonState2 == LOW) { digitalWrite(buzzer,HIGH); delay(1000); lcd.clear(); lcd.setCursor(0,0); lcd.println("BOTH TRACK FLT ..."); delay(2000); digitalWrite(buzzer,LOW); gps(); delay(1000); SendMessage(); delay(1000); // delay(2000); } else DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 62 RAILWAY TRACK SECURITY SYSTEM { digitalWrite(buzzer,LOW); lcd.clear(); lcd.setCursor(0,0); lcd.println("NORMAL...."); delay(10); } } void gps() { while (Serial.available()>0) //Serial incomming data from GPS { char inChar2 = (char)Serial.read(); str1[ii]= inChar2; //store incomming data from GPS to temparary string str[] ii++; if (ii < 7) { if(str1[ii-1] != test[ii-1]) //check for right string { ii=0; } } if(ii >=60) { temp1=1; } } DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 63 RAILWAY TRACK SECURITY SYSTEM if (temp1==1) { for(ii=18;ii<27;ii++) //18 27 //extract latitude from string { latitude[jj]=str1[ii]; jj++; } for(ii=31;ii<40;ii++) //extract longitude from string { logitude[kk]=str1[ii]; kk++; } lcd.clear(); lcd.setCursor(0,0); //display latitude and longitude on 16X2 lcd display lcd.print("Lat:"); lcd.print(latitude); lcd.setCursor(0,1); lcd.print("Lon:"); lcd.print(logitude); delay(100); temp1=0; ii=0; jj=0; kk=0; delay(2000); // next reading within 20 seconds } } void SendMessage() { lcd.clear(); DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 64 RAILWAY TRACK SECURITY SYSTEM Serial.println("SENDING A MESSAGE ....please wait......\n"); lcd.print("Sending a Msg..."); mySerial.println("AT+CMGF=1"); //Sets the GSM Module in TextMODE delay(1000); // Delay of 1000 milli seconds or 1 second mySerial.println("AT+CMGS=\"+919908184226\"\r"); delay(1000); // mySerial.println(" CURRENT LOCATION:");// The SMS textyou want to send // delay(200); // mySerial.print("Lat:"); // delay(1000); mySerial.println(latitude); delay(1000); mySerial.print(" N "); delay(1000); // mySerial.print("Lon:"); // delay(1000); mySerial.println(logitude); delay(1000); mySerial.print(" E"); delay(1000); mySerial.print((char)26);// ASCII code of CTRL+Z delay(5000); delay(200); Serial.println("MESSAGE SENT .........."); lcd.clear(); lcd.print("Message Sent."); delay(200); } DEPT. OF E.C.E.,SSN ENGINEERING COLLEGE,ONGOLE Page 65