the development of adaptive lighting system...
TRANSCRIPT
i
THE DEVELOPMENT OF ADAPTIVE LIGHTING SYSTEM FOR
MOTORCYCLES
ASYRAF BIN AMIR
This Report Is Submitted In Partial Fulfillment of Requirements For The Bachelor
Degree of Electronic Engineering (Telecommunication Electronic)
Faculty of Electronic 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 : THE DEVELOPMENT OF ADAPTIVE LIGHTING SYSTEM
FOR MOTORCYCLES
Sesi
Pengajian : 1 0 / 1 1
Saya __________________________ASYRAF BIN AMIR_____________________________
(HURUF BESAR)
mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-
syarat kegunaan seperti berikut:
1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.
2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.
3. 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)
TERHAD**
**(Mengandungi maklumat terhad yang telah ditentukan oleh
organisasi/badan di mana penyelidikan dijalankan)
TIDAK TERHAD
Disahkan oleh:
_____________________________________ ___________________________________
(TANDATANGAN PENULIS) (COP DAN TANDATANGAN PENYELIA)
Tarikh: ………………………..
Tarikh: ………………………..
*CATATAN : Jika laporan ini SULIT atau TERHAD, sila lampirkan surat daripada pihak berkuasa/organisasi berkenaan dengan menyatakan sekali tempoh laporan ini perlu dikelaskan sebagai SULIT atau TERHAD.
iii
“I hereby declare that this report is result of my own effort except for quotes as cited
in the references.”
Signature : ……………………………….
Name : ASYRAF BIN AMIR
Date : 03 MAY 2011
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 (Telecommunication Electronic).”
Signature : ……………………………………….
Supervisor’s Name : ENGR. ZARINA BINTI MOHD NOH
Date : 03 MAY 2011
v
To my dearest parent
vi
ACKNOWLEDGEMENT
In the name of Allah S.W.T, The Most Beneficial and The Most Merciful. It
is with deepest serve gratitude of the Al-Mighty that gives me strength and ability to
complete this final year project report.
First of all, I would like to take this opportunity to express my special thanks
to my supervisor, Engr. Zarina Binti Mohd Noh for the guidance, assistance, advise,
kindness and also being helpful to guide me all the way through the development
and progress of my final year project. Above all and the most needed, she provided
me unflinching encouragement and support in various ways.
My appreciation also goes to my friends for their advice, supervision, and
crucial contribution, and cooperation during the completion of my final year project.
Thank you for lending hands during progress of this project.
Finally, I also would like to express my exceptional thanks to my beloved
parents for their support and unending prayers and helps me directly or indirectly in
successful finishing of my final year project.
vii
ABSTRACT
This automatic lighting system for motorcycles needs no manual operation
for switching ON and OFF to flash the high beam or low beam. It will detect light
from vehicles that coming from front and automatically switch the light depend on
the situation. When there is light from front coming vehicle, it automatically
switches to the low beam and when the vehicle passes, it automatically switches
back to high beam. This system integrated with PIC (Programmable Integrated
Circuit) with LCD to display the status of the system.
viii
ABSTRAK
Sistem pencahayaan automatik untuk motorsikal ini tidak memerlukan
penunggang motorsikal menukar lampu tinggi atau rendah secara sendiri. Sistem ini
akan mengesan cahaya dari kenderaan yang datang dari arah bertentangan dan
secara automatiknya akan menukar lampu sama ada tinggi atau rendah bergantung
kepada situasi. Jika ada cahaya dari kenderaan yang datang dari hadapan, sistem ini
secara automatik akan menukar kepada lampu rendah dan apabila kenderaan
tersebut sudah melepasinya, ia akan menukar kepada lampu tinggi secara
automatik. Sistem ini telah digabungkan dengan Litar Bersepadu (PIC) dan Paparan
hablur cecair (LCD) untuk memaparkan status dalam sistem ini.
ix
TABLE OF CONTENTS
CHAPTER TITLE PAGE
PROJECT TITLE i
APPROVAL REPORT STATUS ii
DECLARATION SHEET iii
SUPERVISOR APPROVAL AND DECLARATION iv
ACKNOWLEDGEMENT vi
ABSTRACT vii
ABSTRAK viii
TABLE OF CONTENTS ix
LIST OF FIGURES xii
LIST OF TABLES xiv
LIST OF APPENDICES xv
I INTRODUCTION
1.1 Background 1
1.2 Problem Statement 2
1.3 Objectives of Project 2
1.4 Scope of Project 3
1.5 Thesis Outline 3
II LITERATURE REVIEW
2.1 Introduction 4
2.2 Fundamental of Automatic Lighting System 4
x
2.3 Automatic Lighting System 5
2.3.1 Light Dimming 7
2.3.2 Auto High/Low Beam System 8
2.4 Light Sensor (LDR) 9
2.4.1 Automatic High/Low Beam Control Using 10
Light Sensor
2.5 Ultrasonic Sensor 12
2.5.1 Automatic High/Low Beam Control Using 12
Distance Sensor
2.6 Microcontroller 14
2.6.1 Variation of Microcontroller 15
2.6.2 PIC Microcontroller 16
2.6.3 Choosing PIC Device 16
2.6.4 Development Languages 17
2.6.4.1 Assembly Language (ASM) 17
2.6.4.2 BASIC 18
2.6.4.3 C Language 18
2.6.5 Programmer 18
2.6.6 Workflow 19
2.6.7 Introduction to PIC 16F877A 20
2.6.7.1 Specification for PIC 16F877A 20
2.6.7.2 Pin Diagram 21
2.6.7.3 I/O Ports 21
2.7 PIC C Compiler 23
2.8 PROTEUS VSM 24
2.9 LCD Display 26
2.9.1 LCD Connection 26
III METHODOLOGY
3.1 Introduction 28
3.2 Flowchart 28
3.2.1 Literature Review, Lecture and Laboratory 29
xi
Session
3.2.2 Software Development 30
3.2.3 Hardware Development 31
3.2.4 Build Prototype 33
3.2.5 Troubleshooting/Testing 34
3.2.6 Preparation of Thesis Writing 34
IV RESULT AND DISCUSSION
4.1 Introduction 36
4.2 Simulation 36
4.2.1 Program Codes 37
4.2.1.1 Download the Programming to PIC 38
4.2.2 Microcontroller 40
4.3 Simulation Result 41
4.4 Hardware Implementation 42
4.4.1 Light Sensor Circuit 42
4.4.2 Regulated Power Supply Circuit 44
4.4.3 PIC Microcontroller and LCD Circuit 44
4.4.4 Combined Hardware Circuit 45
4.5 Practical Result 47
4.6 Discussion 49
V CONCLUSION AND SUGGESTION
5.1 Introduction 51
5.2 Conclusion 51
5.3 Suggestion and Future Work 53
REFERENCES 54
xii
LIST OF FIGURES
FIGURE TITLE PAGE
2.1 General wiring diagram of motorcycles 5
2.2 Stages of Advanced Headlamp System 6
2.3 Stage 1 - Obstacle over 50 meters ahead 6
2.4 Stage 2 - Obstacle within 5-50 meters 6
2.5 Stage 3 - Obstacle with 5 meters 7
2.6 Automatic Hi/Low Beam System with speed control 8
2.7 Light Dependent Resistor 9
2.8 Basic circuit of LDR 10
2.9 Headlamp Dimming Control System 11
2.10 State flow of Headlamp Dimming Control System 11
2.11 Waveform of Headlamp Dimming Control System 11
2.12 Approximate frequency range corresponding to 12
ultrasound, with rough guide of some application
2.13 Automatic Hi/Low Beam System 13
2.14 State flow of Automatic Hi/Low Beam System 14
2.15 Waveform of Hi/Low Beam System 14
2.16 Block Diagram for Microcontroller 15
2.17 Workflow Diagram for complete operation of PIC 19
2.18 Pin Diagram for PIC 16F877A 21
2.19 The CCS C Compiler 23
2.20 The 16x2 LCD Display 26
2.21 LCD connection 27
3.1 Overall Project Flow chart 29
xiii
3.2 Literature Review Session for This Project 30
3.3 Software Flow Chart 31
3.4 Block Diagram for Hardware Development 32
3.5 Hardware Development Flow Chart 32
3.6 Combined Software and Hardware Flow Chart 33
3.7 Project Grantt chart 35
4.1 Blog diagram for overall project 37
4.2 Simulation Programming Code 38
4.3 Hardware to Download the Programming to PIC Microcontroller 39
4.4 The programmer reading the PIC 39
4.5 The Programming coding was successfully download 40
4.6 PIC Microcontroller Circuit Schematic 40
4.7 Simulation integrated circuit using Proteus (Switch OFF) 41
4.8 Simulation integrated circuit using Proteus (Switch ON) 42
4.9 Basic Circuit for Light Sensor 43
4.10 Basic circuit for Regulated Power Supply 44
4.11 Circuit for PIC16F877 and LCD Display 45
4.12 Bottom Layout of Combined Circuit 46
4.13 Upper Layout of Combined Circuit 46
4.14 The prototype of this project 47
4.15 The Casing for Automatic Lighting System 47
4.16 Difference Level of Headlamp 48
4.17 The Output on LCD Display 48
xiv
LIST OF TABLES
TABLE TITLE PAGE
2.1 Common Task and Features needed in Microcontroller 17
2.2 Five I/O Port available in PIC16F877A 22
xv
LIST OF APPENDICES
APPENDIX TITLE PAGE
A Pictures of Project Prototype 56
B LCD driver coding 57
1
CHAPTER 1
INTRODUCTION
1.1 Background
A headlamp is a lamp that gives drivers more brightness of light when
driving their vehicles. Drivers who are driving in the dark at night need to switch
ON headlamp to improve their visual and driving in the suitable light. The
performance of headlamp has improved throughout the automotive age. However,
U.S. Nation Highway Traffic Safety Administration (NHTSA) states that most of
the traffic accidents occur in the dark even only 25% of traffic travelling at night. It
had happened due to bad visual acuity at night, bad weather and also road condition.
[1]
The major purpose of using the high beam is to illuminate the road and
traffic scene in front of the driver when there are no vehicles coming from the front.
In this situation, if more light provided when driving, it will gives better visibility,
and will lead us to a safety driving and comfort standpoint.
Thus, to improve the technology in motorcycles lighting system, an
Adaptive Lighting System for Motorcycles was created. This system is a system that
needs no manual operation for switching ON and OFF to flash the high beam or low
beam. This lighting system will detect vehicles that coming from the front and
automatically switch the light depend on the situation. When there is light from
2
vehicles that coming from front, it automatically switches to the low beam and when
that vehicle passes, it automatically switches back to high beam. The range that
needed for the light sensor to operate the system will be set accordingly.
1.2 Problem Statement
Nowadays user still uses manual light switching. Means that user still need
to switch ON and OFF high beam or low beam when there is vehicle coming from
front at night. This system will make it easy for all the drivers or riders who always
forget to switch off the high beam when vehicles coming from the front. So, other
driver from the front vehicles will feel comfort when driving with this lighting
system. [2]
Help user to use the right lighting system on the right condition
automatically. Some drivers do not bother about other drivers and use the wrong
light when driving. By using this lighting system, it will help all the drivers using
the right light on the right situation. [3]
Headlight high beams on a car are a useful tool. When used incorrectly, they
can cause harm to us and to other drivers day or night. It's important to understand
the rules of high beams to help prevent a serious accident, injury and possibly death.
[4]
1.3 Objectives of project:
1. To investigate the lighting conventional system and mechanism in
motorcycles.
2. To study the properties of an LDR sensor and its working principles.
3. To design and develop an Adaptive Lighting System to be implemented
in motorcycles.
4. To propose a lighting system that can be commercialized for the types of
transportation.
3
1.4 Scope of project
To accomplish this project successfully, there are a few things to be
considered. An Adaptive Lighting System for Motorcycles is an advance lighting
system for all the motorcycles. This system can help us to switches ON or OFF the
headlight automatically due to the right situation especially at night. This system
will use light sensor (LDR) to trace light from the front vehicles. If there is light
from the front vehicles, the headlight will be turning off automatically. This system
will be useful during the night because the light sensor will become more sensitive
to light. So, to complete this project, the understanding of the principles of light
sensor and lighting system for motorcycles is very important.
1.5 Thesis Outline
The structure of this project report was planned to provide a clear
explanation about the project entirely. This thesis is divided into five chapters.
Chapter One introduces the project background, problem statements of this
project, objectives and scope of work and the organization of this thesis.
Chapter Two provides the literature review on vehicles lighting system,
design proposed for this lighting system, PIC Microcontroller, Combination of PIC
micro, and other theory related with this project.
Chapter Three describes in detail the project methodology which is explained
about the whole method being used for this project. This chapter contains the
methods used from collecting data, processing and analyzing of data and flowchart.
Chapter 4 covers about the simulation and practical results of Hardware and
Software circuit used in this project. There also have discussion for this project.
Lastly, Chapter Five is a conclusion of this project. In this chapter also
expresses some recommendation towards the application for future development.
4
CHAPTER 2
LITERATURE REVIEW
2.1 Introduction
This chapter will explain and discussing about the electronics technology for
automatic lighting system in general, the basic concept and related information
about it. The characteristics of automatic lighting system, sensors that might be used,
PIC 16F877A and LCD will be explained further towards the end of this chapter.
2.2 Fundamental of Automatic Lighting System
The lighting system of a vehicle consists of lighting and signaling devices
integrated to the front, sides, rear, and in some cases the top of that vehicle itself.
This system provide illumination for the driver to drive their vehicle safely in the
dark, to increase the conspicuity of the vehicle, and to display information about the
vehicle's presence, position, size, direction of travel, and driver's intentions
regarding direction and speed of travel.
Figure 2.1 below shows the general wiring diagram for motorcycles that will
be integrate with the adaptive lighting system. There will be some modification of
the existing wiring diagram of motorcycle to make sure the automatic lighting
system will be functioning well after integrate both circuit.
5
Figure 2.1: General wiring diagram of motorcycles[5]
2.3 Automatic Lighting System
This new system consists of two major parts. The first part is Automatic
High/Low Beam System and the second part is HID Dimming System. These two
systems are working individually on different stages.
Figure 2.2 shows that there are 3 stages in the system. The first stage
represents the range of the nearest obstacles over 50 meters ahead. The second stage
represents the obstacles within 5 to 50 meters range and finally the third stage
represents the obstacles with 0 to 5 meters ahead.
Automatic High and Low Beam system will operates when this system
detects an object which is far away (Stage 1, Figure 2.3). The headlamp control will
operate when the obstacles go further (Stage 2, Figure 2.4). The HID Dimming
System for low beam will take control the system when the obstacles or car are very
close (Stage 3, Figure 2.5). The angle of headlamp will be carried out as
compensation to the pitch angle of vehicle when the adjustment made. For this case,
the pitch of the vehicle is fixed in zero velocity and horizontal position by assuming
it. [6]
6
Figure 2.2: Stages of Advanced Headlamp System [6]
Figure 2.3: Stage 1 – Obstacle over 50 meters ahead [6]
Figure 2.3 shows that the obstacle was detected at the distance of over 50
meters. When there aren’t any street lamps detected, the high beam will be
automatically switched on or highest position of Low Beam will be maintained.
Figure 2.4: Stage 2 – Obstacle within 5 to 50meters [6]
7
In Stage 2 (Figure 2.4), the obstacle was detected in 5-50 meters area. The
angle of the Low Beam will be adjusted automatically according to the actual
distance and it will be turned on. It means that the voltage output by the Ultrasonic
Sensor, v is inversely proportional to the distance l1.
(1)
where kuL: is a coefficient of the ultrasonic sensor. The beam angle of headlamp θ is
described by the tangent.
(2)
and h is the depressed height.[6] The angle of head lights is adjusted according to
the distance in the above cases.
Figure 2.5: Stage 3 – Obstacles with 5 meters[6]
2.3.1 Light Dimming
Light sensors will detect the light reflected by other obstacles in the front of
the vehicle and light from the coming vehicle from the front. The HID lamp will
decrease the brightness until it becomes a comfortable level if the level of brightness
is too high and may glare the driver inside the vehicle. The headlamp will be
automatically switched off if the dimming level cannot be met. [6]
8
2.3.2 Automatic High/Low Beam System
By using high beam on rods with poor visibility may help driver but also can
cause glare to the vehicles coming from front. Hence, any automatic lighting system
for switches the high beam ON and OFF depend on surrounding light would be
helpful for the driver.
Automatic High and Low beam system is a system which can switch
between high and low beam automatically due to the detection of light from the
front vehicles or surrounding light. A block diagram of this system is shown in
Figure 2.6. In this system, light sensors on the car will detect light either from the
oncoming vehicle or surrounding light will generate a signal to initiate switching
over to low-beam driving. It will change back to high-beam after no light is
detected. [6]
Figure 2.6: Automatic Hi/Low Beam System with speed control[6]
Recently, all vehicles’ lighting system using manual operation to turn OFF or
ON the high beam. For advanced technology in automotive field, we need to make it
easy for all drivers by creating automatic lighting system. The wide variety of
sensors currently on the market differs from one another in their mounting
configurations, environmental sealing, and electronic features. There are 2 sensors
that can be use to build this project.
9
1. Light sensor (LDR)
2. Distance sensor (Ultrasonic)
2.4 Light Sensor (LDR)
Light Dependent Resistors or LDR are very useful especially in light sensor
circuits. The resistance of an LDR is very high, but when it not detects light,
resistance drops dramatically and allowing current to pass through it.
Figure 2.7: Light Dependent Resistor [7]
When the light level is low, the resistance of the LDR will be high. This will
prevents current from flowing to the transistor base. Consequently the LED will not
light. But, when light LDR detect lights, its resistance falls down dramatically and
current flows into the base of the first transistor and then the second transistor. The
LED lights will turn ON and the variable resistor can be turned up or down to
increase or decrease resistance, in this way it can make the circuit more or less
sensitive.