Upload
ah-kong
View
213
Download
10
Embed Size (px)
Citation preview
i
ii
“ I hereby declare that I have read this thesis and in my opinion this thesis is sufficient
in terms of scope and quality for the award of the Bachelor‟s Degree of Electrical
Engineering “
Signature : ………………………………………..…
Name of Supervisor : En. Camallil Bin Omar
Date : 30 April 2010
iii
AUTOMATIC TOILET VISITOR ON / OFF
LIGHT CONTROL
FADHIL LATIFFI BIN SHAHRUDDIN
A thesis submitted to the Faculty of Electrical Engineering in partial fulfillment
of the requirements for the award of the Bachelor’s Degree of Electrical
Engineering
Faculty Of Electrical Engineering
Universiti Teknologi Malaysia
APRIL 2010
iv
DECLARATION
“I declare that this thesis entitled “ Automatic Toilet Visitor On / Off Light
Control ” is the result of my own research except as cited in the references.
The thesis has not been accepted for any degree and is not concurrently
submitted in candidature of any other degree.”
Signature : ………………………………………..…
Name : Fadhil Latiffi Bin Shahruddin
Date : 30 April 2010
v
ACKNOWLEDGEMENT
The first I gracefully thank to gratitude to Allah S.w.t. for giving me the courage and
spirit to completing my study of the Degree in Bachelor of Electrical Engineering.
I would like to address my acknowledgment to several individuals, who had
been supporting and helping me during my study. I would not be able to complete my
study especially this report if it were from the first and foremost, my supervisor En.
Camallil Bin Omar. He had given me the courage to apply my writing skill and the
idea during the development of the project. I also would like to express my truthful
thank to all of the Space UTM Lecture that had been teaching me and the Space
Penang group especially, En Johari Kassim for his kindly advice to keep me on
continuing the study.
I would like to thank to all of my family especially both my parent, my father
Shahruddin Bonyamin and my mother Norsiah Bt. Othman for keep giving the
support to me on completing the study. Also to my aunty Kamariah Bonyamin and
my grandma Rahmah Mat Taib, for their greet support on my financial during the
study. To my lovely wife Zanariah Mohtar , her family and both of my children, for
giving back support and together to feel the hard life with me.
Also not forget to all my friend at Ittar Perai, especially my ex head of
electronic department En. Muhamad Zamri, En Saad Din and En Azman Rahimi for
their support. To all SmartLab Sdn. Bhd. Staff especially my ex manager En. Razali
Saad and Mohd Nor Abu Bakar for teaching me a lot knowledge and skill on circuit
design and testing .
At last I would like to thank to my head of electrical department En Ganesan
for giving me opportunity to use this innovation project also as my PSM project. And
all the electrical staff at ILP Nibong Tebal for a lot of giving an input and idea on the
problems occurs in the problems location.
vi
ABSTRACT
Electrical energy is the one of important required in our living live today. But
electrical energy mostly waste by user especially light in the toilet area. Most of the
time the light always remain on even the is no people in the toilet. For building or area
especially education institution like ILP Nibong tebal , toilet are most area use by
many people especially student ,and this area are the most waste of electrical energy.
Most of the time the toilet remain turn on until 8 hour/day and also a few times
found remain until 24 hour and 36 hour . This effected an electrical bill need to be pay
per/month , there where around RM100,00.00 per/month. In term of that , the main
objective of the project is to design and develop an automatic circuit to turn on / off
the light only when there is people in the toilet. By taking control of the light turn
on/off , the time of light use can be reduce into exactly when it needed.
The main component that will use in this project is a new type of detection
sensors called PIR Passive Infrared Sensors ). A passive Infrared sensor (PIR sensor)
is an electronic device which measures infrared light radiating from objects in its field
of view. PIRs are often used in the construction of PIR-based motion detector.
Normally it operates by motion that had been detected and the light will trigger to turn
On , depend on the timer setting.
In this project to turn on the light is not only depend on the PIR sensor where
its trigger by timer but it depend on existing of people inside the sub toilet area. By
using the device , human careless and undisciplined manner can be control. This will
help to reduce the total hour of the light to turn on , by this the total energy usage
reduce and electrical bills are also reduce.
vii
ABSTRAK
Tenaga elektrik adalah merupakan salah satu elemen keperluan yang penting
dalam kehidupan masa kini. Namun pembaziran tenaga elektrik sering di lakukan
oleh pengguna terutama di dalam tandas. Bagi banggunan terutamanya pusat
pendidikan seperti ILP Nibong Tebal, ruang tandas adalah merupakan tempat yang
sering digunakan oleh ramai orang terutamanya para pelajar, dan kawasan ini adalah
merupakan kawasan yang paling tinggi berlakunya pembaziran tenaga elektrik.
Pada kebanyakan masa lampu tandas di biarkan sentiasa terbuka malah kadang
kala mencecah sehingga 8 jam sehari dan kadangkala didapati berterusan selama 24
jam dan 36 jam. Ini menjejaskan jumlah bil yang perlu di bayar pada setiap bulan di
mana jumlah bil elektrik yang perlu di bayar adalah sebanyak RM 100,000.00
sebulan. Oleh yang demikian itu objektif utama projek ini adalah bagi merekabentuk
satu litar yang dapat mengawal tutup dan buka lampu tandas yang mana ia hanya di
buka apabila ketika terdapat penguna di dalam tandas sahaja. Dengan kaedah
pengawalan ini ia dapat mengurangkan kadar pengunaan tenaga elektrik dan
seterusnya mengurangkan kos bil bulanan.
Komponen utama yang digunakan di dalam projek ini adalah sejenis penderia
yang di panggil PIR – Passive Infrared Sensor. PIR Sensor andalah merupakan salah
satu alat elektronik yang mengukur perbezaan kadar pancaran cahaya infra merah
yang di pancarkan dari sesuatu objek. Kaedah yang di gunakan adalah melalui
pengesanan pergerakan dimana apabila terdapatnya pergerakan di kesan oleh PIR ia
akan memacu untuk lampu di buka.
Di dalam projek ini kawalan keatas lampu bukan hanya bergantung kepada
PIR sensor tetapi ia juga berdasarkan kepada kehadiran penguna di dalam tandas.
Dengan ini ia dapat mengatasi masalah pengguna yang tidak berdisiplin dan
seterusnya mengurangkan kos pembayaran bil bulanan.
viii
TABLE OF CONTENTS
CONTENT PAGE
CONFESSION ii
DECLARATION iv
ACKNOWLEDGEMENT v
ABSTRACT vi
ABSTRAK vii
TABLE OF CONTENTS viii
LIST OF FIGURES xi
LIST OF TABLE xiii
LIST OF SYMBOLS xiv
LIST OF ABBREVIATIONS xv
CHAPTER TITLE PAGE
1 INTRODUCTION
1.0 General.
1.1 Project Objective
1.2 Project Scope.
1.3 Project Problem Background.
1.4 Problem Area Location
1
1
1
1
2
2
ix
2 LITERATURE REVIEW
2.0 PIR – Passive Infrared Sensors.
2.0.1 Infrared Radiation
2.0.2 Pyroelectric Sensors
2.0.3 Fresnel Lens.
2.1 Digital System And Logic Gate
2.1.1 Digital Logic States
2.1.2 TTL Input & Output Voltage Levels
2.1.3 Digital Logic Gates
2.1.4 Pull-up and Pull-down Resistors
2.3 Bipolar Junction Transistor (BJT)
2.3.1 Transistor currents.
2.3.2 Functional model of an NPN transistor.
2.3.3 Using a transistor as a switch.
2.3.4 Protection Diode
2.3.5 Connecting a transistor to the output from an IC
2.3.6 Choosing A Suitable NPN Transistor
2.4 Relay
2.4.1 Reed Relays
2.4.2 Solid State Relay (SSR)
2.4.2.1 Advantages over mechanical relays
2.4.2.2 Disadvantages
2.5 Timer 555 / 556
2.5.1 Inputs Of 555/556
2.5.2 Output Of 555/556
2.5.3 Timer 555/556 Monostable Circuit.
2.5.3.1 Monostable Operation
2.5.3.2 Power-On Reset Or Trigger
2.5.3.3 Edge-Triggering.
5
5
6
6
8
10
10
11
12
16
16
17
18
19
20
21
22
23
24
24
26
26
27
28
29
31
32
33
33
x
3 PROJECT METHODOLOGY
3.0 Introduction.
3.1 Project Development Stage.
35
35
36
4 SYSTEM AND CIRCUIT OPERATION
4.0 Introduction.
4.1 Sensing Circuit.
4.1.1 Sensing Zone 1.
4.1.2 Sensing Zone 2.
4.2 Main Controller Circuit.
4.3 Light On/Off Controller.
42
42
44
45
47
49
53
5 TEST AND RESULT
5.0 Introduction.
5.1 Light On/Off Controller Circuit Test.
5.2 PIR Sensor Testing.
5.3 Reed Switch Sensor Testing.
5.4 Main Controller Testing.
5.5 Full System Test.
5.6 On Location Test.
56
56
59
57
60
62
64
65
6 CONCLUSION
6.0 Conclusion.
6.1 Suggestion And Future Development.
66
66
67
REFFERENCES 68
APPENDIX 1 : Project Schematic And Component List 69
APPENDIX 2 : Component Data Sheet. 70
APPENDIX 3 : PSM2 Presentation Slide 71
xi
LIST OF FIGURES
FIGURE PAGE
Fig 1.0 : Toilet Floor Plan and Total Lamp Each Toilet.
Fig 2.1 : PIR Typical Configuration
Fig 2.2 : PIR Detecting Method and Signal Output.
Fig 2.3 : Murata IRA-E700 Series PIR Sensors Specification.
Fig 2.4 : Fresnel Lens Detection Angle And Lens Dimension.
Fig 2.5 : Fresnel Lens Construction
Fig 2.6 : TTL Digital Logic Voltage Level
Fig 2.7 : Ideal Digital Logic Voltage Level
Fig 2.8 : Input Pin Pull-up and Pull-down Resistor
Fig 2.9 : Transistor Circuit Symbols
Fig 2.10 : Transistor Current Flow
Fig 2.11 : NPN Transistor Functional Model
Fig 2.12 : Transistor As A Switch
Fig 2.13 : Protection Diode Across Inductive Load
Fig 2.14 : NPN and PNP Transistor Connection to Integrated Circuit (IC)
Fig 2.15 : Relay Schematic And Real Relay.
Fig 2.16 : Bi-Directional Solid State Relay With Opto-Isolation.
Fig 2.17 : Timer 555 and 556 Input/output Pin and Pin Assignment.
Fig 2.18 : Timer 555 Sinking And Sourcing Test.
Fig 2.18 : Timer 555 Output Protection Diode.
Fig 2.19 : Timer 555 Monostable Circuit With Manual Trigger
Fig 2.20 : Timer 555 Monostable Timing Diagram.
Fig 2.21 : Power-On Reset Or Trigger Circuit
Fig 2.22 : Edge-Triggering Circuit
Fig 3.1 : Project System Block Diagram.
Fig 3.2 : Project Development Flow Chart.
Fig 3.3.1 : Zone 1 Sensing Circuit
Fig 3.3.2 : Main Controller Simulation
Fig 3.4 : Light On/Off Controller Simulation.
3
7
7
8
9
9
11
12
16
17
17
18
20
20
22
23
25
28
29
30
31
32
33
34
35
36
38
39
38
xii
LIST OF FIGURES
FIGURE PAGE
Fig 3.5 : Main Controller Circuit Board.
Fig 3.6 : Light On/Off Controller Circuit Board.
Fig 4.1 : Project System Block Diagram.
Fig 4.2 : Sensing Zone Area.
Fig 4.3 : The PIR Sensors Module.
Fig 4.3 : The PIR Sensors Module Retriggering Jumper and Delay Adjust.
Fig 4.4 : The Reed Switch Condition During Door Open or Close.
Fig 4.5 : Zone 2 Sensing Circuit.
Fig 4.6 : Zone 2 Sensing Output Voltage.
Fig 4.7 : Main Controller Circuit.
Fig 4.8 : Zone 2 identification Circuit.
Fig 4.9 : Zone 2 Timer Circuit.
Fig 4.10 : Light On/Off Controller Circuit.
Fig 5.1 : Light On/Off Controller Circuit Test.
Fig 5.2 : PIR Sensor Circuit Test.
Fig 5.3 : PIR Sensor Detection Range.
Fig 5.4 : Reed Sensor Test.
Fig 5.5 : Main Controller Schematic And Test Point Location.
Fig 5.6 : Project Full System Integration.
Fig 5.7 :On Location Assembly And Test.
41
41
42
44
45
46
47
48
49
50
51
51
54
57
58
59
61
63
64
65
xiii
LIST OF TABLE
TABLE PAGE
Table 1.0 : Energy usage data calculation table.
Table 3.1 : Automatic Toilet Visitor On/Off Light Control Component List.
Table 4.1 : The Main Controller Truth Table.
Table 5.1 : +12V And +5V Voltage Measurement Result.
Table 5.2 : PIR Sensor Response.
Table 5.3 : Reed Sensor Measurement Result.
Table 5.4 : Zone 1 Circuit Test Point Measurement Result.
Table 5.5 : Zone 2 Circuit Test Point Measurement Result.
Table 5.6 : Main Circuit Test Point Measurement Result.
4
40
53
57
59
61
62
62
62
xiv
LIST OF SYMBOLS
IC Bipolar Transistor Collector Terminal Current
IB Bipolar Transistor Base Terminal Current
VBE Voltage In Between Base Terminal And Emitter Terminal
hfe Direct Current Gain Factor For Transistor
Rce Resistance In Between Collector Terminal To Emitter Terminal
IE Emitter Current
xv
LIST OF ABBREVIATIONS
PIR Passive Infred Sensor
DC Direct Current
AC Alternating Current
ILP Institut Latihan Perindustrian
PSM Final Year Project
MOSFET Metal Oxide Semiconductor Field Effect Transistor
IC Integrated Circuit
BJT Bipolar Junction Transistor
CMOS Complementary Metal Oxide Semiconductor
TTL Transistor – Transistor Logic
FET Field Effect Transistor
IR Infra Red
COMM Common Point
NC Normally Close
NO Normally Open
CHAPTER 1
INTRODUCTION
1.0 General.
Electrical energy is the one of important required in our living live today. But
electrical energy mostly wastes by user especially light in the toilet area. Most of the
time the light always remain on even there is no people inside the toilet. For building
or area especially education institution like ILP Nibong tebal , toilet are most area use
by many people especially student , and this area are the most waste of electrical
energy. Most of the times the toilets remain turn on until 8 hour/day and also a few
times found remain until 24 hour and 36 hour . This effected an electrical bill need to
be pay per/month , there where around RM100,00.00 per/month.
1.1 Project Objective.
The objective of this project is to build an automatic toilet visitor on/off light
controller for application at ILP Nibong Tebal.
1.2 Project Scope.
The main scope of the project are :
1. Design and develop a circuit to control the toilet a light automatically only
when there is visitor inside the toilet.
2. Using circuit simulation and assemble the project to develop the system.
3. Use knowledge that had been learn before during troubleshoot and solving any
project errors.
4. Test the circuit and analyze the project data and system response.
2
1.3 Project Problem Background.
Human undisciplined manner and careless are the main factor of an electrical
energy waste. It is because during the time when people came out after using the toilet
they doesn‟t turn off the toilet light, it make the light turn on even there is no people
inside the toilet. Most of the time toilets light always turn on until 8 hour per day, but
sometimes even worse the light turns remain turn on until 2 days where total hour is
around 48 hour.
These are the root cause of increasing the electrical bill. Because of this
problem, the Director of ILP Nibong Tebal had ask the electrical department to try
solve this problem by creating any device that can control the turn on / off the light.
Total number of toilet for workshop is around 24 toilet, where 4 toilet at electrical
department , 2 toilet at network department , 4 at multimedia department and 14 toilet
at printing department. All of this toilet are being use during class are running from
8.00am to 5.30pm.
1.4 Problem Area Location.
Figure 2.1 shows the floor plan of the toilet, where each floor has 2 toilets
each one for men and women. From the floor plan each toilet are using 4 double
florescent lamp, where each lamp using 40W electrical power.
Below is the calculation for total power usage on each toilet.
Quantity of Double 40w Florescent Lamp = 4
Total number of light / toilet = 8
Total power consumptions / toilet = 8 X 40W
= 320 Watt
3
Fig 1.0 : Toilet Floor Plan and Total Lamp Each Toilet.
From each toilet power consumption estimation can be done by estimate the
total hour usage per day in current situation and with using an automatic device. In
this estimation current hour usage per day is estimate as 8 hours and by using
automatic device total hours per day is estimate as 3 hours. Total usage per day will
be times with 20 days as a working day per month. By this we can get the total power
consumptions each toilet per month and the total bill need to pay for each month.
The calculation are using TNB web bill calculator, where the tariff is
Commercial C1 :0.25, 0.27, 0.34. Below are the tables of calculation in-between
current demand and after using an automatic device.
4
Table 1.0 : Energy usage data calculation table.
NO ITEM OF CALCULATIONS CURRENT USE AUTOMATIC DEVICE
1. ESTIMATE HOUR USE PER DAY 8 HOURS 3 HOURS
2. ESTIMATE NUMBER OF DAYS 20 DAYS 20 DAYS
3. ENERGY USAGE PER TOILET 320W 320W
4. ENERGY USAGE PER DAY 8 X 320 = 2.56KW 3 X 320 = 960W
5. ENERGY USAGE IN 20 DAYS 2.56KW X 20 = 51.20KW 960W X 20 = 19.2KW
6. COST EACH TOILET PER MONTH RM 1,274.68 RM 497.68
7. ENERGY USAGE 24 TOILET/MONTH 1,228.8KW 384KW
8. COST 24 TOILET/MONTH RM 29,759.08 RM 9,560.06
From the table we can view the different of total bill need to pay for every
month, where it can saved around RM 20,199.02 each month. From the data we can
conclude by reduce total energy usage by using an automatic light on/off device, we
also saved the cost to pay on electrical bills.
By implementing this project it might help ILP Nibong Tebal to reduce some
of electrical cost.
CHAPTER 2
LITERATURE REVIEW
2.0 PIR – Passive Infrared Sensors
Nowadays PIR sensors are the one most popular use in security alarm system
for motion detection, its also widely use in house hold as light control. Human body
also generated infra red signal that can be detected by this sensor, in that term its suite
table to use as human detection either motion or direction.
Infrared radiation enters through the front of the sensor, known as the sensor
face. At the core of a PIR sensor is a solid state sensor or set of sensors, made from an
approximately 1/4 inch square of natural or artificial pyroelectric materials, usually in
the form of a thin film, out of gallium nitride (GaN), caesium nitrate (CsNO3),
polyvinyl fluorides, derivatives of phenylpyrazine, and cobalt phthalocyanine. (See
pyroelectric crystals.) Lithium tantalate (LiTaO3) is a crystal exhibiting both
piezoelectric and pyroelectric properties.
The sensor is often manufactured as part of an integrated circuit and may
consist of one (1), two (2) or four (4) 'pixels' of equal areas of the pyroelectric
material. Pairs of the sensor pixels may be wired as opposite inputs to a differential
amplifier. In such a configuration, the PIR measurements cancel each other so that the
average temperature of the field of view is removed from the electrical signal; an
increase of IR energy across the entire sensor is self-cancelling and will not trigger the
device. This allows the device to resist false indications of change in the event of
being exposed to flashes of light or field-wide illumination. (Continuous bright light
could still saturate the sensor materials and render the sensor unable to register further
information.) At the same time, this differential arrangement minimizes common-
mode interference, allowing the device to resist triggering due to nearby electric
6
fields. However, a differential pair of sensors cannot measure temperature in that
configuration and therefore this configuration is specialized for motion detectors.
2.0.1 Infrared Radiation
Infrared radiation exists in the electromagnetic spectrum at a wavelength that
is longer than visible light. It cannot be seen but it can be detected. Objects that
generate heat also generate infrared radiation and those objects include animals and
the human body whose radiation is strongest at a wavelength of 9.4um. Infrared in
this range will not pass through many types of material that pass visible light such as
ordinary window glass and plastic. However it will pass through, with some
attenuation, material that is opaque to visible light such as germanium and silicon. An
unprocessed silicon wafer makes a good IR window in a weatherproof enclosure for
outdoor use. It also provides additional filtering for light in the visible range.
2.0.2 Pyroelectric Sensors
The pyroelectric sensor is made of a crystalline material that generates a
surface electric charge when exposed to heat in the form of infrared radiation. When
the amount of radiation striking the crystal changes, the amount of charge also
changes and can then be measured with a sensitive FET device built into the sensor.
The sensor elements are sensitive to radiation over a wide range so a filter window is
added to the TO5 package to limit detectable radiation to the 8 to 14mm range which
is most sensitive to human body radiation.
Typically, the FET source terminal pin 2 connects through a pulldown resistor
of about 100 K to ground and feeds into a two stage amplifier having signal
conditioning circuits. The amplifier is typically bandwidth limited to below 10Hz to
reject high frequency noise and is followed by a window comparator that responds to
both the positive and negative transitions of the sensor output signal. A well filtered
power source of from 3 to 15 volts should be connected to the FET drain terminal pin
1.
7
Fig 2.1 : PIR Typical Configuration
The MURATA IRA-E700 SERIES PIR sensor has two sensing elements
connected in a voltage bucking configuration. This arrangement cancels signals
caused by vibration, temperature changes and sunlight. A body passing in front of the
sensor will activate first one and then the other element whereas other sources will
affect both elements simultaneously and be cancelled. The radiation source must pass
across the sensor in a horizontal direction when sensor pins 1 and 2 are on a
horizontal plane so that the elements are sequentially exposed to the IR source. A
focusing device called Fresnel Lens is usually used in front of the sensor. This lens
help to focus the infrared signal detected direct to sensor face opening.
Fig 2.2 : PIR Detecting Method and Signal Output.
The figure below shows the MURATA PIR IRA-E700 SERIES internal
specifications and layout in its TO5 package. Note the wide viewing angle without an
external lens.
8
Fig 2.3 : Murata IRA-E700 Series PIR Sensors Specification.
2.1.3 Fresnel Lens.
A Fresnel lens is a Plano Convex lens that has been collapsed on itself as in
figure 5 to form a flat lens that retains its optical characteristics but is much smaller in
thickness and therefore has less absorption losses.
The Fresnel lens is made of an infrared transmitting material that has an IR
transmission range of 8 to 14 µm that is most sensitive to human body radiation. It is
designed to have its grooves facing the IR sensing element so that a smooth surface is
presented to the subject side of the lens which is usually the outside of an enclosure
that houses the sensor.
The lens element is round with a diameter of 1 inch and has a flange that is 1.5
inches square. This flange is used for mounting the lens in a suitable frame or
enclosure. Mounting can best and most easily be done with strips of Scotch tape.
Silicone rubber adhesive can also be used to form a more waterproof seal.
The Fresnel Lens has a focal length of 0.65 inches from the lens to the sensing
element. Figure 4.4 below shows the lens dimensions and lens detection angle and
Figure 4.5 show the construction of the lens.
9
Fig 2.4 : Fresnel Lens Detection Angle And Lens Dimension.
Fig 2.5 : Fresnel Lens Construction
10
2.1 Digital System And Logic Gate
Standard commercially available Digital Logic Gates are available in two
basic forms, TTL which stands for Transistor-Transistor Logic such as the 7400
series, and CMOS which stands for Complementary Metal-Oxide-Silicon which is
the 4000 series of chips. This is refers to the logic technology used to manufacture the
Integrated Circuit, (IC) or "chip" as it is commonly called. Normally, TTL IC's use
NPN type Bipolar Junction Transistors while CMOS IC's use Field Effect Transistors
or FET's for both their input and output circuitry. As well as TTL and CMOS
technology, simple digital logic gates can also be made by connecting together diodes
and resistors to produce RTL, Resistor-Transistor Logic circuits but these are now
less common.
2.1.1 Digital Logic States
All digital electronic circuits and microprocessor based systems contain
hardware elements called Digital Logic Gates that perform the logical operations of
AND, OR and NOT on binary numbers. In digital logic only two voltage levels or
states are allowed and these states are generally referred to as Logic "1" or Logic "0",
High or Low, True or False and which are represented in Boolean Algebra and Truth
Tables by the numbers "1" and "0" respectively. A good example of a digital logic
level is a simple light as it is "ON" or "OFF".
Most logic systems use "Positive logic", in which a logic "0" or "LOW" is
represented by a zero voltage, 0v or ground and a logic "1" or "HIGH" is represented
by a higher voltage such as +5 volts, with the switching from one voltage level to the
other, from either a "0" to "1" or "1" to "0" being made as quickly as possible to
prevent any faulty operation of the logic circuit. There is also a complementary
"Negative Logic" system in which the values and the rules of a logic "0" and a logic
"1" are reversed.
In standard TTL (transistor-transistor logic) IC's there is a pre-defined voltage
range for the input and output voltage levels which define exactly what is a logic "1"
level and what is a logic "0" level and these are shown below.
11
2.1.2 TTL Input & Output Voltage Levels
Fig 2.6 : TTL Digital Logic Voltage Level
There are a large variety of logic gate types in both the Bipolar and CMOS
families of digital logic gates such as 74L, 74LS, 74ALS, 74HC, 74HCT, 74ACT etc,
with each one having its own distinct advantages and disadvantages and the exact
voltages required to produce a logic "0" or logic "1" depends upon the specific logic
group or family. However, when using a standard +5 volt supply any TTL voltage
input between 2.0v and 5v is considered to be a logic "1" or "HIGH" while any
voltage input below 0.8v is recognized as a logic "0" or "LOW". The voltage region
between these two voltage levels either as an input or as an output is called the
Indeterminate Region. CMOS logic uses a different level of voltages with a logic "1"
level operating at between 3 and 15 volts.
Then from the above observations, we can define the ideal Digital Logic Gate
as one that has a "LOW" level logic "0" of 0 volts (ground) and a "HIGH" level logic
"1" of +5 volts and this can be demonstrated as:
12
Fig 2.7 : Ideal Digital Logic Voltage Level
Where the opening or closing of the switch produces either a logic level "1" or
a logic level "0".
2.1.3 Digital Logic Gates
In this section of digital Logic Gates, we have seen that there are 3 main basic
types of digital logic gates, the AND gate, the OR gate and the NOT gate. We also
saw that each gate has an opposite or complementary form of itself in the form of the
NAND gate, the NOR gate and the Buffer respectively, and that any of these
individual gates can be connected together to form more complex Combinational
Logic circuits.
We also saw that both the NAND gate and the NOR gate can both be classed
as "Universal" gates as they can be used to construct any other gate type. In fact, any
combinational circuit can be constructed using only 2 or 3-input NAND or NOR
gates. We also saw that NOT gates and Buffers are single input devices that can also
have a 3-state High-impedance output which can be used to control the flow of data
onto a common Data Bus wire.
Logic Gates can be made from discrete components such as Resistors,
Transistors and Diodes to form RTL (resistor-transistor logic) or DTL (diode-
transistor logic) circuits, but today's modern digital 74xxx series integrated circuits are
manufactured using TTL (transistor-transistor logic) based on NPN bipolar transistors
13
or the faster CMOS MOSFET transistor logic used in 74Cxx and 4000 series logic
chips.
The 8 individual "standard" Digital Logic Gates are summarized below along with
their corresponding truth tables.
a. The Logic AND Gate
Symbol Truth Table
B A Q
0 0 0
0 1 0
1 0 0
1 1 1
Boolean Expression Q = A.B Read as A AND B gives Q
b. The Logic OR Gate
Symbol Truth Table
B A Q
0 0 0
0 1 1
1 0 1
1 1 1
Boolean Expression Q = A+B Read as A OR B gives Q
14
c. The NOT gate
Symbol Truth Table
A Q
0 1
1 0
Boolean Expression Q = not A or A Read as inverse of A gives Q
d. The Logic NAND Gate
Symbol Truth Table
B A Q
0 0 1
0 1 1
1 0 1
1 1 0
Boolean Expression Q = A.B Read as A AND B gives NOT Q
e. The Logic NOR Gate
Symbol Truth Table
B A Q
0 0 1
0 1 0
1 0 0
1 1 0
Boolean Expression Q = A+B Read as A OR B gives NOT Q
15
f. The Logic Ex-Or Gate
Symbol Truth Table
B A Q
0 0 0
0 1 1
1 0 1
1 1 0
Boolean Expression Q = A ⊕ B Read as A OR B but not BOTH
gives Q
g. The Logic Ex-Nor Gate
Symbol Truth Table
B A Q
0 0 1
0 1 0
1 0 0
1 1 1
Boolean Expression Q = A ⊕ B Read if A AND B the SAME gives
Q
h. The Buffer
Symbol Truth Table
A Q
0 0
1 1
Boolean Expression Q = A Read as A gives Q
16
2.1.4 Pull-up and Pull-down Resistors
One final point to remember, when connecting together digital logic gates to
produce logic circuits, any "unused" inputs to the gates must be connected directly to
either a logic level "1" or a logic level "0" by means of a suitable "Pull-up" or "Pull-
down" resistor ( for example 1kΩ resistor ) to produce a fixed logic signal. This will
prevent the unused input to the gate from "floating" about and producing false
switching of the gate and circuit.
Fig 2.8 : Input Pin Pull-up and Pull-down Resistor
2.3 Bipolar Junction Transistor (BJT)
There are two types of standard transistors, NPN and PNP, with different
circuit symbols. The letters refer to the layers of semiconductor material used to make
the transistor. Most transistors used today are NPN because this is the easiest type to
make from silicon. This page is mostly about NPN transistors and if you are new to
electronics it is best to start by learning how to use these first. The leads are labeled
base (B), collector (C) and emitter (E).
17
These terms refer to the internal operation of a transistor but they are not much
help in understanding how a transistor is used, so just treat them as labels! . A
Darlington pair is two transistors connected together to give a very high current gain.
2.3.1 Transistor currents
The diagram shows the two current paths through a transistor. We can build
this circuit with two standard 5mm red LEDs and any general purpose low power
NPN transistor (BC108, BC182 or BC548 for example). The small base current
controls the larger collector current.
Fig 2.10 : Transistor Current Flow
Fig 2.9 : Transistor Circuit Symbols
18
When the switch is closed a small current flows into the base (B) of the
transistor. It is just enough to make LED B glow dimly. The transistor amplifies this
small current to allow a larger current to flow through from its collector (C) to its
emitter (E). This collector current is large enough to make LED C light brightly.
When the switch is open no base current flows, so the transistor switches off
the collector current. Both LEDs are off. A transistor amplifies current and can be
used as a switch. This arrangement where the emitter (E) is in the controlling circuit
(base current) and in the controlled circuit (collector current) is called common
emitter mode. It is the most widely used arrangement for transistors so it is the one to
learn first.
2.3.2 Functional model of an NPN transistor
The operation of a transistor is difficult to explain and understand in terms of
its internal structure. It is more helpful to use this functional model:
Fig 2.11 : NPN Transistor Functional Model
The base-emitter junction behaves like a diode.
A base current IB flows only when the voltage
19
VBE across the base-emitter junction is 0.7V or more.
The small base current IB controls the large
collector current Ic.
Ic = hFE × IB (unless the transistor is full on and saturated) hFE is the current
gain (strictly the DC current gain), a typical value for hFE is 100 (it has no
units because it is a ratio)
The collector-emitter resistance RCE is controlled by the base current IB:
o IB = 0 RCE = infinity transistor off
o IB small RCE reduced transistor partly on IB
o increased RCE = 0 transistor full on ('saturated')
A resistor is often needed in series with the base connection to limit the base
current IB and prevent the transistor being damaged.
Transistors have a maximum collector current Ic rating.
The current gain hFE can vary widely, even for transistors of the same type!
A transistor that is full on (with RCE = 0) is said to be 'saturated'.
When a transistor is saturated the collector-emitter voltage VCE is reduced to
almost 0V.
When a transistor is saturated the collector current Ic is determined by the
supply voltage and the external resistance in the collector circuit, not by the
transistor's current gain. As a result the ratio Ic/IB for a saturated transistor is
less than the current gain hFE.
The emitter current IE = Ic + IB, but Ic is much larger than IB, so roughly IE =
Ic.
2.3.3 Using a transistor as a switch
When a transistor is used as a switch it must be either OFF or fully ON. In the
fully ON state the voltage VCE across the transistor is almost zero and the transistor is
said to be saturated because it cannot pass any more collector current Ic. The output
device switched by the transistor is usually called the 'load'. The power developed in
a switching transistor is very small:
20
In the OFF state: power = Ic × VCE, but Ic = 0, so the power is zero.
In the full ON state: power = Ic × VCE, but VCE = 0 (almost), so the power is
very small.
This means that the transistor should not become hot in use and you do not
need to consider its maximum power rating. The important ratings in switching
circuits are the maximum collector current Ic(max) and the minimum current gain
hFE(min). The transistor's voltage ratings may be ignored unless you are using a
supply voltage of more than about 15V.
2.3.4 Protection Diode
Fig 2.12 : Transistor As A Switch
Fig 2.13 : Protection Diode Across Inductive Load
21
If the load is a motor, relay or solenoid (or any other device with a coil) a
diode must be connected across the load to protect the transistor from the brief high
voltage produced when the load is switched off. The diagram shows how a protection
diode is connected 'backwards' across the load, in this case a relay coil.
Current flowing through a coil creates a magnetic field which collapses
suddenly when the current is switched off. The sudden collapse of the magnetic field
induces a brief high voltage across the coil which is very likely to damage transistors
and ICs. The protection diode allows the induced voltage to drive a brief current
through the coil (and diode) so the magnetic field dies away quickly rather than
instantly. This prevents the induced voltage becoming high enough to cause damage
to transistors and ICs.
2.3.5 Connecting a transistor to the output from an IC
Most ICs cannot supply large output currents so it may be necessary to use a
transistor to switch the larger current required for output devices such as lamps,
motors and relays. The 555 timer IC is unusual because it can supply a relatively large
current of up to 200mA which is sufficient for some output devices such as low
current lamps, buzzers and many relay coils without needing to use a transistor.
A transistor can also be used to enable an IC connected to a low voltage
supply (such as 5V) to switch the current for an output device with a separate higher
voltage supply (such as 12V). The two power supplies must be linked, normally this
is done by linking their 0V connections. In this case you should use an NPN
transistor.
A resistor RB is required to limit the current flowing into the base of the
transistor and prevent it being damaged. However, RB must be sufficiently low to
ensure that the transistor is thoroughly saturated to prevent it overheating, this is
particularly important if the transistor is switching a large current (> 100mA). A safe
rule is to make the base current IB about five times larger than the value which should
just saturate the transistor.
22
Fig 2.14 : NPN and PNP Transistor Connection to Integrated Circuit (IC)
2.3.6 Choosing A Suitable NPN Transistor
The circuit diagram above show how to connect an NPN transistor, this will
switch on the load when the IC output is high. If you need the opposite action, with
the load switched on when the IC output is low (0V) please see the circuit for a
PNP transistor
.
The procedure below explains how to choose a suitable switching transistor. The
transistor's maximum collector current Ic(max) must be greater than the load current
Ic.
Load Current (IC) = Supply Voltage (VS)
Load Resistance (RL)(2-1)
The transistor's minimum current gain hFE(min) must be at least five times the load
current Ic divided by the maximum output current from the IC.
hfe (Min) > 5 xLoad Current (IC)
Max IC Current(2-2)
23
1. Choose a transistor which meets these requirements and make a note of its
properties: Ic(max) and hfe(min).
2. Calculate an approximate value for the base resistor:
3.
RB =VCC - hfe
5 X IC
(2-3)
4. For a simple circuit where the IC and the load share the same power supply
RB = 0.2 x RL x hfe
(2-4)When VC = VS
5. Then choose the nearest standard value for the base resistor.
6. Finally, remember that if the load is a motor or relay coil a protection diode is
required .
2.4 Relay
Fig 2.15 : Relay Schematic And Real Relay.
A relay is an electrically operated switch. Current flowing through the coil of
the relay creates a magnetic field which attracts a lever and changes the switch
contacts. The coil current can be on or off so relays have two switch positions and
most have double throw (changeover) switch contacts as shown in the diagram.
Relays allow one circuit to switch a second circuit which can be completely separate
from the first. For example a low voltage battery circuit can use a relay to switch a
24
230V AC mains circuit. There is no electrical connection inside the relay between the
two circuits, the link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V
relay, but it can be as much as 100mA for relays designed to operate from lower
voltages. Most ICs (chips) cannot provide this current and a transistor is usually used
to amplify the small IC current to the larger value required for the relay coil. The
maximum output current for the popular 555 timer IC is 200mA so these devices can
supply relay coils directly without amplification. Relays are usually SPDT or DPDT
but they can have many more sets of switch contacts, for example relays with 4 sets of
changeover contacts are readily available.
2.4.1 Reed Relays
Reed relays consist of a coil surrounding a reed switch. Reed switches are
normally operated with a magnet, but in a reed relay current flows through the coil to
create a magnetic field and close the reed switch.
Reed relays generally have higher coil resistances than standard relays (1000
for example) and a wide range of supply voltages (9-20V for example). They are
capable of switching much more rapidly than standard relays, up to several hundred
times per second; but they can only switch low currents (500mA maximum for
example).
2.4.2 Solid State Relay (SSR)
A solid state relay (SSR) is an electronic switch, which, unlike an
electromechanical relay, contains no moving parts. The types of SSR are photo-
coupled SSR, transformer-coupled SSR, and hybrid SSR. A photo-coupled SSR is
controlled by a low voltage signal which is isolated optically from the load. The
control signal in a photo-coupled SSR typically energizes an LED which activates a
photo-sensitive diode. The diode turns on a back-to-back thyristor, silicon controlled
rectifier, or MOSFET transistor to switch the load.
25
Fig 2.16 : Bi-Directional Solid State Relay With Opto-Isolation.
Voltage applied to the control line of an SSR causes the LED to shine on the
photo-sensitive diode. This produces a voltage between the MOSFET source and its
gate, causing the MOSFET to turn on. An SSR based on a single MOSFET, or
multiple MOSFETs in a paralleled array works well for DC loads.
There is an inherent substrate diode in all MOSFETs that conducts in the
reverse direction. This means that a single MOSFET can't block current in both
directions. For AC (bi-directional) operation, two MOSFETs are arranged back to
back with their source pins tied together. Their drain pins are connected to either side
of the output. The substrate diodes then are alternately reverse biased in order to block
current when the relay is off. When the relay is on, the common source is always
riding on the instantaneous signal level and both gates are biased positive relative to
the source by the photo-diode.
It is common to provide access to the common source so that multiple
MOSFETs can be wired in parallel if switching a DC load. There is also commonly
some circuitry to discharge the gate when the LED is turned off, speeding the relay's
turn-off.
26
2.4.2.1 Advantages over mechanical relays
SSRs are faster than electromechanical relays; their switching time is
dependent on the time needed to power the LED on and off, on the order of
microseconds to milliseconds
Increased lifetime due to the fact that there are no moving parts, and thus no
wear
Clean, bounce less operation
Decreased electrical noise when switching
Can be used in explosive environments where a spark must not be generated
during turn-on
Totally silent operation
Smaller than a corresponding mechanical relay.
Can continue to operate while subjected to severe vibration.
2.4.2.2 Disadvantages
Fail short more easily than electro-mechanical relays
Increased electrical noise when conducting
Higher impedance when closed (-> heat production)
Lower impedance when open
Reverse leakage current when open (µA range)
Possibility of false switching due to voltage transients
Isolated bias supply required for gate charge circuit
Higher Transient Reverse Recovery time (TRR) due to the presence of Body
diode .
27
2.5 Timer 555 / 556
The 8-pin 555 timer must be one of the most useful ICs ever made and it is
used in many projects. With just a few external components it can be used to build
many circuits, not all of them involve timing! A popular version is the NE555 and this
is suitable in most cases where a '555 timer' is specified. The 556 is a dual version of
the 555 housed in a 14-pin package, the two timers (A and B) share the same power
supply pins. The circuit diagrams on this page show a 555, but they could all be
adapted to use one half of a 556. Low power versions of the 555 are made, such as the
ICM7555, but these should only be used when specified (to increase battery life)
because their maximum output current of about 20mA (with a 9V supply) is too low
for many standard 555 circuits. The ICM7555 has the same pin arrangement as a
standard 555.
The circuit symbol for a 555 (and 556) is a box with the pins arranged to suit
the circuit diagram: for example 555 pin 8 at the top for the +Vs supply, 555 pin 3
output on the right. Usually just the pin numbers are used and they are not labeled
with their function. The 555 and 556 can be used with a supply voltage (Vs) in the
range 4.5 to 15V (18V absolute maximum). Standard 555 and 556 ICs create a
significant 'glitch' on the supply when their output changes state. This is rarely a
problem in simple circuits with no other ICs, but in more complex circuits a
smoothing capacitor (e.g. 100µF) should be connected across the +Vs and 0V supply
near the 555 or 556.
The input and output pin functions are described briefly below and there are fuller
explanations covering the various circuits:
Astable - producing a square wave
Monostable - producing a single pulse when triggered
Bistable - a simple memory which can be set and reset
Buffer - an inverting buffer (Schmitt trigger)
28
2.5.1 Inputs Of 555/556
Fig 2.17 : Timer 555 and 556 Input/output Pin and Pin Assignment.
Trigger input: when < 1/3 Vs ('active low') this makes the output high (+Vs). It
monitors the discharging of the timing capacitor in an astable circuit. It has a high
input impedance > 2M .
Threshold input: when > 2/3 Vs ('active high') this makes the output low (0V)*. It
monitors the charging of the timing capacitor in astable and monostable circuits. It has
a high input impedance > 10M .
* providing the trigger input is > 1/3 Vs, otherwise the trigger input will override the
threshold input and hold the output high (+Vs).
Reset input: when less than about 0.7V ('active low') this makes the output low (0V),
overriding other inputs. When not required it should be connected to +Vs. It has an
input impedance of about 10k .
Control input: this can be used to adjust the threshold voltage which is set internally
to be 2/3 Vs. Usually this function is not required and the control input is connected to
29
0V with a 0.01µF capacitor to eliminate electrical noise. It can be left unconnected if
noise is not a problem. The discharge pin is not an input, but it is listed here for
convenience. It is connected to 0V when the timer output is low and is used to
discharge the timing capacitor in astable and monostable circuits.
2.5.2 Output Of 555/556
Fig 2.18 : Timer 555 Sinking And Sourcing Test.
The output of a standard 555 or 556 can sink and source up to 200mA. This is
more than most ICs and it is sufficient to supply many output transducers directly,
including LEDs (with a resistor in series), low current lamps, piezo transducers,
loudspeakers (with a capacitor in series), relay coils (with diode protection) and some
motors (with diode protection). The output voltage does not quite reach 0V and +Vs,
especially if a large current is flowing. To switch larger currents you can
connect a transistor.
The ability to both sink and source current means that two devices can be
connected to the output so that one is on when the output is low and the other is on
when the output is high. The top diagram shows two LEDs connected in this way.
This arrangement is used in the Level Crossing project to make the red LEDs flash
alternately.
30
Fig 2.18 : Timer 555 Output Protection Diode.
Like all ICs, the 555 and 556 must be protected from the brief high voltage
'spike' produced when an inductive load such as a relay coil is switched off. The
standard protection diode must be connected 'backwards' across the relay coil as
shown in the diagram.
However, the 555 and 556 require an extra diode connected in series with
the coil to ensure that a small 'glitch' cannot be fed back into the IC. Without this
extra diode monostable circuits may re-trigger themselves as the coil is switched off!
The coil current passes through the extra diode so it must be a 1N4001 or similar
rectifier diode capable of biasing the current, a signal diode such as a 1N4148 is
usually not suitable.
31
2.5.3 Timer 555/556 Monostable Circuit.
Fig 2.19 : Timer 555 Monostable Circuit With Manual Trigger
A monostable circuit produces a single output pulse when triggered. It is called a
monostable because it is stable in just one state: 'output low'. The 'output high' state is
temporary. The duration of the pulse is called the time period (T) and this is
determined by resistor R1 and capacitor C1:
T = 1.1 x R1 x C1 (2-5)
T = time period in seconds (s)
R1 = resistance in ohms ( )
C1 = capacitance in farads (F)
The maximum reliable time period is about 10 minutes.
Why 1.1? The capacitor charges to 2/3 = 67% so it is a bit longer than the
time constant (R1 × C1) which is the time taken to charge to 63%.
Choose C1 first (there are relatively few values available).
Choose R1 to give the time period you need. R1 should be in the range 1k to
1M , so use a fixed resistor of at least 1k in series if R1 is variable.
Beware that electrolytic capacitor values are not accurate, errors of at least
20% are common.
32
Beware that electrolytic capacitors leak charge which substantially increases
the time period if you are using a high value resistor - use the formula as only
a very rough guide!
For example the Timer Project should have a maximum time period of 266s
(about 4½ minutes), but many electrolytic capacitors extend this to about 10
minutes!
Fig 2.20 : Timer 555 Monostable Timing Diagram.
2.5.3.1 Monostable Operation
The timing period is triggered (started) when the trigger input (555 pin 2) is
less than 1/3 Vs, this makes the output high (+Vs) and the capacitor C1 starts to
charge through resistor R1. Once the time period has started further trigger pulses are
ignored.
The threshold input (555 pin 6) monitors the voltage across C1 and when this
reaches 2/3 Vs the time period is over and the output becomes low. At the same time
discharge (555 pin 7) is connected to 0V, discharging the capacitor ready for the next
trigger.
33
The reset input (555 pin 4) overrides all other inputs and the timing may be
cancelled at any time by connecting reset to 0V, this instantly makes the output low
and discharges the capacitor. If the reset function is not required the reset pin should
be connected to +Vs.
2.5.3.2 Power-On Reset Or Trigger
It may be useful to ensure that a monostable circuit is reset or triggered
automatically when the power supply is connected or switched on. This is achieved by
using a capacitor instead of (or in addition to) a push switch as shown in the diagram.
The capacitor takes a short time to charge, briefly holding the input close to
0V when the circuit is switched on. A switch may be connected in parallel with the
capacitor if manual operation is also required. This arrangement is used for the trigger
in the Timer Project.
Fig 2.21 : Power-On Reset Or Trigger Circuit
2.5.3.3 Edge-Triggering.
If the trigger input is still less than 1/3 Vs at the end of the time period the
output will remain high until the trigger is greater than 1/3 Vs. This situation can occur
if the input signal is from an on-off switch or sensor.
34
The monostable can be made edge triggered, responding only to changes of
an input signal, by connecting the trigger signal through a capacitor to the trigger
input. The capacitor passes sudden changes (AC) but blocks a constant (DC) signal.
For further information please see the page on capacitance. The circuit is 'negative
edge triggered' because it responds to a sudden fall in the input signal. The resistor
between the trigger (555 pin 2) and +Vs ensures that the trigger is normally high
(+Vs).
Fig 2.22 : Edge-Triggering Circuit
CHAPTER 3
PROJECT METADOLOGY
3.0 Introduction.
From the figure 3.1, a block diagram of the project the system can be divided into four
major section . The main major section are :
a. PIR Sensor Circuit .
b. Reed Switch Sensor Circuit.
c. Main Controller Circuit.
d. Light on/off and Power Supply Circuit.
FL
OR
EC
EN
T L
IGH
T C
IRC
UIT
+5V DC L N
LOUT
6A
MC
B
AC
240V
PASIVE
INFRARED
SENSOR
( PIR 2 )
PASIVE
INFRARED
SENSOR
( PIR 1 ) LIGHT ON / OFF
CONTROL AND
POWER SUPPLY
CIRCUIT
12V DC
PIR1 IN
PIR2 IN
ELECTRICAL
DISTRIBUTION
BOARD
SWI TO SW6 SENSE
SIGNALREED SWITH
SENSOR
( SW1 TO SW6 )
CONTROLLER
LIV
E IN
LIVE
OUT
NEUTR
AL
AUTOMATIC TOILET LIGHT ON / OFF MAIN BLOCK DIAGRAM
Fig 3.1 : Project System Block Diagram.
36
3.1 Project Development Stage.
The development of the project are divided into a few major stage, where in
each stage have a specific job and testing to be done. In figure 3.2 shows the stage of
development for the project.
PROBLEM DISCRIPTION
AND ISUE
ANALYSE AND FINDING
SOLUTION METHOD
CIRCUIT DESIGN AND
SIMULATE EACH SUB
CIRCUIT
ASSEMBLE THE CIRCUIT
GET DATA AND SYSTEM
BEHAVIOR
PART AND COMPONENT
PROCUMENT
TEST EACH SUB CIRCUIT
ASSEMBLE AND TEST THE
CIRCUIT AT REAL
LOCATION
COMBINE AND TEST
CIRCUIT AS FULL SYSTEM
CIRCUIT
TROUBLESHOOTI
NG
START
END
YES
NO
NO
NO
YES
YES
YES
Fig 3.2 : Project Development Flow Chart.
37
The project are mainly are to solve the problems occurs that had been explain
detailed in chapter 1. From the problem the user ( ILP Nibong Tebal ) had define its
mains requirement of the project, where it was the light inside the toilet only turn on
during people exist inside the toilet and turn off automatically when user left the
toilet. The user also request to use as minimum cost for the project due to the number
of toilet that required to be installed for the whole ILP Nibong Tebal.
From the main objective of the project, a few solution had been develop for
solving the problem. The first solution is to use counting method to define and
identify if any people still exist inside the toilet. Where in this method the number of
user will be counted and light still remains on if the counter still not zero. This
method are possible to be done, but after some development process the result shows
that some errors exist on its operation and there are to many condition to take care on
human behavior. Due to this solution seems still have a lot of development and
research need to be done, especially in the controller firmware program. The
development time required will not fit with the psm2 schedule.
Because of the errors and development time , the project switch to the second
alternative , where the existing of toilet user will indentify by motion and when the
door are close at sub toilet area. When the alternative had been chosen, the design
stage of are begin. During the design stage of the circuit, the input of the sensing
circuit with the output of a controller will be define trough the truth table and
karnough map. Where in the truth table and karnough map , the equation for the
output can be seen clearly. The circuit will drawn and after that it will simulate to see
the output response. To simulate the circuit, the software that are using is Circuit
Simulator Ver1.7. Where this simulator software are free license type and using Java
programming. The reason of choosing this type of simulator because of :
1. It was open source type of software and there is no license required to run
the software.
2. Simple and easy to use , that did not required to many setting must be set
before the simulation can be run.
3. The output can be select either in voltage , logic high / low and using led
or light.
38
The simulation output can be seen in figure 3.3 shows the simulation output
for controller circuit and figure 3.4 shows the simulation output for light on/off
circuit.
Fig 3.3.1 : Zone 1 Sensing Circuit
Fig 3.3.2 : Main Controller Simulation
39
Fig 3.4 : Light On/Off Controller Simulation.
Procument process will start after all simulation circuit give the outputs as
desired. Most of the component can be found at local component seller, only for the
PIR are quite difficult to find. For this project I had use the complete PIR module
from Cytron Technology at Taman Universiti, Skudai Johor. Below are the table list
of all component that are using in the project.
After all component had complete it will assemble to a board. In this project , I
use the Vero board. This the fast method on develop the prototype circuit compared
with PCB, where some extra process required that will effect my schedule. After that
the circuit will test portion by portion and the data of the test result will be discuss
detail on Chapter 5 : Result And Discussion. Figure 3.5 & figure 3.6 show the
picture of the circuit that had been assembled.
40
Table 3.1 : Automatic Toilet Visitor On/Off Light Control Component List.
PROJECT BILL OF MATERIAL
NO. COMPONENT QUANTITY PRICE/UNIT TOTAL PRICE
1 RESISTOR 1/4W 10% 560Ω 8 RM 0.05 RM 0.40
2 RESISTOR 1/4W 10% 3.9KΩ 3 RM 0.05 RM 0.15
3 RESISTOR 1/4W 10% 10KΩ 1 RM 0.05 RM 0.05
4 RESISTOR 1/4W 10% 1KΩ 1 RM 0.05 RM 0.05
5 TRANSISTOR BC337 3 RM 0.30 RM 0.90
6 LED 3MM GREEN 8 RM 0.20 RM 1.60
7 ELECTROLITIC CAPASITOR 100uF , 16V 1 RM 0.30 RM 0.30
8 ELECTROLITIC CAPASITOR 10uF , 16V 1 RM 0.30 RM 0.30
9 ELECTROLITIC CAPASITOR 4.7uF , 16V 5 RM 0.20 RM 1.00
10 CERAMIC CAPASITOR 0.1uF , 16V 8 RM 0.50 RM 4.00
11 IC 74LS32 - QUAD OR GATE 2 RM 1.40 RM 2.80
12 IC 74HC14 - NOR GATE 2 RM 2.00 RM 4.00
13 IC LM555 - TIMER 1 RM 1.00 RM 1.00
14 IC LM7805 – REGULATOR +5V 1 RM 1.50 RM 1.50
15 IC LM7812 – REGULATOR +12V 1 RM 1.50 RM 1.50
16 BRIDGE RECTIFIER 5A 1 RM 3.00 RM 3.00
17 PIR SENSOR MODULE ( CYTRON TECH. ) 2 RM 38.00 RM 76.00
18 REED SWITCH SENSORS 6 RM 5.00 RM 30.00
19 TRANSFORMERS 240V – 12V , 7VA 1 RM 12.00 RM 12.00
20 201 SERIES CONNECTOR 3WAY 3 RM 1.00 RM 3.00
21 201 SERIES CONNECTOR 6WAY 3 RM 1.50 RM 4.50
22 IC SOCKET 14 PIN 4 RM 0.20 RM 0.80
23 IC SOCKET 8 PIN 1 RM 0.20 RM 0.20
24 SPACER 10MM SCREW NUT 15 RM 0.55 RM 8.25
25 VERO BOARD 2 RM 2.50 RM 5.00
26 PLASTIC CASING 1 RM 5.00 RM 5.00
TOTAL PROJECT COST RM 167.30
41
ZONE 2 INPUT AND
INDICATOR
ZONE 1 INPUT AND
INDICATOR
ZONE 2 CONTROLLER
ZONE 2 TIMER
LIGHT CONTROLLER
CIRCUIT
Fig 3.5 : Main Controller Circuit Board.
STEPDOWN
TRANSFORMER
POWER SUPPLY
CIRCUIT
LIGHT ON/OFF RELAYLIGHT ON/OFF
CONTROL CIRCUIT
Fig 3.6 : Light On/Off Controller Circuit Board.
When each sub module had given the required outputs result, latter it will be
assemble as a fully system. In each sub circuit the connector had been use to make
easier to disconnected in between the module. At full system, the circuit will be tested
again to check either it was fully functional. The system also had been assemble to the
real problems location and the operation of the system are monitored and the response
of the system can see clearly during this test.
CHAPTER 4
SYSTEM AND CIRCUIT OPERATION
4.0 Introduction.
From the figure 4.1, a system block diagram of the project, it can be divided
into four major section . The main major section are :
a. PIR Sensor Circuit .
b. Reed Switch Sensor Circuit.
c. Main Controller Circuit.
d. Light on/off and Power Supply Circuit.
FL
OR
EC
EN
T L
IGH
T C
IRC
UIT
+5V DC L N
LOUT
6A
MC
B
AC
240V
PASIVE
INFRARED
SENSOR
( PIR 2 )
PASIVE
INFRARED
SENSOR
( PIR 1 ) LIGHT ON / OFF
CONTROL AND
POWER SUPPLY
CIRCUIT
12V DC
PIR1 IN
PIR2 IN
ELECTRICAL
DISTRIBUTION
BOARD
SWI TO SW6 SENSE
SIGNALREED SWITH
SENSOR
( SW1 TO SW6 )
CONTROLLER
LIV
E IN
LIVE
OUT
NEUTRAL
AUTOMATIC TOILET LIGHT ON / OFF MAIN BLOCK DIAGRAM
Fig 4.1 : Project System Block Diagram.
43
The main operation of the circuit is to turn on/off the toilet light automatically
based on present of the toilet user. When user entering or inside the toilet, the light
will turn on automatically. When user left the toilet, the light will turn off
automatically after a few second he/she left the toilet.
The sensor that being use for the system are the PIR sensor, for motion
detector and the reed switch sensor for open or close of the sub toilet door. For the
PIR sensor it was detect the motion of visitor in the main toilet and the reed switch is
detect the door closing inside the sub toilet area. PIR sensor will giving high output
pulse (+5V) when it detected a motion, while the reed switch will giving low signal
(0V) when the sub toilet door are close.
The controller will read the signal from the sensing circuit and verify either it
need to turn on/off the light. When controller receive high signal from PIR sensor or
low signal from reed switch , it identify as a visitor are inside the toilet and will giving
high output voltage to light on/off controller to turn on the light.
The light on/off controller are the main interface to the lighting circuit of the
toilet. It was the main who control to turn on or off the light, by close or open the
relay that replace the light switch. When it receive the signal high from main
controller , it will turn on the relay from NC – normally close to NO – normally open
to turn on the light. This section also are the main who provided the supply voltage
for the main controller and the sensing circuit.
The whole operation of the system can be simplified as bellow:
a. When the visitor entering to the toilet , their motion and movement will
detected by the PIR sensor and the system will turn on the light.
b. When the visitor enter the sub toilet are it required to close the toilet door. The
reed switch sensor will turn on and the light will remain on until the sub toilet
door are open. But the light will not turn off just the reed switch become
open, there is the delay timer in controller will keep the light still on until a
few second.
44
c. When the visitor walk tough the main toilet area , it again detected by PIR
sensor. When the visitor left the toilet the light are still remain on a few second
before the light automatically turn off.
4.1 Sensing Circuit.
The figure 4.2 below shows the sensing circuit area for the toilet, where it was
divided into 2 sensing zone. The sensing zone 1 are the open area at the main toilet
and sensing zone 2 are the sub toilet are.
Fig 4.2 : Sensing Zone Area.
45
4.1.1 Sensing Zone 1.
This is the Sensing zone for the open area inside the main toilet, where the
user will use the mirror and the sink. Basically the sensor are purpose to detect any
movement or motion that exist in the area when the user walking or using the sink and
mirror. The sensor that being use in this area is the PIR – Passive Infra Red Sensors,
(PIR ) PASIVE INFRARED SENSOR
MODULE
FRESNELL LENS
Fig 4.3 : The PIR Sensors Module.
The PIR sensor has three wires, which should be connected to the main
controller circuit as follows:
- GND - Connects to Ground
OUT - Output Connects to an I/O pin set to INPUT mode (or
transistor/MOSFET)
+ VCC - Connects to Vcc (+5V to + 20V) @ ~100uA
The PIR sensor gives a simple on/off signal. When it is triggered, it will read
high for approximately one second. When the sensor is triggered for an extended
period of time, it will continue to read high until no movement is detected. This
module can set to be triggered in two modes.
46
H Retrigger - Output remains HIGH when sensor is retriggered repeatedly. Output
results in repeated HIGH/LOW pulses. Output is LOW when idle.
L Normal - Output goes HIGH then LOW when triggered. Continuous motion is
LOW when idle (not triggered).
In this project the sensor are set in H Retriggering because it required to
always remaining at high logic pulse when there is any motion detected. The PIR
Sensor requires a „warm-up‟ time in order to function properly. This is due to the
settling time involved in „learning‟ its environment. This could be anywhere from 10-60
seconds. During this time there should be as little motion as possible in the sensors field
of view. There is a variable resistor (Delay Time) on the PIR sensor to control the „ON‟
delay time for the sensor. Turning the variable resistor clockwise will give longer „ON‟
delay time while turning anticlockwise with reduce the „ON‟ delay time.
The PIR Sensor has a range of approximately 5 meters. The PIR sensor can
sense object up to 120° within 1 meter range. The sensitivity can vary with
environmental conditions. The sensor is designed to adjust to slowly changing
conditions that would happen normally as the day progresses and the environmental
conditions change, but responds by making its output high when sudden changes occur,
such as when there is motion.
Fig 4.3 : The PIR Sensors Module Retriggering Jumper and Delay Adjust.
The PIR Module output are connected directly to the PIR connector at the
main controller that labeled as PIR1 and PIR2.
47
4.1.2 Sensing Zone 2.
The zone 2 sensing are the area to detect the existing of visitor that using the
sub toilet area. The main component that being use to sensing the visitors inside the
sub toilet area is the reed switch. The reed switch sensor is the type of switch that
operates by the magnetic fields. The sensor it self are divided into two component, it
is the reed switch and the reed magnet. The reed magnet actually are the permanent
magnet and its is use to change the switch from open to close condition.
The type can be Single Pole Single Throw (SPST) or Single Pole Double
Throw (SPDT). In this project both type can be use as the sensing , because the
circuit only required to detect either the switch are turn on or off.
When there is no user, the door are open and the reed magnet is away from the
reed switch and the switch are open. When the door are close the reed magnet are near
to the reed switch and the magnetic field from the reed magnet change the switch
position to close. Figure 4.4 below show the both condition of the reed switch at the
sub toilet door.
REED MAGNET
REED
SWITCH
B. DOOR CLOSE
SWITCH CLOSE
REED
SWITCH
A. DOOR OPEN
SWITCH OPEN
Fig 4.4 : The Reed Switch Condition During Door Open or Close.
48
The reed switch pin COMM are connected to ground of the circuit and pin NC
connected to input sensing at the main controller. Figure 4.5 below shows the zone 2
schematic and the switch output voltage condition . The reed switch and reed magnet
are mounting at the sub toilet door , while the resistor and led are paced at main
controller board.
5
60
56
0
56
0
56
0
56
0
56
0
SW1
SW2
SW3
SW4
SW5
SW6
+5V
GND
RE
ED
SW
ITC
H 1
RE
ED
SW
ITC
H 2
RE
ED
SW
ITC
H 3
RE
ED
SW
ITC
H 4
RE
ED
SW
ITC
H 5
RE
ED
SW
ITC
H 6
Fig 4.5 : Zone 2 Sensing Circuit.
49
GNDGND
VCCVCC
SW1 SW1REED SWITCH
AT OPEN
CONDITION
WHEN THE
DOOR ARE
OPEN
REED SWITCH
AT CLOSE
CONDITION
WHEN THE
DOOR ARE
CLOSE
LED
INDICATOR
Fig 4.6 : Zone 2 Sensing Output Voltage.
When the door are open , the output of sensing are at logic high (+5v) , there
are no current trough the resistor and the led. When the door are close, the reed
magnet will cause the switch change to close position. The sensing output will
connected to ground and cause the output change to low (0v). The flow trough the
resistor and the led indicator will light up.
4.2 Main Controller Circuit.
The function of the main controller is to identify the existing of the visitor in
the toilet and command the light controller circuit to turn ON the light. Main
controller actually can be divided into tree main section, zone 1 identification circuits,
zone 2 identification circuits and main control circuit. Figure 4.7 below shows the
schematic circuit of the main controller.
REED MAGNET
REED SWITCH
SENSOR
50
Fig 4.7 : Main Controller Circuit.
Zone 1 identification circuit will read the input signal from both PIR sensor
and giving logic output high (+5v) at ZONE1 test point when either one are triggered.
The output at ZONE1 test point will at high (+5v) if the motion are detected by the
PIR sensor and this are identify there is a visitor inside the toilet and the light are turn
ON. This circuit also include the input led circuit , to visualize with PIR are active by
light up the led when receive high input signal.
Zone 2 identification circuit will read the input from the reed switch sensor,
and the output of the Zone 2 are at high (+1.2v) when there is no user at zone 2. When
there is a user at zone 2 toilet the signal will turn to low (0v), this signal will feed to
an inverter to invert back to high (+5v) by using 74HC14 ( Inverter Logic Gates). This
circuit are required to use the CMOS type of IC due to the leakage current when using
the TTL type IC. Figure 4.8 shows the full schematic circuit for the zone 2
identification circuit and figure 4.9 shows the zone 2 timer circuit.
51
U1C
U1A
U1B
U1D
U2A
U2B
ZONE 2
OUTPUT
TIMER
SW1
SW2
SW3
SW4
SW5
SW6
Z2A
ZONE2
U1 & U2 = 74HC32 ( QUAD OR
GATES )
Z2B
Fig 4.8 : Zone 2 identification Circuit.
Z2A
Z2B
Fig 4.9 : Zone 2 Timer Circuit.
The timer are using the 555 timer in monostable mode operation and the main
function is to provide the delay for the ZONE 2 output . When there is no user inside
the sub toilet are , the test point SW1 – SW6 are at logic high ( +1.2v) . The inverter
will change to the logic low (0v) at U1A, U1B and U1C input. When all input are
logic low it will give all the output also low and logic low at Z2A test point. This also
give low output at the Z2B after the timer circuit.
52
When there is a user go inside the sub toilet area, for an example at toilet no 3
and the reed switch signal at SW3. When user close the toilet door the reed switch
will change to close position and will giving an output logic low at SW3 signal. The
inverter will invert the logic level become logic high (+5v) at the input of U1B. When
there is logic high , the output of U1B, U1D and U2A will become logic high(+5v).
The output U2A at logic high also giving logic high at the input of the timer circuit.
The output of the timer circuit Z2B , will still at logic low because the circuit only
trigger when there is changes from logic high(+5v) to logic low(0v). When the input
Z1A at logic High(+5v) it will cause the ZONE 2 output at logic high(+5V) and the
controller will turn on the light.
When user left the sub toilet the SW3 signal will change to high (+1.2V) and
after the inverter will goes to logic low (0v). Its also cause the output U2A at test
point Z2A change to logic low(0v). When the timer detect the changes from
high(+5v) to low (0v) it will trigger the circuit and giving the high (+5v) output pulse
at Z2B. The high (+5v) output pulse will keep the ZONE 2 output remain at high
(+5v) until the pulse goes to low. This will keep the light remain on after user left the
sub toilet until a few second it will turn off automatically. The time of the pulse are
depend on the resistor 1K and the capacitor 100uF at the timer circuit. The time of the
timer are using the equation T = 1.1 X RXC , so the timer pulse in this project are
T = 1.1 x 1K x 100uF
= 0.11 second
The delay time can be adjust to make it more logger time by change the value
of the resistor and the capacitor.
The main controller output is depend on the input from ZONE 1 and ZONE 2
signal, this two input will attach to the OR gate that control the LIGHT ON/OFF
signal. When ZONE 2 and ZONE 1 at low (0v) the LIGHT ON/OFF signal also at
logic low (0v) and the light are turn OFF. When either one of the ZONE 1 or ZONE 2
at logic high (+5v) the LIGHT ON/OFF output will also at logic high (+5v) and the
light will turn ON. Table 4.1 below shows the truth table of the controller input and
output.
53
Table 4.1 : The Main Controller Truth Table.
NO. SW1 – SW6 PIR1 / PIR2 ZONE 1 ZONE 2 LIGHT
ON/OFF LIGHT
1 OPEN 0 0 0 0 OFF
2 CLOSE 0 0 1 1 ON
3 OPEN 0 0 1 UNTIL 0.1
SEC 1 UNTIL 0.1 SEC
ON UNTIL 0.1 SEC
4 OPEN 0 0 0 0 OFF
5 OPEN 1 1 0 1 ON
6 OPEN 0 0 0 0 OFF
4.3 Light On/Off Controller.
This part of the system are mainly the one that to control the ON/OFF of the
light. Due to the different voltage type and the value of the voltage where the output
of the main controller are in +5v DC but the lighting circuit are using the 240v AC, so
this circuit required to isolate and ensure the controller can control the lighting circuit.
This circuit are required to turn ON/OFF the relay that replace the light switch. In
this circuit are also include the power supply circuit to supply the DC for the
operating of the other circuit like the main controller and sensing circuit. The AC
supply for the light will be take as a input AC supply for the power supply circuit and
the circuit will provide two supply DC voltage, +5v DC and +12v DC. The +5v DC
are required for the most component in the system especially for the IC. The +12v DC
are required to supply an operating voltage for the PIR sensor and the Relay. Figure
4.10 shows the light on/off controller schematic circuit.
54
Fig 4.10 : Light On/Off Controller Circuit.
The main component that being use in the power supply circuit is the Bridge
Rectifier, 78XX series regulator IC and the Capacitors. The main component for the
light controller is using the general purpose transistor BC337 and the Relay.
When the Main Controller giving logic low (0v) at the LIGHT ON/OFF input
signal , there is no voltage for biasing the transistor to turn on. When the transistor are
off , there is no current flow trough the relay coil and the relay switch are remain at
NC position. The lighting circuit are in open condition and the light are OFF.
When the Main Controller giving logic high (+5v) at the LIGHT ON/OFF
input signal, the base of the transistor will get the biasing voltage (VBE) that will
turn ON the transistor. When the transistor turn ON , current will flow trough the
transistor to the ground and the current from VCC supply will flow trough the relay
coil. This will make the coil will energize and there is magnetic fields exist in the coil.
The magnetic fields will energize from NC position to NO position, this will make the
lighting circuit at close condition and the light will turn ON.
55
Because of the nature of the inductive relay coil, when the transistor turn OFF
, the voltage across the coil will rise rapidly. This is because of the energy stored in
the magnetic fields is returned to the circuit. A protection diode will required to be
connected across the relay coil to clamp the magnetic fields at 0.6v above the supply
rail. This will protect the transistor from over voltage breakdown and cause
permanent damage to it.
The relay that need to be use in this project the relay contact should be able to
handle the lighting current. It must be calculated carefully to chose the type of the
relay need to be use. If the current are bigger , the mechanicals relay can be replace
with a Solid State Relay type where it can handle more bigger current and more
reliable.
CHAPTER 5
TESTING AND RESULT
5.0 Introduction.
Testing of the circuit is an important part of development in this project ,
result of the testing will shows either the project functional or not and what other
modification are required. During the implementation of the project, testing process
are divided in to a few part it is :
a). Light On/Off Controller Circuit Test.
b). Sensing Circuit Test
c). Main Controller Circuit Test.
d). Full System Integrate Test.
e). On Location Test.
All the testing are done part by part is to ensure al the circuit are working and
functional as required. Before it was assemble as a system the, during each sub circuit
test got any modification and repair are required it can be known early. The first
circuit that being assemble ad test are the Light On/Off controller, it is because this
circuit are the one that control the lighting circuit and it also provide the DC supply
voltage to the other circuit.
Most of the result of the testing are the voltage level in each test point and also
indicator to the light either ON/OFF. The main equipment that are being use is a
Digital Multimeter.
57
5.1 Light On/Off Controller Circuit Test.
The requirement of the testing for this circuit is to identify the Power Supply
voltage and identify the capability of the On/Off circuit to control the AC load . For
the Power Supply Circuit, the test are to measure the supply voltage for +12V and
+5V supply. This are required to ensure the voltage that being supply to other circuit
are correct and will not damage the component especially the IC. Figure 5.1 below
shows the connection during the testing process.
LIGHT ON/OFF
CONTROLLER
+12V
+5V
GND
LIGHT
ON/OFF
1
2
3
L N
LIGHT
AC 240V
Fig 5.1 : Light On/Off Controller Circuit Test.
Table 5.1 Below show the test result 1 and 2 for the power supply voltage
measurement. From the result shows that the voltage level are same as the design.
Table 5.1 : +12V And +5V Voltage Measurement Result.
No. Voltage Supply Measurement Voltage Result
1 +12V +11.83V Ok
2 +5V +5.2V Ok
58
After supply voltage had been confirm correctly, next is the testing of the
On/Off control circuit. In this test the +5V supply will short to Light On/Off input
signal. This action are to simulate the controller output where in logic high (+5V)
when command to turn on the light. This is to make the transistor getting the biasing
voltage to turn on and energized the relay coil to close position.
From testing result shows, when +5V are attach to the Light On/Off input , the
light will turn ON. When it was remove from the input the light will turn OFF. From
the result, this circuit are functional as required.
5.2 PIR Sensor Testing.
In this PIR testing is to see the response of the PIR by the distance of
detection, angle of detection and material type of detection. Figure 5.2 below show
the connection of the PIR sensors are attach to the Light On/Off Controller for the
testing purposed.
LIGHT ON/OFF
CONTROLLER
+12V
+5V
GND
LIGHT
ON/OFF
L N
LIGHT
AC 240V
TARGET
MOVEMENT
PIR SENSORS
PIR OUTPUT
SIGNAL
Fig 5.2 : PIR Sensor Circuit Test.
59
When PIR are detected any motion in front of the lens, it circuit will giving
and high output pulse, it will trigger the Light On/Off Controller to turn ON the Light.
During then PIR was triggered the output pulse will be measured using multimeter
and the duration of triggered will be recorded. The subject also will be ask to move
until a few distance and angle from the PIR sensor to measured the maximum
detection angle and distance of the PIR.
The PIR also test for type of detection material, in this testing I was using the
plastic and metal move across the PIR lens. Table 5.2 below shows the result that had
been observe during the testing, and the figure 5.3 show the subject and the maximum
distance detection of the PIR sensor.
Table 5.2 : PIR Sensor Response.
No. Type Of Specification PIR Response
1 Triggering Voltage +3.3V
2 Max Delay Triggering Pulse 10 Second
3 Max Detection Range 6 Meters
4 Max Detection Angle 120 Degree
5
Type Of Object To Triggered
a. Plastic Not Triggered
b. Metal Triggered
c. Human Triggered
d. Insect Not Triggered
e. Mammals like Cats/Rats Triggered
60
Fig 5.3 : PIR Sensor Detection Range.
From the result above , the PIR sensor having a wide range of detection but
the problems is, it can be triggered by any material that having different heat from the
environment area and also by the small animal like rats or cat.
5.3 Reed Switch Sensor Testing.
The reed switch sensor are the one will mounted at the door of the sub toilet
area. During the testing its only to measured the voltage at the test point SW1 – SW6
during the door open and close. Figure 5.4 show the measuring point at the reed
switch sensor.
61
56
0
56
0
56
0
56
0
56
0
56
0
SW1
SW2
SW3
SW4
SW5
SW6
+5V
GND
RE
ED
SW
ITC
H 1
RE
ED
SW
ITC
H 2
RE
ED
SW
ITC
H 3
RE
ED
SW
ITC
H 4
RE
ED
SW
ITC
H 5
RE
ED
SW
ITC
H 6
Fig 5.4 : Reed Sensor Test.
From the testing the result show the sensor are at logic high (1.2V) during the
door open and low (0v) when the door close. Table 5.3 below the test result of the
reed switch sensor.
Table 5.3 : Reed Sensor Measurement Result.
No. Door Position Measurement Voltage Result
1 Open +1.2V Ok
2 Close 0V Ok
62
5.4 Main Controller Testing.
During the main controller testing, every test point will be measured the
voltage level. The sensor part are now connected to the main controller and the testing
done zone by zone. When testing the Zone 1 , the PIR are connected to the main
controller and the reed switch sensor at zone 2 all at open condition. When Zone 2
testing the PIR will take away from the main controller, and one of the reed switch are
in close condition. Table 5.4 – 5.6 show the test result of the main controller and
figure 5.4 show the test point on the main controller circuit.
Table 5.4 : Zone 1 Circuit Test Point Measurement Result.
Active PIR PIR1 Test Point PIR2 Test Point ZONE1 Test Point
PIR1 +3.3V 0V +5V
PIR2 0V +3.3V +5V
Table 5.5 : Zone 2 Circuit Test Point Measurement Result.
Active Switch
SW1 SW2 SW3 SW4 SW5 SW6 Z2A
Test Point Z2B
Test Point
ZONE2 Test Point
SW1 0V 1.2V 1.2V 1.2V 1.2V 1.2V +5V 0V +5V
SW2 1.2V 0V 1.2V 1.2V 1.2V 1.2V +5V 0V +5V
SW3 1.2V 1.2V 0V 1.2V 1.2V 1.2V +5V 0V +5V
SW4 1.2V 1.2V 1.2V 0V 1.2V 1.2V +5V 0V +5V
SW5 1.2V 1.2V 1.2V 1.2V 0V 1.2V +5V 0V +5V
SW6 1.2V 1.2V 1.2V 1.2V 1.2V 0V +5V 0V +5V
NONE 1.2V 1.2V 1.2V 1.2V 1.2V 1.2V 0V +5v
PULSE +5v
PULSE
Table 5.6 : Main Circuit Test Point Measurement Result.
ZONE 1 ZONE 2 LIGHT ON/OFF LIGHT
0V 0V 0V OFF
+5V 0V +5V ON
0V +5V +5V ON
63
Fig 5.5 : Main Controller Schematic And Test Point Location.
64
5.5 Full System Test.
After all subsystem already been verified functional, it will assemble as a full
system, during this stage it will be tested again to verified it was functional. In full
system all the above sub system will be connected together. In order to make the each
sun module easily to assemble and disconnected , in this project I use the connector
for the connection. Figure 5.5 below shows the picture of the project in fully system
integrated together.
Fig 5.6 : Project Full System Integration.
65
In the full system test , the project output result show same as desired
requirement. The PIR detect the motion until 6 meters around and when user close the
sub toilet door the light are remain ON. When user left the toilet, the light wait after a
few second to turn OFF. From the observation the maximum of delay time to turn off
the light is around 10 second.
5.6 On Location Test.
In order to see the real response of the project, it was assemble to the desired
location at one of the toilet in ILP Nibong Tebal. A Number of user had being ask to
become the test subject on testing the project.
ZO
NE
1 S
EN
SIN
GZ
ON
E 2
SE
NS
ING
MOTION DETECTION AREA
SWITCH SENSOR DETECTION AREA
REED
SWITCH
REED
MAGNET
SW1
PIR1
PIR2
PASIVE INFRARED MOTION
SENSOR
ZONE 2 SENSING AREAREED SWITCH SENSOR X 6
ANY SWITCH ON = PEOPLE EXIST
IN TOILET AREA AND LIGHT WILL
TURN ON UNTIL ALL SWITCH ARE
OFF.
ZONE 1 SENSING AREAPASIVE INFRERED SENSOR X 6
DETECT ON MOTION EXIST IN THE
AREA AND WILL TURN ON THE
LIGHT UNTIL THERE IS NO MOTION
DETECTED LIGHT WILL TURN OFF.
PIR SENSOR 1 PIR SENSOR 1 REED SWITCH SENSOR
Fig 5.7 :On Location Assembly And Test.
The result during the real testing shows the system is fully functional and
same as the full system testing. From the test result, the system are 100% functional
as desired application in the toilet of ILP Nibong Tebal.
CHAPTER 6
CONCLUSION
6.0 Conclusion.
During the development of the project, it was trained me on solving and
understand the system operation. The most critical in the project was during the
analyze the problems and to find the correct solution to solve the problem. During the
early stage of the project , I was proposed the different method to detect the existing
of the visitor in the toilet. Where in that time the existing of the visitor are detected by
direction of the movement either enter or leaving the toilet and counting the number
of visitor still exist to turn ON or OFF the toilet light.
But when the circuit had design for the solution are not working correctly, I
had found the method is not means impossible to apply but the time and budget are
limited me to continue on the method. There is still a lot of research and
developments need to be study to apply the solution especially on the microcontroller
programming.
Because of that the others solution are required to take place, and in the
second solution it was changing in the way of user detection. In the second solution I
was take the nature of the human behavior during using the toilet and divided the
detection area by two section based on the area of detection. For the main toilet area it
was an open space where it have the sink . By the nature user are always use the area
to wash hands and using the mirror to comb the hair. The movement during the
activities was detected by using the PIR sensor. The light will always on when the
PIR was triggered and will turn OFF if the PIR doesn‟t detect any motion in the area.
67
For the sub toilet area , by the nature during visitor using the toilet the toilet
door will be close. The closing of the toilet door will detect to identify the user are
exist in the area. So in all sub toilet area I was using the Reed switch sensor , where
the sensor switch will close condition when the door are close. But to ensure the door
keep open when there is no visitor inside the toilet it will required a devise that can
push the door remain open. For this application I had identify a mechanicals devise
by using spring to push back the door to remain open.
During the design stages , the simulation software had helping me a lot to
identify either the circuit are working and functional. It also help me a lot to identify
the circuit problem during trouble shooting stages of the project.
When the project had assemble to the problems location it was show the
positive response and functional as desired. But during the PSM2 demo , one of the
panel had asking about the men pee section area , where he had issue when user using
the area it required to move their head or hand to keep the light turn on. Because of
that I had suggest to using the other sensor to detect the existing of user in the area.
The sensor can be use is the IR Sensor that having an transmitter and receiver, when
the user place their self when using the area it will block the receiver to receive the IR
signal and this cause the receiver generate high logic output pulse to trigger on the
light.
6.1 Suggestion And Future Development.
From the result of the project I found that the PIR sensor are useful to solve a
lot of problem area especially to control the turn ON/OFF the light. It also can be use
to control the corridor light or the classroom light to make the electrical energy can be
safe. It also can be use to add in safety to the people when using the machine where in
one cased in the ILP one of the student hand had been cut bay the machine. There is a
lot of study and research can be done especially to make the PIR sensor on can be
triggered only by the human, because in current sensor its can be triggered by small
animals like cats or rats.
68
REFFERENCES
1. Glolab Corpration. (2003). Direction Sensing Infrared Motion Detector Sensor.
2. Marty Brown . (2001). Power Supply Cookbook. 2nd
Edition. Newness.
3. Boylested, R. & Neleskey, L. (1996). Electronic Device And Circuit Theory.1st Ed.
New Jersey. Prentice-Hall International.
4. Robert A. Peace , (1993). Trouble Shooting Analog Circuit. National
Semiconductor. Newness.
5. Cyril W. Lander. (1992). Power Electronic. 3rd
Edition. McGraw Hill Book
Company.
69
APPENDIX 1
Project Schematic
And
Project Component List
70
APPENDIX 2
Component Data Sheet
71
APPENDIX 3
PSM2 Presentation Slide