Vous êtes sur la page 1sur 21

UNIVERSITI TENAGA NASIONAL

COLLEGE OF ENGINEERING
Department of Electronics & Communication Engineering

EEEB371 MICROPROCESSOR SYSTEM


(DESIGN PROJECT)
NAME

ID.NO

ANANTHAN A/L RAMESH

EE096371

KEHSEEGAN A/L VENUGOPALAN

EE096723

VINOT A/L SIVAKUMARAN

EE094140

KAVITRA A/P VELAYUTHAMPILLAI

EE095340

SECTION: 03B
LECTURER: MR. DICKSON NEOH TZE HOW

DUE DATE

SUBMISSION DATE

9/9/2016

9/9/2016

Table of Contents
NO.
1.

TITLE
PROBLEM STATEMENT

2.

PAGE
1
1

INTRODUCTION
3.

2
OBJECTIVE

4.

2-4
PROJECT SPECIFICATIONS

5.

4-8
DESIGN DEVELOPMENT AND PROGRAMMING
PHASE

6.

8-9
TESTING

7.

10-13
RESULTS AND DISCUSSION

8.

14
CONCLUSION

9.

15-19
APPENDIX

PROBLEM STATEMENT
In line with the governments green technology policy and Tenaga Nasional Berhads focus on
energy, Universiti Tenaga Nasional (UNITEN) recently commenced several initiatives to
improve the environmental sustainability on campus. UNITENs plan to Go Green campuswide is expected to cultivate a culture for sustainability among students and staff members. One
of the main initiatives that have been proposed is to shift student main mode of transport to nonmotorized transportation, naming cycling. To encourage this shift, the campus was transformed
to enhance the cycling experience on-campus. Cycling routes have been plotted out throughout
the campus with dedicated cycling lanes which connects campus buildings. But there is a flaw to
the system that matters. The cycling lanes were not equipped with a proper lighting system. As a
result, this causes unavoidable incidents to be happen while cyclers using the pathway to reach
their destination especially at night time. The bicycles are not always equipped with a lamp and
it may let the cyclers to face collision problems as the lanes are considerably narrow. In addition,
the walkway users were using cycling lane to walk. As this problem occurs, there is no indication
or alert sign for the pedestrians that there are cyclers using the cycling lane. Hence, we come out
with a creative problem solving skills to overcome the problem with the use of Microprocessor
(PIC) knowledge.

INTRODUCTION
Lights are a source of signaling device used as an indication or to alert someone about something
around the world. Creating a Lighting system is always a smart way to enhance the safety
elements of using any pathway or lanes. So, as a student of UNITEN, weve decided to propose a
well-integrated lighting system with super bright LEDs for the cycling lane to avoid some
unwanted problems. Brighter bike lane, will go some way to tackling two serious causes of
cycling fatalities which is being caught in the blind spot, or cyclers turning across an unseen
cyclist. As the cycling lane connects all the building across UNITEN, it is hard to propose a
lighting system for all the existing lanes. So, weve chosen a specific lane to demonstrate our
project on how the lighting system works which is the lane that connects UNITENs back gate
and Kelompok Amanah residents as it has sharp corner in between the lane.

OBJECTIVE
There are several objectives for this project:

To propose a well-integrated lighting system for UNITEN cycling lane.


To design a set-up to support the lighting system.
To make an easy flow of pathway for cyclers at night.
To create time delays for the system to run at specific duration as an initiative to save
electricity.
To apply the knowledge of the Microprocessor (PIC) in creating the system.

PROJECT SPECIFICATIONS
DESCRIPTION
In this project, two sets of light have been used to indicate the pathway for the cyclists on cycling
lane. Blue light indicates the pathway from Kelompok Amanah residents to UNITENs back gate
(Lane 1) while Green light indicates the pathway from UNITENs back gate to Kelompok
Amanah residents (Lane 2). Two sets of motion sensors are used to trigger the lights for the
pathway and a push button were used for an emergency purpose. Sensor 1 is used to trigger
lights for Lane 1 while Sensor 2 is used to trigger lights for Lane 2. The push button is used to
trigger the lights for both lanes to stop them from functioning due to any damage caused.
Generally, every lighting system only works at night and same goes for this project. But, it is
such a waste of electricity if none of the cyclist uses the cycling lane. So, weve used the motion
sensor to activate the lights whenever it detects a motion of cyclers entering the pathway. In
addition, we have created specific time duration for the lights to operate or light-up as per
average timing to reach the desired destination. This will help to avoid the wastage of electricity
occur.
Moreover, the lighting system for both lanes runs simultaneously as per presence of
cyclists on the pathway. A delay of 3 minutes has been set to the system as an average timing to
reach the destination. As the new presence of cyclist detected, it resets the time back again and
starts from time 0. The motion sensors and push button has been set as an input to the system
while the lights for Lane 1 & Lane 2 were set as an output to the system.

List of components used:


No.
1
2
3
4

Components
PIC18F4550 Microcontroller
Motion Sensor
Push button
LED
Table 1

Figure 1: Systems Layout.

Quantity
1
2
1
16

Figure 2: Block diagram of the system

DESIGN DEVELOPMENT & PROGRAMMING PHASE


Hardware Design
For the designing part, we have used PROTEUS software to design the circuit diagram of our
project. The output light was set to two different ports where lights for Lane 1 are set to Port C
while the lights for Lane 2 are set to Port D. Since were using the emergency push button as
high priority interrupt, it was set as an input to RB1/INT1 Pin. The two motion sensors were set
as an input to RB2/INT2 Pin and RB3 Pin respectively. Since there is no availability of sensor
components in proteus library, weve used a simple push button to indicate the input to the two
motion sensors.

PORTC/
LANE 1

PORTD/
LANE 2

Figure 3: Schematic Diagram

Indicates the Emergency Push Button.


Indicates Motion Sensor 1.
Indicates Motion Sensor 2.

Ports used in PIC18F4550 Microcontroller:


Ports/Pins
PORTC
PORTD
RB1 Pin
RB2 Pin
RB3 Pin

Specification
Output light (Lane 1)
Output light (Lane 2)
Push Button (High Priority Interrupt)
Input Motion Sensor 1 (Lane 1)
Input Motion Sensor 2 (Lane 2)

Calculations for setting-up the delays of timers:


Used Fosc for this system is 32 MHz
As per given formulae:

Maximum clock cycle = (2^16) 1


= 65,535

Timer value = 65,535-62,500


= 3035
= 0x0BDB #

Flow Chart:

YES

NO
YES

NO

NO

YES

As an overall summary for the system to be run is as follows:


First, the system constantly checks for an interrupt to be occurring. It checks for the presence of
cyclist entering both pathways as the cyclist has to pass through the Motion sensor section. If
there is no presence of cyclists, the lights for Lane 1 & Lane 2 will not light-up as there is no
logic 1 given to the motion sensors. If there is a presence of cyclist, the lights for respective
Lanes will light-up as per detection of respective sensors and will continue to light-up for the
given time delay. Other than that, if both the motion sensors didnt get any sort of detection, the
system checks for an emergency signal where it is used to stop the lights for both lanes.

TESTING
Assembling of source code:

Figure 4: Source code assembling


8

Based on figure 4, the program or source code for the system was BUILD SUCCEEDED which
indicates theres no error occur while assembling the code using MPLAB IDE.

Testing the circuit connection:

Figure 5: Proteus Simulation Log


Based on figure 5, the circuit connection for the system was successfully constructed without
error. The simulation log shows that the circuit connection is works fine.

RESULT & DISCUSSION


RESULTS:
Initial state of the system after the execution of the program:

Based on the result above, both lights for Lane 1 & Lane 2 remains un-lighted as no presence of
cyclist is detected or no button is pressed.

10

State of the system after the execution of the program (when Sensor 1 given logic 1):

Based on the result above, the lights for Lane 1(Blue light) were light-up as sensor 1 was given
logic 1 or detection of cyclist.
State of the system after the execution of the program (when Sensor 2 given logic 1):

11

Based on the result above, the lights for Lane 2 (Green light) was light-up as sensor 2 was given
logic 1 or detection of cyclist.

State of the system after the execution of the program (when Sensor 1 & 2 given logic 1):

Based on the result above, the lights for both Lane 1 (Blue Light) & Lane 2 (Green light) was
light-up as sensor 1 & 2 was given logic 1 or detection of cyclist simultaneously.

12

State of the system after the execution of the program (when Emergency push button given
logic 1):

Based on the result above, when the emergency push button is pressed or given logic1,the
lights for both Lane 1 & Lane 2 was turned off.

DISCUSSION
The result of the system that was shown in the figures on results section is the same as what
were expected to have from the beginning of the project. The difficulties occur in setting the
timer as the average time delay needs to be set at minimum of 3 minutes. Our expected result
has matched the actual result of the system completely. Our expected result is to have a
system which runs as per detection of motion sensor or presence of cyclist on cycling pathway.
When a sensor detects the presence of cyclist, the light for the respective Lane should light-up
for 3 minutes as per program code. After the execution of the program through protues
simulation software, the system outputs the same result with plus-minus 3 minutes of delay as
expected. This may occur because the difference between real time and calculated time delay.
Moreover, the system runs by utilizing polling method for constantly check the status of the
motion sensor and interrupt method for triggering the sensor and push button. In addition, with
the use of timer module, the delay function has been created with some flaws in it as it has
differs compared to real time.

13

CONCLUSION
The outline of the system is working consummately yet it does not have a few features which can
be added to enhance the system. One of the features is to include proximity sensor in every
cycling lane to control the detection of unwanted creatures such as cats, dogs and etc, in order to
avoid wastage of electricity. Thus, we have effectively satisfied our target which is to outline a
proficient lighting system for existing cycling lane that can contribute to a safer use of cycling
lane. Based on the overall result obtained, the objectives of the project have been successfully
achieved as well as created a system by utilizing the lesson learned throughout Microprocessor
system course and simulation tools/softwares which played an important role in designing the
project.

14

APPENDIX

Figure 6: Schematic Diagram

Source Code
#include<p18f4550.inc>
Lane1 equ PORTC
Lane2 equ PORTD

org 0x00
goto start
org 0x08
15

goto Emergency
retfie
org 0x18
goto Sensor2
retfie

start

clrf TRISC,A
clrf TRISD,A
bsf TRISB,3,A
clrf PORTC,A
clrf PORTD,A
bsf
RCON,IPEN,A
bcf
INTCON3,INT1IF,A
bsf
INTCON3,INT1IE,A
bsf
INTCON3,INT1IP,A
bcf
INTCON3,INT2IF,A
bsf
INTCON3,INT2IE,A
bcf
INTCON3,INT2IP,A
bsf
INTCON,GIEH,A
bsf
INTCON,GIEL,A
movlw D'90'
movwf PRODL,A

check1 btfsc PORTB,3,A


bra check1
clrf Lane2,A
setf Lane2,A
call delay_1min
clrf Lane2,A
bra check1
Sensor2

bcf INTCON3,INT2IF,A
clrf Lane1,A
setf Lane1,A
call delay_1min
clrf Lane1,A
goto start
16

Emergency

bcf INTCON3,INT1IF,A
clrf Lane1,A
clrf Lane2,A
goto start

delay_1min

movlw 0x87
movwf T0CON,A
movlw 0x0B
movwf TMR0H,A
movlw 0xDB
movwf TMR0L,A
bcf INTCON,TMR0IF,A
btfss INTCON,TMR0IF,A
bra CheckTMR
decfsz PRODL,F,A
bra Loop
return

Loop

CheckTMR

end

17

Figure 7: Cycling Lane for UNITENs back gate to Kelompok Amanah residents (Lane 2)

Figure 8: Cycling Lane for Kelompok Amanah residents to UNITENs back gate (Lane 1)

18

Figure 9: Reference for creating time delay.

19

Vous aimerez peut-être aussi