You are on page 1of 24

i

AUTOMATIC RAILWAY GATE CONTROL BY USING MICROCONTROLLER

AHMAD HAFIZI BIN MOHAMAD

This report is submitted in partial fulfillment of the requirements for the award of Bachelor of Electronics Engineering (Industrial Electronics) with Honours

Faculty of Electronics Engineering and Computer Engineering Universiti Teknikal Malaysia Melaka

May 2011

ii

UNIVERSTI TEKNIKAL MALAYSIA MELAKA


FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
BORANG PENGESAHAN STATUS LAPORAN

PROJEK SARJANA MUDA II

Tajuk Projek Sesi Pengajian

: :

Automatic Railway Gate Control By Using Microcontroller 1 0 / 1 1

Saya AHMAD HAFIZI BIN MOHAMAD mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut: 1. 2. 3. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi pengajian tinggi. 4. Sila tandakan ( ) :

SULIT*

*(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972) **(Mengandungi maklumat terhad yang telah ditentukan oleh organisasi/badan di mana penyelidikan dijalankan)

TERHAD**

TIDAK TERHAD

Disahkan oleh:

__________________________ (TANDATANGAN PENULIS)

___________________________________ (COP DAN TANDATANGAN PENYELIA)

Tarikh: ..

Tarikh: ..

iii

I hereby declare that this report is the results of my own work except for quotes as cited in the reference.

Signature

Author

: AHMAD HAFIZI BIN MOHAMAD : 3rd MAY 2011

Date

iv

I hereby declare that I have read this report and in my opinion this report is sufficient in terms of the scope and quality for the award of Bachelor of Electronic Engineering (Industrial Electronics) With Honors

Signature

Supervisors name

: MISS MUZALIFAH BINTI MOHD SAID : 3rd MAY 2011

Date

Dedicated to my parents, my siblings, and all my beloved person.

vi

ACKNOWLEDGEMENT

First of all, I would like to thank God for his blessing, and I also want to express my deepest gratitude to my supervisor Miss Muzalifah Bt. Mohd Said for support and guidance throughout this project running and completion of this report.

My deepest appreciation also goes out to Mrs. Sharatul Izah Bt. Samsudin who gave me many needed support, encouragement and help throughout my projects improvement in PSM I, and my friends who struggling with me exploring this scope. Not to forget, thanks to my family and fellow friends who encouraged me.

Finally, thank you to all those involved directly and indirectly helping me out during my PSM I & PSM II which I cant state out every one of them. A special expression of gratitude is extended to everyone for their tolerance and patience in doing the project. I must admit that they had enriched me in many ways and words alone are not enough to express my gratitude.

vii

ABSTRACT

The purpose of this project is to develop an automatic railway gate system that uses the microcontroller as a main function of design. The principle objective of this project was to design an automatic railway gate control by microcontroller. This project deals to develop a prototype of railway gate that function automatically by using microcontroller. Besides that, the interfacing program also had been developed for the integration part. The operation using microcontroller (PIC16F877A) that integrated with other circuits involved such as power supply, IR sensor, light and buzzer, gate motor and LCD display. All the circuits will be combining to demonstrate the operation of microcontroller (PIC16F877A). This system will make improvement towards the manually operation before this. Human supervision will be considered if there are problems occurred while this system was operated.

viii

ABSTRAK

Tujuan projek ini adalah untuk membina sebuah sistem pengendalian pagar lintasan keretapi secara automatik yang menggunakan mikropengawal sebagai asas binaan di dalam rekaannya. Prinsip tujuan projek ini adalah untuk membina sistem pengendalian pagar lintasan kereta api secara automatik dengan menggunakan mikropengawal. Ia termasuk untuk membangunkan sebuah prototaip sistem pagar lintasan kereta api yang berfungsi secara automatic. Selain itu, sebuah program juga dibentuk bagi menggabungkan bahagian-bahagian tertentu di dalam sistem ini. Operasi mikropengawal (PIC16F877A) juga melibatkan litar-litar lain seperti litar bekalan kuasa, infrared, lampu dan buzzer, motor dan paparan LCD. Kesemua litar-litar ini digabungkan bagi menunjukkan bagaimana mikropengawal (PIC16F877A) beroperasi. Sistem ini berfungsi bagi menambah baikkan sistem yang sedia ada sekarang yang masih menggunakan sistem manual. Khidmat pekerja hanya diperlukan apabila situasi berdepan masalah seperti sistem gagal beroperasi.

ix

CONTENTS

CHAPTER

TITLE PROJECT TITLE REPORT STATUS VERIFICATION FORM STUDENTS DECLARATION SUPERVISORS DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK CONTENTS LIST OF TABLES LIST OF FIGURES LIST OF APPENDICES

PAGE i ii iii iv v vi vii viii ix xii xiii xvi

INTRODUCTION 1.1 1.2 1.3 1.4 1.5 1.6 Project Introduction Project Objectives Problem Statement Scope of Works Methodology Report Structure

1 1 2 2 3 4 5

II

LITERATURE REVIEW 2.1 2.2 Previous System Block Diagram Description 2.2.1 Gate Control Unit 2.2.2 Announcement Unit 2.3 Microcontroller 2.3.1 PIC16F877A 2.4 2.5 Programming Language Infrared Sensor 2.5.1 IR Transmitter 2.5.2 IR Receiver 2.6 2.7 Motor Theory H-Bridge 2.7.1 L293D 2.8 2.9 LCD Proteus VSM

6 6 7 9 10 10 11 13 14 14 15 16 17 18 19 20 23

2.10 PIC C Compiler

III

METHODOLOGY 3.1 3.2 3.3 Project Methodology Project Flow Chart System Flow 3.3.1 Process Procedure 3.4 Hardware Assembly

26 26 28 29 30 31

xi

IV

RESULTS AND DISCUSSION 4.1 4.2 System Explanation The Designed Circuits 4.2.1 Sensor Circuit 4.2.2 Buzzer Circuit 4.2.3 Lighting Alarm Circuit 4.2.4 Voltage Regulator Circuit 4.2.5 LCD Circuit 4.2.6 Motor Circuit 4.2.7 PIC16F877A Integration Circuit 4.3 The Simulation Result 4.3.1 Voltage Supply 4.3.2 PIC16F877A Interfacing Result 4.4 4.5 The Programming Result Hardware Description 4.5.1 The Constructed Circuits 4.5.2 The Prototype

33 33 36 36 38 39 40 41 44 46 47 47 48 50 53 53 57

IV

CONCLUSION AND RECOMMENDATION 5.1 5.2 Conclusion Recommendation

59 59 60

REFERENCES

61

xii

LIST OF TABLES

NO. 4.2.5

TITLE

PAGE 43

The pin structure of LCD module

xiii

LIST OF FIGURES

NO.

TITLES

PAGE 7 8 9 12 12 14 14 15 16 16 17 17 18 19 19 20 21 21 22 22

2.2.1 2.2.2

Block diagram of the system The functionality between microcontrollers

2.2.1.1 The diagram of gate control unit 2.3.1.1 PIC16F877A pins/terminals 2.3.1.2 PIC16F877A chip 2.5.1 2.5.1.1 2.6.1 2.6.2 2.6.3 2.7.1 Infrared sensor IR transmitter circuit using 555 IC timer

2.5.2.1 IR receiver circuit using 555 IC timer Stepper motor Servo motor DC motor The diagram of basic H-bridge

2.7.1.1 The interfacing diagram 2.7.1.2 L293D IC chip 2.8 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 LCD Proteus VSM ISIS 7 Professional user interface ARES 7 Professional user interface Components selection Parameter settings

xiv

2.9.6 2.10.1 2.10.2 2.10.3 2.10.4 2.10.5 3.2 3.3 3.4.1 4.1.1 4.2.1.1 4.2.1.3

Simulation buttons CCS C Compiler PIC C Compiler user interface Create new file/project Example program Compile summary Project flow chart System flow chart

23 23 24 24 25 25 28 29 30 31 33 36 37 37 38 39 40 41 44 46 47 48 49 52 53 53 54 55

3.3.1.1 The flow of the process in the system The diagram of hardware assembly done The system diagram with fully explanation The designed IR sensor circuit

4.2.1.2 Example of IR module with pins/terminals The diagram of suggested arrangement IR module 4.2.2.1 The designed buzzer circuit 4.2.3.1 The designed lighting alarm circuit 4.2.4.1 4.2.5.1 4.2.6.1 4.2.7.1 4.3.2.1 4.3.2.2 4.4.1 4.5.1.1 4.5.1.2 The designed voltage regulator circuit The designed LCD circuit interface with PIC16F877A circuit The designed motor circuit interface with PIC16F877A circuit The designed overall PIC16F877A interfacing circuit

4.3.1.1 The simulation result give value of 5V The result after PIC16F877A being triggered The result after PIC16F877A triggered to back normal condition The programming result The sensor circuit The sensor circuit on PCB

4.5.1.3 The main circuit 4.5.1.4 LCD show the notification of closing the gate

xv

4.5.1.5 The gate motor used 4.5.1.6 The sensor located at side of the railway track 4.5.2.1 The prototype of model railway gate system 4.5.2.2 The prototype of model railway gate system

55 56 57 58

xvi

LIST OF APPENDICES

NO. A B Gantt Chart

TITLES Microchip PIC16F87XA Data Sheet

PAGE 63 65

CHAPTER I

INTRODUCTION

1.1

Project Introduction In general, this project utilizes the importance of microcontroller as a main

design. It used to provide improvement into manual system that exist nowadays.

Microcontroller is a small unit of controller that acted following the instruction programmed. All the circuits included in this prototype were designed following the suitability of PIC16F877A.

This automatic railway gate system was operated after signal received from the IR sensor. This signal used to trigger the PIC16F877A for operating the gate motor and alarm indicators by instruction programmed.

Electronic applications used to enable this system operated in automatic mode. The computer usage must be fully utilized to building up a system that encourage implementing of the technology.

2 1.2 Project Objectives The microcontroller (PIC16F877A) is use to demonstrate the integration of computer method in railway gate operation.The objectives of this project are:

i.

To develop a prototype of railway gate that function automatically by using microcontroller.

ii.

To develop an interfacing program for the integration part of microcontroller operation.

iii.

To design an automatic railway gate control by using microcontroller.

Furthermore, this project is aimed to replace the gatekeepers with an automatic system. It is develop to apply the structure of interfacing program in between to give a lot of advantages.

1.3

Problem Statement Nowadays, the railway gate is operating by manual operation. It is operating in

the area that there are railway line junction with the road. The railway gate management has to employ workers to be on duty for control the operation. Due to this, the worker will manually open and close the gate with under supervision.

This prototype will introduce the automatic railway gate operation. This system will make improvement towards the manually operation before this. Human supervision will be considered if there are problems occurred while this system was operated.

This is an idea to perform computer integration with mechanical structure to simulate what the system can do. Control system with computer applications will make the management or consumer become more effective. Therefore, this is the best example in develop railway gate management system become more efficient.

3 1.4 Scope of Works This project covered the operation of automatic railway gate control by using microcontroller (PIC16F877A). The circuits involved such as power supply, IR sensor, light and buzzer, gate motor and LCD display.

All of these operations will be combining to demonstrate the operation of microcontroller (PIC16F877A).

The operations of microcontroller works follow the instruction programmed. The combining circuits were constructed on Proteus software to seen whether that circuits was right or not. After that, the hardware part was constructed after all the simulation being done.

IR sensor circuit is providing signal to triggered the PIC16F877A. The sensed signal wills active the gate motor and LCD display. Alarm and indication light circuit was provided as additional part of this system.

Additional elements can be added without affecting the remaining elements. This allows the flexibility of the developed system.

4 1.5 Methodology This project began with the research of the proposed title. The result of that research is then discussed with the supervisor. Once the title of project was approved, the background of study for this project was explored.

PIC16F877A was chosen as a microcontroller. Then, the circuits simulation was performed. In the other hand, the instruction programmed also being built for the interfacing part. After all being settled, the construction of hardware part was started after the components were being chosen. In all the steps done there are troubleshooting part to resolve the problems facing. Between hardware part and instruction programmed built, there are integrated step that allows the PIC16F877A to simulate all the operations of the system.

After all the part is complete to built, some analysis should being made to show what the solution of the problems occurred. It involving the comparison between the research that had been done before this.

5 1.6 Report Structure Chapter 1 introduced the project as a whole. The early and basic explanations were mentioned in this chapter. This chapter consisted of the project introduction and objectives, problem statements, scope of work, and the simplified methodology.

Chapter 2 is literature review. Past projects system were taken into consideration when completing this chapter. The ways those projects and researches had been done were compared with what this project. These comparisons were done to understand what this project is all about and where it stands.

Chapter 3 is methodology. It explained how this project came to be. This chapter explained the part most important of all, the flow this project. What had been researched and what needed to be done was explained in this chapter.

Chapter 4 concentrated on the result and discussion of this project. What had been done was explained in diagrams and written programs. The expected results also mentioned in this chapter.

Chapter 5 was the final chapter in this report. The conclusions and recommendations were placed in this chapter. In other words, the conclusion was the summary of what had been done throughout this project. After the project was done, recommendations were made and any expansions or upgrades that might be done in the future were suggested.

CHAPTER II

LITERATURE REVIEW

2.1

Previous System At present scenario, in the level crossing line the railway gate is operated

normally by a gate keeper. This happen when the railway line is cross over the road and there are a gate that have to be controlled. The gate keeper work after receiving the information about the train arrival from the nearer station. When the train starts to leave the station, the particular station delivers the information to give the signal for gate keeper to get ready. This is the operation are followed for operating the railway gates.

In addition, this automatic railway gate system can contribute a lot of benefit either to the road user or to the railway management. This type of gate can be implementing in the level crossing where the chances of accidents are higher. The computer integration will be use to provide addition in the latest technology.

7 2.2 Block Diagram Description

Figure 2.2.1: Block diagram of the system

This prototype of project demonstrated the Automatic Railway Gate Control by Using Microcontroller (PIC16F877A). The sensors are fixed at the certain distance on both sides of the gate, that is before the train arrive and after the train departure. The sensed signal is send to the microcontroller (PIC16F877A) and checked whether there are vehicles or people between the gate. At the same time, alarm and indication light signal are provided to the road users to warn the closing of gates.

In sequences, the gate motor will move forward direction to close the gate. It will stay closed at certain time until the train has crossed the gate and reached the second sensor activate the motor in backward direction so the gate will open.

8 Lighting signal also provided at the certain distance as pre cautionary step for driver. Meanwhile, the nearer station also will provide an indication alarm to remind them about the crossing train. If anything happened at the gates, this alarm will alert the station. LCD display will show the arrival of the train to cross the gate as additional features of this system.

Sensor

LCD PIC16F877A Microcontroller

Motor

Buzzer

Lighting Alarm

Figure 2.2.2: The functionality between microcontrollers

You might also like