PROJECT ON STREET LIGHT CONTROL SYSTEM: BSc III YEAR
TH
19
(AFFILIATED TO BANGALORE UNIVERSITY) MAIN, 17th B CROSS, Sector-IV, HSR layout, Bangalore560102 DEPARTMENT OF COMPUTER SCIENCE PROJECT REPORT ON
STREETLIGHT CONTROL SYSTEM
Submitted in Practical Fulfillment of the Requirements for the degree Of
BACHELOR OF COMPUTER SCIENCE Submitted by Maheshraj (10RNS75060)
UNDER THE GUIDANCE OF Mrs.Gayathri Sudheer (Associate Professor)
THE OXFORD COLLEGE OF SCIENCE BENGALURU
(AFFILIATED TO BANGALORE UNIVERSITY)
19TH MAIN, 17TH B CROSS, Sector-IV, HSR layout, Bangalore560102 CERTIFICATE This is to certify that the project work entitled “STREETLIGHT CONTROL SYSTEM” has been successfully carried out by Maheshraj (10RNS75060) (10RNS75060) student of 6th semester B.Sc, submitted in the partial fulfillment of requirements prescribed by the Bangalore University for “BACHELOR “BACHELOR OF COMPUTER COMPUTER SCIENCE” course during the year 2012-2013
Under The Guidance Of Department
Head Head of the
Mrs.Gayathri Mrs.Gayathri Sudheer (Associate Professor) Electronics)
Sudheer (Department of
Signature of the Examiner Date: 1)
2
……………… ………………………… ………………… ………… … …………….
2) ………………………………………………….
ABSTRACT This project aims at designing and executing the advanced development in embedded systems for energy saving of street lights lights with 8051 Microcontroller, Microcontroller, light depending resistor and IR sensor. Now a days, human has become too busy and he is unable to find time even to switch OFF the lights wherever not necessary. This can be seen more effectively in the case of street lights. The present system of the project is like,only 50% of the street lights will be switched ON alternatively in the evening during sun sets using LDR.There will be an alternate light system, whenever the vehicle passes on the road it will be detected by IR sensor and and 50% of alternate alternate switched switched off lights will be switched ON, and the same lights will be switched OFF alternatively after the vehicles passes away. On the next day morning after there is sufficient sun light on the roads the 50% lights which are switched ON will be switched OFF automatically using LDR. With this, the power
3
will be saved up to some extent. This project gives the best solution for saving 10% to90% of electricity.
CONTENTS 1.INTRODUCTION •
Aim
•
Objectives
•
Motivations
•
Overview
2.THEORITICAL 2. THEORITICAL BACKGROUND BACKGROUND 3.PROJECT DESRCIPTION •
Block Diagram
•
Circuit Diagram
•
Flowchart
•
Components
4.DESIGN 4. DESIGN PROCEDURE PROCEDURE 5.FABRICATION 6.TESTING AND EVALUATION 7.CONCLUSION 7. CONCLUSION AND SCOPE OF FUTURE WORK 8.REFRENCES
CHAPTER-1 4
Introduction 1.1 AIM: The main aim of Automation of street light control system is:
To result in economy of operation.
Elimination Elimination of human error.
We know that the demand of electricity is very high than demand in our country so, Automatic street light monitoring and control is to save electricity.
To
save electricity which is very important for human
life.
1.2 LEARN LEARNING ING OBJECT OBJECTIVE IVES: S:
Development
on
MIC-89C51:
This
contains
automatic movement movement that can save human errors. 5
an
Impleme Implementati ntation on of importan importantt subjects subjects of engineeri engineering ng studies such as Embedded Systems, Control Systems, and Machines etc. to the fullest.
1.3 1.3 MOTI MOTIVA VATI TION ON::
The main consideration consideration in the present field technologies are Automation, Power consumption and cost effectiveness. Automation is intended to reduce man power with the help of intelligent systems. Power saving is the main
consideration
forever
as
the
source
of
the
power(Thermal, Hydro, Electric etc.,)are getting diminished due to various reasons.
The main aim of the project is Automation of street power saving system with LDR & IR sensor, this is to save the power. We want to save power automatically instead of doing manual. So its easy to make cost effectiveness. This saved power can be used in some other cases. So in villages, towns etc we can design intelligent system for the usage of street lights.
1.4 OVER VERVIEW: IEW:
6
An automatic control system is an arrangement of physical components connected in such a manner so as to direct or regular itself or some another system i.e. some controlled
condition
forming
part
of
the
system
is
maintained maintained in a prescribed manner. Automatic control system have influenced the current way of life. In recent year automatic control systems have been
rapidly
increasing
importance
in
all
fields
of
engineering. Its application covers a very wide range from design design of precis precisio ion n contro controll devic devices es to design design of massi massive ve equip quipm ments nts used sed for for manuf nufactu acture re of st ste eel and other ther industries.
CHAPTER-2 Theoretical background background
Why we are choosing a Microcontroller?
7
As
it pro provi vide des s on chip chip micr microp opro roce cess ssor or,, RAM, RAM, ROM, ROM,
Parallel I/O port, Serial I/O port etc. hence its cost is less, size is less, power consumption is less and speed is more.
Software
development
tools
like
assembler,
C
com compi pile lers rs etc etc are are easi easily ly avail vailab able le and and are are easy easy to upgrade
History of the Microcontroller
Introduction A microcontroller (also MCU or µC) is a computer on a chip chip.. It is a type type of micro icropr pro ocesso essorr empha phasi siz zin ing g hi high gh integr integrati ation, on, low low power power consum consumpti ption on,, self-su self-suffi fficie ciency ncy and and cost cost-e -efffec fective tivene ness ss,,
in
cont contra ras st
to
a
gen genera eral-p -pu urpo rpose
microprocessor (the kind used in a PC). In addition to the usual arithmetic and logic elements of a general purpose microp microproc rocess essor, or, the microc microcont ontrol roller ler typica typically lly in integ tegrat rates es additi addition onal al elemen elements ts such such as read-w read-writ rite e memor memory y for data data storage, read-only memory, such as flash for code storage, EEPROM EEPROM for perma permanen nentt data data storag storage, e, periph periphera erall device devices, s, and input/output interfaces. At clock speeds of as little as a 8
few MHz or even lower, microcontrollers often operate at very low speed compared to modern day microprocessors, but this is adequate for typical applications. They consume relatively little power (milliwatts), and will generally have the ability to sleep while waiting for an interesting peripheral event such as a button press to wake them up again to do something. Power consumption while sleeping may be just nanowatts, making them ideal for low power and long lasting battery applications. Micr Microc ocon ontr trol olle lers rs
are are
freq freque uent ntly ly
used us ed
in
auto automa mati tica call lly y
controlled products and devices, such as automobile engine control
systems,
remote
controls,
office
machines,
appl applia ianc nces es,, powe powerr tool tools, s, and and toys toys.. By redu reduci cing ng the the si size ze,, cost, and power consumption compared to a design using a sepa separa rate te
micr icropro oproce cess sso or,
devices,
microcontrollers
memory, ry, make
and it
economical
electronically electronically control many more processes.
9
inpu in put/ t/ou outp tput ut to
Microcontrollers v/s.Microprocessors
MICROPROCESSORS
MICROCONTROLLERS
A microprocessor: microprocessor:
A
single-chip
single single-ch -chip ip
contained only CPU bus
CPU,
in inte tern rna al
ROM (usually)
ROM
I/O
devices
by port
hardw rdware
is
is
larger
than
RAM (usually)
are
suit su itab able le to cont contro roll of
ROM,
fixed
is larg larger er than than
Micr Micro oproc rocess sso or
RAM,
Communicate Communicate
capac capacity ity,, num
of port is selectable RAM RAM
conta containe ined d
Peripherals, I/O port
is available
RAM
microcontroller
Micr Micro ocon contro trolle llers
in
are
suitable suitable to processin processing g
design designs s requi requirin ring g a
information
minimum
computer systems.
10
in
component
Microcontroller for Embedded Systems
In the literature discussing microcontrollers, we often see the term term Embed Embedded ded System System.. Microc Microcon ontro trolle llers rs are widely widely used in Embedded System products. An Embedded product uses a microcontroller to do one task and one task only.
In an Embe Embedd dded ed Syst System em ther there e is only only one one appl applic icat atio ion n software that is typically burned into ROM and X-86 PC contai contains ns or is conne connecte cted d to variou various s Embed Embedded ded produc products ts such as keyboard, printer, modem, disk controller, sound card, CD-ROM driver, mouse and so on. Each one of theses
11
periph periphera erals ls has a microc microcont ontrol roller ler inside inside it that that perfor performs ms only one task. .
Why use 8 bit microcontroller
The following features of 8- bit microcontrollers microcontrollers make it useful to be used for IC testing.
Low cost.
Low power consumption
High speed perform Repre Represen sentt a transi transitio tion n zone zone betwe between en dedic dedicat ated, ed, hi highghvolume,
4-bit
micro-
controllers
and
the
high
performance 16 bit microcontrollers. microcontrollers.
Bit addressing used for test pin monitoring or program control flags.
8 – bit word size adequate for many computing tasks and control or monitoring monitoring applications
12
89c51 • 4K Bytes of In-System Reprogrammable Flash Memory • 128 x 8-bit Internal RAM • Two 16-bit Timer/Counters • Six Interrupt Sources
Pin Configuration 13
14
PIN DIAGRAM DESCRIPTION
Vcc
Supply Voltage
GND
Ground
Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs.
Port 0 can also be configured to be the multiplexed loworde orderr addre address ss/d /dat ata a bus bus duri during ng acce access sses es to exte extern rnal al program and data memory. In this mode, P0 has internal pull-ups.
Port 0 also receives the code byt bytes during Flash programming
and
outputs 15
the
code
byt bytes
dur during
program verification. External pull-ups are required
during program verification.
Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pul pulled low low will ill sou source rce curre urrent nt (II (IIL) bec becaus use e of the the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter timer/counter 2 external count input
(P1.0/T2)
and
the
timer/counter
2
trigger
input
(P1. (P 1.1/ 1/T2 T2EX EX), ), resp respec ecti tive vely ly,, as sh show own n in the the foll follow owin ing g Table.
Port 1 also receives the low-order address bytes during Flash programming and verification. verification.
16
Table I. Alternate Functions of Port 1
Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pullups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pul pulled low will ill sour source ce curre urrent nt (IIL (IIL)) beca becaus use e of the internal pull-ups.
Port 2 emits the high-order address byte during fetches from external program memory and during accesses to exte xternal rnal data data memor mory tha that uses ses 16-b -biit addre ddress sses es
17
(MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), I), Port 2 emits the con content tents s of the P2 Spec pecial ial Function Register.
Port Port 2 also also rece receiv ives es the the hi high gh-o -orde rderr addr addres ess s bi bits ts and and some some cont contro roll si sign gnal als s duri during ng Flas Flash h prog progra ramm mmin ing g and and verification.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins pi ns that that are are exte extern rnal ally ly bein being g pull pulled ed low low will will sour source ce current (IIL) because of the pull-ups.
Port
3
receives
some
control
programming and verification. verification.
18
signals
for
Flash
Port Port 3 also also serv serves es the the func functi tion ons s of vari variou ous s sp spec ecia iall feat featur ures es of the the AT89 AT89S5 S52, 2, as sh show own n in the the foll follow owin ing g Table.
Table II. Alternate Functions of Port 3
RST RS T (Re Rese sett inp input ut))
A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO Bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.
19
ALE/PROG
Address Latch Enable is an output pulse for latching the low byte of the address during accesses to external memor mory. Thi This pi pin n is also also the the pro progra gram puls pulse e inpu nput (PROG) during Flash Programming. Programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory.If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction.
Otherwise,
the
pin
is
weakly
pulled
high hi gh.S .Set etti ting ng the the AL ALEE-di disa sabl ble e bi bitt has has no effe effect ct if the the microcontroller microcontroller is in external execution mode.
PSEN
Prog Progra ram m Stor Store e Enab Enable le (P (PSE SEN) N) is the the rea read st stro robe be to exte xterna rnal pro progra gram memor mory. When hen the the AT8 AT89S52 S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two
20
PSEN PS EN acti activa vati tion ons s are are skip skippe ped d duri during ng each each acce access ss to external data memory.
EA/Vpp
External Access Enable, EA must be strapped to GND in order to enable the device to fetch code from external prog progra ram m memo memory ry loca locati tion ons s st star arti ting ng at 00 0000 00H H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will will be in inte tern rnal ally ly latc latche hed d on rese reset. t.EA EA sh shou ould ld be strapped to VCC for internal program executions.This pin pi n also also rece receiv ives es the the 12 12-v -vol oltt prog progra ramm mmin ing g enab enable le voltage (VPP) during Flash programming programming .
XTAL 1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit
XTAL 2 Output from the inverting oscillator amplifier.
21
Special Function Register A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table I
Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate indeterminate effect.
ARCHIECTURE 8951
22
User software should not write 1s to these unlisted ted locations, since they may be used in future products to
23
invo in voke ke new new feat featur ures es.. In that that case case,, the the rese resett or in inac acti tive ve values of the new bits will always be 0.
Timer 2 Registers:
Control and status bits are contained in registers T2CON (shown in Table II) and T2MOD for Timer 2. The register pair (RCAP2H, RCAP2L) is the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.
Interrupt Registers:
The individual interrupt interrupt enable bits are are in the IE register. register. Two priorities can be set for each of the six interrupt sources in the IP register.
Dual Data Pointer Registers:
To facilitate accessing both internal and external data memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS 24
= 1 selects DP1. The user should ALWAYS initialize the DPS DPS bi bitt to the the appr approp opri riat ate e valu value e befo before re acce access ssin ing g the the respective Data Pointer Register.
Power off Flag: The Power off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set to “1” during power up. It can be set and rest under software control and is not affected by reset.
Memory Organization MCSS-5 51 devi device ces s have ave a sepa separa rate te addre ddress ss sp spa ace for for Progr rogram am and and Data Data Memo Memory ry.. Up to 64 64K K byte bytes s each each of external Program and Data Memory can be addressed. Program Memory
If the EA pin is connected to GND, all program fetches are directed to external memory. 25
On the the AT89 AT89S5 S52, 2, if EA is conn connec ecte ted d to VCC, VCC, prog progra ram m fetches to addresses 0000H through 1FFFH are directed to in inte tern rnal al memo memory ry and and fetc fetche hes s to addr addres esse ses s 200 000H 0H through FFFFH are to external memory. Data Memory
The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Specia Speciall Functi Function on Regis Register ters. s. This This means means that that the upper upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space.
When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies specifies whether whether the CPU accesses accesses the upper 128 bytes bytes of RAM or the SFR space. Instructions which use direct addressing access the SFR space.
For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2).
MOV 0A0H, #data
26
Inst Instru ruct ctio ions ns that that us use e in indi dire rect ct addr addres essi sing ng acce access ss the the uppe upperr 12 128 8 byte bytes s of RAM. RAM. For For exam exampl ple, e, the the foll follow owin ing g indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).
MOV @R0, #data
Note Note that that st stac ack k oper operat atio ions ns are are exam exampl ples es of in indi dire rect ct addre ddress ssiing, ng, so the uppe upperr 128 byte ytes of data data RAM is available as stack space.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure. 2.1Either a quartz crys crysta tall or cera cerami mic c reso resona nato torr may may be us used ed.. To driv drive e the the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 2.2. There are no requirements requirements on the duty cycle cycle of the external
27
clock signal, since the input to the internal clocking circuitry is thro throug ugh h a di divi vide de-b -byy-tw two o flip flip-f -flo lop, p, but but mini minimu mum m and and maximum voltage high and low-time specifications must be observed.
Figure Figure 2.1 Oscill Oscillato atorr Connec Connectio tions ns
Figure Figure 2.2
Extern External al Clock Clock
Drive Drive
Configuration
Idle Mode
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked by soft softwa ware re.. The The conte ontent nt of the the on-c on-ch hip RAM and all the the
28
specia speciall functi functions ons regis registe ters rs remain remain unchan unchanged ged during during this this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset.
Note Note that that when when id idle le mode mode is term termin inat ated ed by a hard hardwa ware re rese reset, t, the the devi device ce norm normal ally ly resu resume mes s prog progra ram m exec execut utio ion n from where it left off, up to two machine cycles before the intern internal al reset reset algor algorith ithm m takes takes contro control. l. On-chi On-chip p hardwa hardware re inhibits access to internal RAM in this event, but access to the port pins is not inhibited.
To eliminate the possibility of an unexpected write to a port pin when idle mode is terminated by a reset, the instruction following the one that invokes idle mode should not write to a port pin or to external memory .
Power-down Mode In the Power-down mode, the oscillator is stopped, and the instruction that invokes Power-down is the last instruction executed. The on-chip RAM and Special Function Registers retain
their
values
until
the
Power-down
mode
is
terminated. Exit from Power-down mode can be initiated
29
eithe itherr by a hardw ardwa are rese resett or by an enabl nable ed exte xternal rnal interrupt.
Reset redefines the SFRs but does not change the on-chip RAM. RAM. The The rese resett sh shou ould ld not not be acti activa vate ted d befo before re VCC VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.
8051 INSTRUCTIONS SINGLE BIT INSTRUCTIONS;
30
SETB
BIT
SET THE BIT =1
CLR BIT
CLEAR THE BIT =0
CPL BIT
COMPLIMENT THE BIT 0 =1, 1=0
JB BIT, TARGET
JUMP TO TARGET IF BIT =1
JNB BIT, TARGET
JUMP TO TARGET IF BIT =0
JBC BIT, TARGET
JUMP TO TARGET IF BIT =1 & THE
1.1MOV INSTRUCTIONS:- MOV instruction simply copy the data from one location to another location.
1.2MOV 1.2 MOV D,S ; Copy the data from(S) from(S ) source to D(destination) into Register R0 MOV R0,A ; Copy contents of A into into register R1 MOV R1,A ; Copy contents of A into
MOV
A,R3
;
Copy
contents
Accumulator.
31
of
Register
R3
into
DIRECT LOADING THROUGH MOV
MOV A,#23H ; Direct load the value of 23H in A
MOV R0,#12H ; direct load the value of 12H in R0
MOV R5,#0F9H ; Load the F9 value in the Register R5
ADD INSTRUCTIONS
ADD instruction adds the source byte to the accumulator (A) and place the result in the Accumulator.
ADD A,#42H ; By this instructions we add the value 42H in Accumulator.
ADD A,R3 ; By this instructions we move the data from regi regist ste er r3 to accumu cumullator ator and the then add the the contents of the register register into into accumulator accumulator .
SUBROUTINE CALL FUNCTION 32
1.2.1.1 1.2.1.1 ACALL, ACALL, TARGET TARGET ADDRESS ADDRESS ; By this instructions we call call subroutines subroutines with a target address address within within 2k bytes from the current program counter.
ACALL is a limit for the 2 k byte program counter, but for upto 64k byte we use LCALL instructions. Note that LCALL is a 3 byte instruction. ACALL is a two byte instruction.
sta ands nds for abs bsol olut ute e jump. ump. It tran ransf sfe ers pro progra gram AJMP st execution to the target address unconditionally. The target addre ddress ss for this this in inst stru ruct ctiion mus ustt be withi ithin n 2k byt byte of program memory.
lso o for abs bsol olu ute jump. ump. It tran ransf sfe ers pro progra gram LJMP is als executio execution n to the target address uncondition unconditionally ally.. This is a 3 byte instructions LJMP jump to any address within 64 k byte location.
33
INSTRUCTIONS RELATED TO THE CARRY 1.3 JC TARGET ; JUMP TO THE TARGET TARGET IF CY FLAG =1 1.4 JNC TARGET ; JUMP TO THE TARGET TARGET ADDRESS IF CY FLAG IS = 0 2 3 INSTRU INSTRUCTI CTION ONS S RELASTED RELASTED TO TO JUMP WITH WITH ACCU ACCUMULA MULATOR TOR
3.1.1.1.1
JZ TARGET; JUMP TO TARGET IF A = 0
3.1.1.1.1.1.1 JNZ TARGET; JUMP IF ACCUMULATOR IS NOT ZERO. 3.1.1.1 3.1.1.1.1.1 .1.1.2 .2 This instruct instruction ion jumps jumps if register register A has a value value other than zero
3.1.1 .1.1.1 .1.2 .2
INS INSTR TRUC UCTI TIO ONS RELAT ELATE ED TO THE THE ROTATE TATE
3.1.1.1.2.1.1.1
RL A; ROTATE LEFT THE ACCUMULATOR
By this instruction we rotate the bits of A left. The bits rotated out of A are rotated back into A at the opposite end.
3.1.1.1.3
RR A:- By this instruction we rotate the
contents of the accumulator from right to left from LSB to MSB.
34
3.1.1.1.4
RRC A: - This is same as RR A but difference
is that the bit rotated out of register first enters in to carry and then enter into MSB.
3.1.1.1.5
RLC A:- ROTATE A LEFT THROUGH CARRY.
This shifts the data from MSB to carry and carry carry to LSB.
3.1.1.1.6
RET:- This is return from subroutine. This
instruction is used to return from a subroutine previously entered by instructions LCALL and ACALL.
3.1.1.1.7
RET1:- This is used at the end of an interrupt
service routine. We use this instruction after interrupt routine.
indicated byte onto onto the stack and PUSH:- This copies the indicated increments SP. This instruction supports only direct addressing mode.
POP; POP FROM STACK. This copies the byte byte pointed to be SP to the the location whose whose direct address is indicated, and decrements SP by 1. Notice that this instructions supports only direct addressing mode.
DPTR INSTRUCTIONS
35
MOV DPTR,#16 BIT VALUE; LOAD DATA POINTER This instructions load load the 16 bit bit DPTR register register with a 16 bit immediate value
3.1.1.1.8
INC BYTE:-
This instruction adds adds 1 to the register register or memory memory location location specified by the operand. INC A INC Rn INC DIRECT
3.1.1.1.9
DEC BYTE :-
This instruction subtracts subtracts 1 from the byte operand. operand. Note that CY is unchanged. DEC A DEC Rn DEC DIRECT
DESCRIPTION DESCRIPTION OF PROJECT BLOCK DIAGRAM
36
Light sensor (LDR)
8 0 5 1 µ street light LEDs
IR sensor
5V power supply using 7805 Description. 7805 is a 5V fixed three terminal positive voltage regulator IC .The IC has features such as safe operating area protection,thermal protection,t hermal shut down, internal current limiting which makes the IC very rugged.Out out currents up to 1A can be drawn from the IC provided that there is a proper heat sink.A 9V transformer steps down the main voltage ,
37
1A bridge rectifies it and capacitor C1 filters it and 7805 regulates it to produce a steady 5V DC .
Circuit diagram.
Power Supplies: Types of Power Supply
There are many many types of power power supply. Most are are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. For example a 5V regulated supply:
38
Each of the blocks is described in more detail below: •
Transformer - steps down high voltage AC mains to low voltage AC.
•
Rectifier - converts AC to DC, but the DC output is varying.
•
Smoothing - smooths the DC from varying greatly to a small ripple.
•
Regulator - eliminates ripple by setting DC output to a fixed voltage.
Circuit Diagram
39
FLOW CHART
Initialize ports
40
Object detected ?
NO
YES
NO
Components
Is it night?
Switch on Light For 30 seconds
YES
Regulator: The regulator (7805) provides circuit designers with an easy way to regulate DC voltages to 5v. Here 78 stands for positive and 05 stands for 5 volts. The 7805 is a positive voltage DC regulator that has only 3 terminals. They are: Input voltage, Ground, Output Voltage.
41
General Features: Output Current up to 1A Short Circuit Protection Thermal Overload Overload Protection Protection
Capacitors:
A
capacitor
or
condenser
is
a
passive
electronic
component consisting of a pair of conductors separated by a di diel elec ectr tric. ic. When When a volt voltag age e pote potent ntia iall di diff ffer eren ence ce exis exists ts between the conductors, an electric field is present in the dielectric.
This
field
stores
energy
and
produces
a
mechanical force between the plates. In this circuit our capacitor is used to remove ripples. In this we have used both electrolytic and ceramic capacitor of various ratings.
Resistors:
42
A resi resist stor or is a twotwo-te term rmin inal al elec electr tron onic ic comp compon onen entt that that produces produces a voltage voltage across across its terminals terminals that is proportio proportional nal to the electric electric current current through through it in accordanc accordance e with Ohm's law. Resistors of various ratings are used in this circuit. Resistance is used in front of led to drop the voltage from 5v whic which h is comi coming ng from from micr microc ocon ontr trol olle lerr to 3v whic which h is required by the led to glow.
Microcontroller:
The 89C51 is a low-power, high-performance high-performance CMOS 8-bit microcomputer with 8K bytes of Flash Programmable and Erasable Read Only Memory (PEROM).
43
LED’s:
A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in many devices, and are increasingly used for lighting. In this we are using led’s to show the level of water in tank.
Transistors:
In this we have used NPN and PNP transistors. NPN transistor will be used to turn the motor on and PNP to convert negative voltage to positive voltage.
Crystal oscillator:
44
A crysta crystall oscil oscillat lator or is an elect electron ronic ic circui circuitt that that uses uses the mechanical resonance of a vibrating crystal of piezoelectric of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time to provide a stable clock signal for digital integrated circuits
Transformer:
45
Transformers convert convert AC electricity electricity from one voltage to another with
Transformer circuit symbol
little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. Transformer
Step-up transformers increase voltage, step-down transformers reduce voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in UK) to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils, instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core.
46
Transformers waste waste very little little power so the the power out is is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up.
LDR:
47
Light ght
Depe Depen ndent ent
transducer. it
is
Resis sisto tor r – it also
called
is as
a
passive
light
photo-conductive
cell because its conductivity changes due to change in light intensity.
LDR’s or light dependent resistors are very useful especially in light/dark sensor circuits. normally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms, but when they are illuminated with light resistance drops dramatically. dramatically. When a light level of 1000 Lux (bright light) is directed towards it, the resistance is 400r (ohms).
When a light level of 10 Lux (very low light level) is directed towards it, the resistance has risen dramatically to 10.43m (10430000 ohms).
Basic principle – when light falls on it its resistance decreases and when it is dark its resistance is maximum. the change in
48
resistance is directly proportional to intensity of light falling on it. construction – it is made up of photo sensitive material like cadmium sulphide (cds), selenium (se), cadmium selenide (cdse) or lead sulphide (pbs). it is deposited on insulating surface like ceramic substrate in the form of zigzag wire as shown in following figure. it is enclosed in round metallic or plastic case and two electrodes are taken out for external connections. the structure is covered with glass sheet to protect it from moisture and dust and allows only light to fall on it.
Constructional diagram of LDR Applications – 1. It is used in burglar alarm to give give alarming sound when when a burglar invades sensitive premises. 2. It is used in street light control control to switch on the lights during dusk (evening) and switch off during dawn (morning) automatically. automatically. 3. It is used in Lux meter to measure measure intensity of light in Lux. 49
4. It is used in photo photo sensitive relay relay circuit
IR-SENSORS:
Infrared Radiation Infrared radiation exists in the electromagnetic 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
50
range. 9.4um infrared will also pass through polyethylene which is usually used to make Fresnel lenses to focus the infarared onto sensor elements.
Pyroelectric Sensors The pyroelectric pyroelectric sensor is made of a crystalline 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 b e 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 terminal pin 2 connects 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 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.
51
The PIR325 sensor has two sensing elements 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 sensor in a horizontal direction 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 is usually used in front of the sensor
52
The figure below shows the PIR325 PIR325 electrical electrical specifications specifications and layout in its TO5 package. Note the wide viewing angle without an external lens.
53
54
This is a typical application application circuit that drives a relay. R10 and C6 adjust the amount of time that RY1 remains energized after motion is detected.
Fresnel Lens A Fresnel lens (pronounced Frennel) is a Plano Convex lens that has been collapsed on itself to form a flat lens that retains its optical characteristics but is much smaller in thickness and therefore has less absorption losses.
55
Our FL65 Fresnel lens is made of an infrared transmitting material that has an IR transmission range of 8 to 14um which 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 element is round with a diameter of 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 can also be used if it overlaps the edges to form a captive mount. The FL65 has a focal length of of 0.65 inches inches from the lens to the sensing element. It has been determined by experiment
56
to have a field of view of approximately 10 degrees when used with a PIR325 Pyroelectric Pyroelectric sensor.
This relatively inexpensive and easy easy to use Pyroelectric Pyroelectric Sensor and Fresnel Lens can be used in a variety of science projects, robots and other useful devices.
CHAPTER-4
57
DESIGN PROCEDURE
•
According to circuit diagram we have collected the components required in our project.
•
Then Then we asse assemb mble led d thos those e comp compon onen ents ts on the the pcb board according to circuit diagram.
•
After the assembling of these components then we soldered those components on the pcb board.
•
We made made the the hard hardwa ware re conn connec ecti tion ons s with ith the the various components.
•
Then we assembled the whole hardware on the plywood.
•
CHAPTER-5 FABRICATION TECHNIQUES
58
The fabrication techniques used in this project can be broadly classified into:
•
Mechanical
Fabrication,
consisting
of
mec mechan hanical ical des design i.e. .e. boar board, d, stree reet, light ght poles etc.
•
Electrical Electrical Fabricati Fabrication, on, consisti consisting ng of electrica electricall design i.e. making PCB, soldering etc.
Mechanical Fabrication
For the basic board we are using plywood cut out accordingly so as to adjust the PCB on the top, the transformer, street, LDR, IR sensor, LED poles.
Electrical Fabrication 1)Soldering
59
How to solder? Mount components at their appropriate place; bend the leads leads sli slight ghtly ly outwar outwards ds to preven preventt them them from from fallin falling g out when the board is turned over for soldering. No cut the leads so that you may solder them easily. Apply a small amount of flux at these components leads with the help of a screwdriver. Now fix the bit or iron with a small amount of solder and flow freely at the point and the P.C.B copper track at the same time. A good solder joint will appear smooth & shiny. If all appear well, you may continue to the next solder connections .
Tips for good soldering 1.
Use Use righ rightt type type of of solde solderi rin ng iron. ron. A sma small eff effic iciient ent soldering iron (about 10-25 watts with 1/8 or 1/4 inch tip) is ideal for this work.
2.
Keep Keep the the hot hot tip tip of of the the sol solde deri ring ng iro iron n on on a pie piece ce of of metal so that excess heat is dissipated. d issipated.
3.
Make Make su sure re tha thatt con conne nect ctio ion n tto o the the sold solder ered ed is clea clean. n. Wax frayed insulation and other substances cause
60
poor soldering connection. Clean the leads, wires, tags etc. before soldering. 4. Use just enough solder to cover the lead to be soldered. Excess solder can cause a short circuit. 5. Use Use su sufffic ficient ient heat. at. This This is the the ess sse ence nce of goo good sold solder erin ing. g. Ap Appl ply y enou enough gh heat heat to the the comp compon onen entt lead. You are not using enough heat, if the solder barely melts and forms a round ball of rough flaky solder. A good solder joint will look smooth, shining and and sp spre read ad type type.. The The di diff ffer eren ence ce betw betwee een n good good & bad soldering is just a few seconds extra with a hot iron applied firmly.
Precautions
1.
Mou Mount the the compone ponent nts s at the the appr approp opri ria ate pl pla aces ces before soldering. Follow the circuit description and compon component ents s detai details, ls, leads leads identi identific ficati ation on etc. etc. Do not start soldering before making it confirm that all the components are mounted at the right place.
2.
Do not not use use a spr spread sol solder on th the boa board, it ma may cause short circuit.
61
3.
Do not not sit sit unde underr the the fan fan whi while le sold solder erin ing. g.
4.
Position the board so that gravity tends to keep the solder where you want it.
5.
Do not over heat the components at the board. Exce xcess heat eat may dam damage the the com compon ponents ents or board.
6.
The board should not vibrate while soldering otherwise you have a dry or a cold joint.
CHAPTER-6
62
TESTING AND EVALUATION
All the components used in constructing the AUTOMATION OF STREET LIGHT CONTROLLER CIRCUIT came pre tested therefore the tests performed were done after the completion of the project. The following following tests were performed: performed:
Visual
Observation
A visual observation of the AUTOMATION OF STREET LIGHT CONTROL SYSTEM CIRCUIT was conducted to look for any broken connection or any stray wire that can restrict for the ON & OFF function of lights or any other visible fault. No problem was found during this visual evaluation. evaluation. Operational
Test
The circuit was was operated and and checked whether whether it is performing the desired operation. No problem was found during this test.
63
CHAPTER-7 CONCLUSION AND SCOPE OF FUTURE WORK
64
Automatic Street Light Control System is a simple and powerful concept, which uses transistor as a switch to switch ON and OFF the street light automatically. automatically. By using this system manual works are removed. It automatically switches ON lights when the sunlight goes below the visible region of our eyes. It automatically switches OFF lights under illumination by sunlight. This is done by a sensor called Light Dependant Resistor (LDR) which senses the light actually like our eyes. By using this system energy consumption is also reduced because now-a-days the manually operated street lights are not switched off properly even the sunlight comes and also not switched on earlier before sunset. In sunny and rainy days, ON time and OFF time differ significantly which is one of the major disadvantage of using timer circuits or manual operation. This project exploits exploits the working working of a transistor transistor in saturation region and cut-off region to switch ON and switch OFF the lights at appropriate time with the help of an electromagnetically operated switch. Automatic Streetlight Streetlight needs no manual operation of switching ON and OFF. The system itself detects whether there is need for light or not. When darkness rises to a certain value then automatically streetlight is switched ON and when there is other source of light, the street light gets 65
OFF. The extent of darkness at which the street light to be switched on can also be tailored using the potentiome potentiometer ter provided in the circuit.
CHAPTER-8 REFERENCES Following are some internet sites, books, magazines taken as reference for this project
http://www.
electronicsforu.com
http://www.microcontrollerbooks.com www.8051projects.info/datasheets/BC548.pdf
66
http://www.electronic-circuits-
diagrams.com/alarmsimages/alarmsckt6.shtml www.electronics www.electronicstutotials. tutotials.com/oscillators com/oscillators/crysta /crysta
l- oscillators. oscillators.htm htm
Books:
Programming
and
Customizing
8051
Microcontroller by :Myke Predko The
8051/8052
Microcontroller
by:
Craig
Steiner Embedded
The
Systems by Dr. K.V.K.K Prasad
8051
Microcontroller
Architecture
Programming and Applications by: Kenneth J. Ayala, West Publishing Company.
67