Академический Документы
Профессиональный Документы
Культура Документы
INTRODUCTION
1.1 Electronics and Micrprocessor
Electronics is the science of how to control the electric energy, energy in which
the electrons have a fundamental role. Electronics deals with electrical circuits that
involve active electrical Components such as vacuum tubes, transistors, diodes and
integrated circuits, and associated passive electrical components and interconnection
technologies.
Commonly, electronic devices contain circuitry consisting primarily or exclusively of
active semiconductors supplemented with passive elements; such a circuit is described as
an electronic circuit.
The nonlinear behaviour of active components and their ability to control electron
flows makes amplification of weak signals possible, and electronics is widely used
in information processing, telecommunication, and signal processing. The ability of
electronic devices to act as switches makes digital information processing possible.
Interconnection technologies such as circuit boards, electronics packaging technology, and
other varied forms of communication infrastructure complete circuit functionality and
transform the mixed components into a regular working system.
Electronics is distinct from electrical and electro-mechanical science and technology, which
deal with the generation, distribution, switching, storage, and conversion of electrical energy
to and from other Energy forms using wires, motors, generators,
batteries, switches, relays, transformers, resistors, and other passive components.
This distinction started around 1906 with the invention by Lee De Forest of
the triode, which made electrical amplification of weak radio signals and audio signals
possible with a non-mechanical device. Until 1950 this field was called "radio technology"
because its principal application was the design and theory of radio transmitters, receivers,
and vacuum tubes.
Today, most electronic devices use semiconductor components to perform electron
control. The study of semiconductor devices and related technology is considered a branch of
solid-state physics, whereas the design and construction of electronic circuits to solve
practical problems come under electronics engineering. This article focuses on engineering
aspects of electronics.
A microprocessor is a computer processor that incorporates the functions of
a computer's central processing unit (CPU) on a single integrated circuit (IC), or at most a
few integrated circuits. The microprocessor is a multipurpose, programmable device that
accepts digital data as input, processes it according to instructions stored in its memory, and
provides results as output. It is an example of sequential digital logic, as it has internal
memory. Microprocessors operate on numbers and symbols represented in the binary
numeral system.
The integration of a whole CPU onto a single chip or on a few chips greatly reduced
the cost of processing power. The integrated circuit processor was produced in large numbers
by highly automated processes, so unit cost was low. Single-chip processors increase
reliability as there are many fewer electrical connections to fail. As microprocessor designs
get faster, the cost of manufacturing a chip (with smaller components built on a
semiconductor chip the same size) generally stays the same.
Before microprocessors, small computers had been implemented using racks of
circuit boards with many medium- and small-scale integrated circuits. Microprocessors
integrated this into one or a few large-scale ICs. Continued increases in microprocessor
capacity have since rendered other forms of computers almost completely obsolete
(see history of computing hardware), with one or more microprocessors used in everything
from
the
smallest embedded
devices to
the
The idea of designing a new system for the streetlight that do not consume huge
amount of electricity and illuminate large areas with the highest intensity of light is
concerning each engineer working in this field. Providing street lighting is one of the most
important and expensive responsibilities of a city. Lighting can account for 1038% of the
total energy bill in typical cities worldwide [1].
Street lighting is a particularly critical concern for public authorities in developing
countries because of its strategic importance for economic and social stability. Inefficient
lighting wastes significant financial resources every year, and poor lighting creates unsafe
conditions. Energy efficient technologies and design mechanism can reduce cost of the street
lighting drastically. Manual control is prone to errors and leads to energy wastages and
manually dimming during mid night is impracticable. Also, dynamically tracking the light
level is manually impracticable. The current trend is the introduction of automation and
remote management solutions to control street lighting [2].
There are various numbers of control strategy and methods in controlling the street
light system such as design and implementation of CPLD based solar power saving system
for street lights and automatic traffic controller [1], design and fabrication of automatic street
light control system[3], automatic street light intensity control and road safety module using
embedded system [4], automatic street light control system [5], Intelligent Street Lighting
System Using Gsm [6], energy consumption saving solutions based on intelligent street
lighting control system [7] and A Novel Design of an Automatic Lighting Control System for
a Wireless Sensor Network with Increased Sensor Lifetime and Reduced Sensor Numbers[8].
In this project two kinds of sensors will be used which are light sensor and
photoelectric sensor. The light sensor will detect darkness to activate the ON/OFF switch, so
the streetlights will be ready to turn on and the photoelectric sensor will detect movement to
activate the streetlights. LDR, which varies according to the amount of light falling on its
surface, this gives an inductions for whether it is a day-night time, the photoelectric sensors
are placed on the side of the road, which can be controlled by microcontroller PIC16f877A.
The photoelectric will be activated only on the night time. If any object crosses the
photoelectric beam, a particular light will be automatically ON. By using this as a basic
principle, the intelligent system can be designed for the perfect usage of streetlights in any
place.
3
CHAPTER 2
CONTROLLER SELECTION
Block Diagram:
In this project, we are going to switch off the street lights automatically as the
day starts. The duration of the day differs from season to season, accordingly our module
works based upon the light intensity so as to when to start or stop. For this we are using Light
Dependent Resistor (LDR) as the light sensor, which communicates with the required
information to the micro controller.
Here we are using micro controller, LDR, and relay. By using the LDR we can
operate the lights, i.e when the light is available then it will be in the OFF state and when it is
dark then the light will be in ON state, it means LDR is inversely proportional to light. When
4
the light falls on the LDR it sends the commands to the micro controller that it should be in
the OFF state then it switch offs the light, all these commands are sent to the controller then
according to that the devices operate. We use a relay to act as an ON OFF switch, the load is
connected to these relays.
HARDWARE DESCRIPTION
The block diagram of the system is as shown in the fig. The system basically
consists of a
1.
2.
3.
4.
Micro controller,
LDR
RELAY
Power supply,
LDR
LDRs 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.
The animation opposite shows that when the torch is turned on, the resistance of the LDR
falls, allowing current to pass through
RELAY
Description
A relay is an electrical switch that opens and closes under the control of another electrical
circuit. In the original form, the switch is operated by an electromagnet to open or close one
or many sets of contacts. It was invented by Joseph Henry in 1835. Because a relay is able to
control an output circuit of higher power than the input circuit, it can be considered to be, in a
broad sense, a form of an electrical amplifier.
Operation
When a current flows through the coil, the resulting magnetic field attracts an armature that is
mechanically linked to a moving contact. The movement either makes or breaks a connection
with a fixed contact. When the current to the coil is switched off, the armature is returned by
a force approximately half as strong as the magnetic force to its relaxed position. Usually this
is a spring, but gravity is also used commonly in industrial motor starters. Most relays are
manufactured to operate quickly. In a low voltage application, this is to reduce noise. In a
high voltage or high current application, this is to reduce arcing.
If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate the
energy from the collapsing magnetic field at deactivation, which would otherwise generate a
spike of voltage and might cause damage to circuit components. Some automotive relays
already include that diode inside the relay case. Alternatively a contact protection network,
consisting of a capacitor and resistor in series, may absorb the surge. If the coil is designed to
be energized with AC, a small copper ring can be crimped to the end of the solenoid. This
"shading ring" creates a small out-of-phase current, which increases the minimum pull on the
armature during the AC cycle.
By analogy with the functions of the original electromagnetic device, a solid-state relay is
made with a thyristor or other solid-state switching device. To achieve electrical isolation an
opto coupler can be used which is a light-emitting diode (LED) coupled with a photo
transistor.
Since relays are switches, the terminology applied to switches is also applied to relays. A
relay will switch one or more poles, each of whose contacts can be thrown by energizing the
coil in one of three ways:
Normally-open (NO) contacts connect the circuit when the relay is activated; the
circuit is disconnected when the relay is inactive. It is also called a Form A contact or
"make" contact.
Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the
circuit is connected when the relay is inactive. It is also called a Form B contact or
"break" contact.
The animated picture shows a working relay with its coil and switch contacts. You
can see a lever on the left being attracted by magnetism when the coil is switched on. This
lever moves the switch contacts.
The relay's switch connections are usually label led COM, NC and NO:
COM = Common, always connect to this, it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Connect to COM and NO if you want the switched circuit to be on when the relay
coil is on.
Connect to COM and NC if you want the switched circuit to be on when the relay
coil is off.
CHAPTER 3
REGULATED POWER SUPPLY
1. Power Supply:
This unit will supply the various voltage requirements of each unit.
The power supplying unit consists of a transformer, a rectifier, a filter and a regulator.
The transformer gives a 230V AC supply.
The rectifier is used to convert this AC supply to an equivalent DC source.
The rectifier used here is a Bridge rectifier.
In power supplies, capacitors are used to smooth (filter) the pulsating DC
output after rectification so that a nearly constant DC voltage is supplied.
The resistors and inductors can be combined with the capacitors to form
filter networks.
The voltage regulator is used to keep voltages within the prescribed range
that can be tolerated by the electrical equipment using that voltage.
Transformer
Voltage Regulator
CIRCUIT DIAGRAM:
Bridge Rectifier
Capacitor Filter
OUTPUT WAVEFORMS:
10
DESCRIPTION
A variable regulated power supply, also called a variable bench power supply, is one
where you can continuously adjust the output voltage to your requirements. Varying the
output of the power supply is the recommended way to test a project after having double
checked parts placement against circuit drawings and the parts placement guide. This type of
regulation is ideal for having a simple variable bench power supply. Actually this is quite
important because one of the first projects a hobbyist should undertake is the construction of
a variable regulated power supply. While a dedicated supply is quite handy e.g. 5V or 12V,
it's much handier to have a variable supply on hand, especially for testing.
The LM7805 is simple to use. You simply connect the positive lead of your
unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the
negative lead to the Common pin and then when you turn on the power, you get a 5 volt
supply from the Output pin.
CIRCUIT FEATURES
Brief description of operation: Gives out well regulated +5V output, output current
capability of 100 mA
components
Design testing: Based on datasheet example circuit, I have used this circuit
Component costs: Few dollars for the electronics components + the input
transformer cost
BLOCK DIAGRAM
12
CIRCUIT DIAGRAM
with the applied load. The secondary voltage on a transformer advertised as say 20VA will be
much greater if the secondary is only lightly loaded.
If we accept the 2.5% ripple as adequate for our purposes then at 13V this
becomes 13 * 0.025 = 0.325 Vrms. The peak to peak value is 2.828 times this value. Vrip =
0.325V X 2.828 = 0.92 V and this value is required to calculate the value of C1. Also
required for this calculation is the time interval for charging pulses. If you are on a 60Hz
system it it 1/ (2 * 60 ) = 0.008333 which is 8.33 milliseconds. For a 50Hz system it is 0.01
sec or 10 milliseconds.
Remember the tolerance of the type of capacitor used here is very loose. The
important thing to be aware of is the voltage rating should be at least 13V X 1.414 or 18.33.
Here you would use at least the standard 25V or higher (absolutely not 16V).With our
rectifier diodes or bridge they should have a PIV rating of 2.828 times the Vsec or at least
29V. Don't search for this rating because it doesn't exist. Use the next highest standard or
even higher. The current rating should be at least twice the load current maximum i.e. 2 X
0.5A or 1A. A good type to use would be 1N4004, 1N4006 or 1N4008 types.
These are rated 1 Amp at 400PIV, 600PIV and 1000PIV respectively. Always be
on the lookout for the higher voltage ones when they are on special.
TRANSFORMER RATING
In our example above we were taking 0.5A out of the Vsec of 10V. The VA
required is 10 X 0.5A = 5VA. This is a small PCB mount transformer available in Australia
and probably elsewhere.
This would be an absolute minimum and if you anticipated drawing the maximum
current all the time then go to a higher VA rating.
The two capacitors in the primary side are small value types and if you don't know
precisely and I mean precisely what you are doing then OMIT them. Their loss won't cause
you heartache or terrible problems.
14
15
CHAPTER 4
EMBEDDED SYSTEMS
PIC 16F877 is one of the most advanced microcontroller from Microchip. This controller
is widely used for experimental and modern applications because of its low price, wide range
of applications, high quality, and ease of availability. It is ideal for applications such as
machine control applications, measurement devices, study purpose, and so on. The PIC
16F877 features all the components which modern microcontrollers normally have. The
figure of a PIC16F877 chip is shown below.
GENERAL FEATURES
High performance RISC CPU.
ONLY 35 simple word instructions.
All single cycle instructions except for program branches which are two cycles.
Operating speed: clock input (200MHz), instruction cycle (200nS).
Up to 3688bit of RAM (data memory), 2568 of EEPROM (data memory), 8k14
of flash memory.
Pin out compatible to PIC 16C74B, PIC 16C76, PIC 16C77.
Eight level deep hardware stack.
16
KEY FEATURES
Maximum operating frequency is 20MHz.
Flash program memory (14 bit words), 8KB.
Data memory (bytes) is 368.
EEPROM data memory (bytes) is 256.
5 input/output ports.
3 timers.
2 CCP modules.
2 serial communication ports (MSSP, USART).
PSP parallel communication port
10bit A/D module (8 channels)
17
18
INPUT/OUTPUT PORTS
PIC16F877 has 5 basic input/output ports. They are usually denoted by PORT A (R A),
PORT B (RB), PORT C (RC), PORT D (RD), and PORT E (RE). These ports are used for
input/ output interfacing. In this controller, PORT A is only 6 bits wide (RA-0 to RA-7),
PORT B , PORT C,PORT D are only 8 bits wide (RB-0 to RB-7,RC-0 to RC-7,RD-0
to RD-7), PORT E has only 3 bit wide (RE-0 to RE-7).
All these ports are bi-directional. The direction of the port is controlled by using
TRIS(X) registers (TRIS A used to set the direction of PORT-A, TRIS B used to set the
direction for PORT-B, etc.). Setting a TRIS(X) bit 1 will set the corresponding PORT(X) bit
as input. Clearing a TRIS(X) bit 0 will set the corresponding PORT(X) bit as output.
(If we want to set PORT A as an input, just set TRIS(A) bit to logical 1 and want to set
PORT B as an output, just set the PORT B bits to logical 0.)
Analog input port (AN0 TO AN7) : these ports are used for interfacing analog inputs.
TX and RX: These are the USART transmission and reception ports.
SCK: these pins are used for giving synchronous serial clock input.
SCL: these pins act as an output for both SPI and I2C modes.
19
20
21
PIC 16F877 is a 40-pin 8-Bit CMOS FLASH Microcontroller from Microchip. The core
architecture is high-performance RISC CPU with only 35 single word1 instructions. Since it
follows the RISC architecture, all single cycle instructions take only one instruction cycle
except for program branches which take two cycles. 16F877 comes with 3 operating speeds
with 4, 8, or 20 MHz clock input. Since each instruction cycle takes four operating clock
cycles, each instruction takes 0.2 s when 20MHz oscillator is used. It has two types of
internal memories: program memory and data memory. Program memory is provided by 8K
words (or 8K*14 bits) of FLASH Memory, and data memory has two sources. One type of
data memory is a 368-byte RAM (random access memory) and the other is 256-byte
EEPROM (Electrically erasable programmable ROM). The core feature includes interrupt
capability up to 14 sources, power saving SLEEP mode, and (ICSP) capability. The
sink/source current, whichsingle 5V In-Circuit Serial Programming indicates a driving
power from I/O port, is high with 25mA. Power consumption is less than 2 mA in 5V
operating condition. The peripheral features include: (a) 3 time blocks: Timer0 for 8-bit
timer/counter; Timer1 for 16-bit timer/counter; and Timer2: 8-bit timer/counter with 8-bit
22
period register, prescaler and postscaler. (b) Two Capture, Compare, PWM modules for
capturing, comparing 16-bit, and PWM generation with 10-bit resolution. (c) 10-bit multichannel (max 8)Analog-to-Digital converter module. (Master Mode) and I2(d) Synchronous
Serial Port (SSP) with SPI (Master/Slave)C2 (e) Universal Synchronous Asynchronous
Receiver Transmitter (USART/SCI) with 9-bit address detection (f) Parallel Slave Port (PSP)
8-bits wide, with external RD, WR and CS controls (g) I/O ports. The key feature of 16F877
is summarized below: FLASH Program Memory (14-bit word) 8K Words Data Memory
(RAM) 368 Bytes Data Memory (EEPROM) 256 Bytes Interrupts 14 I/O Ports Ports A, B, C,
D, E Timers 3 Capture/Compare/PWM Modules 2 Serial Communications MSSP, USART 1 .
Program memory
Program memory contains the programs that are written by the user. The program
counter (PC) executes these stored commands one by one. Usually PIC16F877 devices
have a 13 bit wide program counter that is capable of addressing 8K14 bit program
memory space. This memory is primarily used for storing the programs that are written
(burned) to be used by the PIC. These devices also have 8K*14 bits of flash memory that
can be electrically erasable /reprogrammed. Each time we write a new program to the
controller, we must delete the old one at that time.
23
Data Memory
The data memory is partitioned into multiple banks which contain the General
Purpose Registers and the Special Function Registers. Bits RP1 (Status<6>) and RP0
(Status<5>) are the bank select bits. Each bank extends up to 7Fh (128 bytes). The lower
locations of each bank are reserved for the Special Function Registers. Above the Special
Function Registers are General Purpose Registers, implemented as static RAM. All
implemented banks contain Special Function Registers. Some frequently used Special
Function Registers from one bank may be mirrored in another bank for code reduction and
quicker access.
24
EEADRH
The EEPROM data memory allows single-byte read and writes. The Flash program
memory allows single-word reads and four-word block writes. Program memory write
operations automatically perform an erase-before write on blocks of four words. A byte write
in data EEPROM memory automatically erases the location and writes the new data (erasebefore-write). The write time is controlled by an on-chip timer. The write/erase voltages are
generated by an on-chip charge pump, rated to operate over the voltage range of the device
for byte or word operations.
PORTA is a 6-bit wide, bidirectional port. The corresponding data direction register is
TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA pin an input (i.e., put
the corresponding output driver in a High-Impedance mode). Clearing a TRISA bit (= 0) will
make the corresponding PORTA pin an output (i.e., put the contents of the output latch on the
selected pin). Reading the PORTA register reads the status of the pins, whereas writing to it
will write to the port latch. All write operations are read-modify-write operations. Therefore,
26
a write to a port implies that the port pins are read, the value is modified and then written to
the port data latch. Pin RA4 is multiplexed with the Timer0 module clock input to become
the RA4/T0CKI pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open-drain
output.
All other PORTA pins have TTL input levels and full CMOS output drivers. Other
PORTA pins are multiplexed with analog inputs and the analog VREF input for both the A/D
converters and the comparators. The operation of each pin is selected by clearing/setting the
appropriate control bits in the ADCON1 and/or CMCON registers.
The TRISA register controls the direction of the port pins even when they are being used as
analog inputs. The user must ensure the bits in the TRISA register are maintained set when
using them as analog inputs.
PORTB is an 8-bit wide, bidirectional port. The corresponding data direction register is
TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB pin an input (i.e., put
the corresponding output driver in a High-Impedance mode). Clearing a TRISB bit (= 0) will
make the corresponding PORTB pin an output (i.e., put the contents of the output latch on the
selected pin). Three pins of PORTB are multiplexed with the In-Circuit Debugger and LowVoltage Programming function: RB3/PGM, RB6/PGC and RB7/PGD.
Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all
the pull-ups. This is performed by clearing bit RBPU (OPTION_REG<7>). The weak pull-up
is automatically turned off when the port pin is configured as an output. The pull-ups are
disabled on a Power-on Reset.
27
Four of the PORTB pins, RB7:RB4, have an interrupton- change feature. Only pins
configured as inputs can cause this interrupt to occur (i.e., any RB7:RB4 pin configured as an
output is excluded from the interrupton- change comparison). The input pins (of RB7:RB4)
are compared with the old value latched on the last read of PORTB. The mismatch outputs
of RB7:RB4 are ORed together to generate the RB port change interrupt with flag bit RBIF
(INTCON<0>).
PORTC is an 8-bit wide, bidirectional port. The corresponding data direction register is
TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input (i.e., put
the corresponding output driver in a High-Impedance mode). Clearing a TRISC bit (= 0) will
make the corresponding PORTC pin an output (i.e., put the contents of the output latch on the
selected pin).
PORTC is multiplexed with several peripheral functions. PORTC pins have Schmitt
Trigger input buffers. When the I2C module is enabled, the PORTC<4:3> pins can be
configured with normal I2C levels, or with SM Bus levels, by using the CKE bit
(SSPSTAT<6>). When enabling peripheral functions, care should be taken in defining TRIS
bits for each PORTC pin. Some peripherals override the TRIS bit to make a pin an output,
while other peripherals override the TRIS bit to make a pin an input. Since the TRIS bit
override is in effect while the peripheral is enabled, read-modify write instructions (BSF,
BCF, XORWF) with TRISC as the destination, should be avoided. The user should refer to
the corresponding peripheral section for the correct TRIS bit settings.
28
PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is individually
configurable as an input or output. PORTD can be configured as an 8-bit wide
microprocessor port (Parallel Slave Port) by setting control bit, PSPMODE (TRISE<4>). In
this mode, the input buffers are TTL.
29
Register 4-1 shows the TRISE register which also controls the Parallel Slave Port
operation. PORTE pins are multiplexed with analog inputs. When selected for analog input,
these pins will read as 0s. TRISE controls the direction of the RE pins, even when they are
being used as analog inputs. The user must make sure to keep the pins configured as inputs
when using them as analog inputs.
30
A write to the PSP occurs when both the CS and WR lines are first detected low. When
either the CS or WR lines become high (level triggered), the Input Buffer Full (IBF) status
flag bit (TRISE<7>) is set on the Q4 clock cycle, following the next Q2 cycle, to signal the
write is complete . The interrupt flag bit, PSPIF (PIR1<7>), is also set on the same Q4 clock
cycle.
IBF can only be cleared by reading the PORTD input latch. The Input Buffer Overflow
(IBOV) status flag bit (TRISE<5>) is set if a second write to the PSP is attempted when the
previous byte has not been read out of the buffer. A read from the PSP occurs when both the
CS and RD lines are first detected low. The Output Buffer Full (OBF) status flag bit
(TRISE<6>) is cleared immediately indicating that the PORTD latch is waiting to be read by
the external bus. When either the CS or RD pin becomes high (level triggered), the interrupt
flag bit PSPIF is set on the Q4 clock cycle, following the next Q2 cycle, indicating that the
read is complete. OBF remains low until data is written to PORTD by the user firmware.
When not in PSP mode, the IBF and OBF bits are held clear. However, if flag bit IBOV
was previously set, it must be cleared in firmware. An interrupt is generated and latched into
flag bit PSPIF when a read or write operation is completed. PSPIF must be cleared by the
user in firmware and the interrupt can be disabled by clearing the interrupt enable bit PSPIE
(PIE1<7>).
31
CPU
All PIC16F87XA devices have a host of features intended to maximize system reliability,
minimize cost through elimination of external components, provide power saving operating
modes and offer code protection. These are:
Oscillator Selection
Reset
- Power-on Reset (POR)
- Power-up Timer (PWRT)
- Oscillator Start-up Timer (OST)
- Brown-out Reset (BOR)
Interrupts
Watchdog Timer (WDT)
Sleep
Code Protection
ID Locations
In-Circuit Serial Programming
Low-Voltage In-Circuit Serial Programming
In-Circuit Debugger
PIC16F87XA devices have a Watchdog Timer which can be shut-off only through
configuration bits. It runs off its own RC oscillator for added reliability. There are two
timers that offer necessary delays on power-up. One is the Oscillator Start-up Timer (OST),
intended to keep the chip in Reset until the crystal oscillator is stable. The other is the Powerup Timer (PWRT), which provides a fixed delay of 72 ms (nominal) on power-up only. It is
designed to keep the part in Reset while the power supply stabilizes. With these two timers
on-chip, most applications need no external Reset circuitry. Sleep mode is designed to offer a
very low current power-down mode. The user can wake-up from Sleep through external
32
Reset, Watchdog Timer wake-up or through an interrupt. Several oscillator options are also
made available to allow the part to fit the application. The RC oscillator option saves system
cost while the LP crystal option saves power. A set of configuration bits is used to select
various options.
Configuration Bits
The configuration bits can be programmed (read as 0), or left un programmed (read as
1) to select various device configurations. The erased or un programmed value of the
Configuration Word register is 3FFFh. These bits are mapped in program memory location
2007h. It is important to note that address 2007h is beyond the user program memory space
which can be accessed only during programming.
bit 13 CP: Flash Program Memory Code Protection bit 1 = Code protection off 0 = All
program memory code-protected
bit 12 Unimplemented: Read as 1
bit 11 DEBUG: In-Circuit Debugger Mode bit
1 = In-Circuit Debugger disabled, RB6 and RB7 are general purpose I/O pins
0 = In-Circuit Debugger enabled, RB6 and RB7 are dedicated to the debugger
bit 10-9 WRT1:WRT0 Flash Program Memory Write Enable bits
For PIC16F876A/877A:
11 = Write protection off; all program memory may be written to by EECON control
10 = 0000h to 00FFh write-protected; 0100h to 1FFFh may be written to by EECON control
01 = 0000h to 07FFh write-protected; 0800h to 1FFFh may be written to by EECON control
00 = 0000h to 0FFFh write-protected; 1000h to 1FFFh may be written to by EECON control
For PIC16F873A/874A:
11 = Write protection off; all program memory may be written to by EECON control
10 = 0000h to 00FFh write-protected; 0100h to 0FFFh may be written to by EECON control
01 = 0000h to 03FFh write-protected; 0400h to 0FFFh may be written to by EECON control
00 = 0000h to 07FFh write-protected; 0800h to 0FFFh may be written to by EECON control
bit 8 CPD: Data EEPROM Memory Code Protection bit
1 = Data EEPROM code protection off
0 = Data EEPROM code-protected
bit 7 LVP: Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit
1 = RB3/PGM pin has PGM function; low-voltage programming enabled
0 = RB3 is digital I/O, HV on MCLR must be used for programming
bit 6 BOREN: Brown-out Reset Enable bit
1 = BOR enabled
0 = BOR disabled
bit 5-4 Unimplemented: Read as 1
bit 3 PWRTEN: Power-up Timer Enable bit
1 = PWRT disabled
0 = PWRT enabled
bit 2 WDTEN: Watchdog Timer Enable bit
1 = WDT enabled
33
0 = WDT disabled
bit 1-0 FOSC1:FOSC0: Oscillator Selection bits
11 = RC oscillator
10 = HS oscillator
01 = XT oscillator
00 = LP oscillator
4.9 Reset
The PIC16F87XA differentiates between various kinds of Reset:
Power-on Reset (POR)
MCLR Reset during normal operation
MCLR Reset during Sleep
WDT Reset (during normal operation)
WDT Wake-up (during Sleep)
Brown-out Reset (BOR)
34
Some registers are not affected in any Reset condition. Their status is unknown on POR
and unchanged in any other Reset. Most other registers are reset to a Reset state on Poweron Reset (POR), on the MCLR and WDT Reset, on MCLR Reset during Sleep and Brownout
Reset (BOR). They are not affected by a WDT wake-up which is viewed as the resumption of
normal operation. The TO and PD bits are set or cleared differently in different Reset
situations as indicated in These bits are used in software to determine the nature of the Reset.
MCLR
PIC16F87XA devices have a noise filter in the MCLR Reset path. The filter will detect
and ignore small pulses. It should be noted that a WDT Reset does not drive MCLR pin low.
The behavior of the ESD protection on the MCLR pin differs from previous devices of
this family. Voltages applied to the pin that exceed its specification can result in both Resets
and current consumption outside of device specification during the Reset event. For this
reason, Microchip recommends that the MCLR pin no longer be tied directly to VDD.
VBOR. The Power-up Timer then keeps the device in Reset for TPWRT (parameter #33,
about 72 mS). If VDD should fall below VBOR during TPWRT, the Brown-out Reset
process will restart when VDD rises above VBOR with the Power-up Timer Reset. The
Power-up Timer is always enabled when the Brown-out Reset circuit is enabled, regardless of
the state of the PWRT configuration bit.
CHAPTER-5
SOFTWARE STUDY
5.1 EMBEDDED C
Embedded C is a set of language extensions for the C Programming language by the C
Standards committee to address commonality issues that exist between C extensions for
different embedded systems. Historically, embedded C programming requires nonstandard
extensions to the C language in order to support exotic features such as fixed-point
arithmetic, multiple distinct memory banks, and basic I/O operations.
In 2008, the C Standards Committee extended the C language to address these issues by
providing a common standard for all implementations to adhere to. It includes a number of
features not available in normal C, such as, fixed-point arithmetic, named address spaces, and
basic I/O hardware addressing.
Embedded C uses most of the syntax and semantics of standard C, e.g., main() function,
variable definition, data type declaration, conditional statements (if, switch, case), loops
(while, for), functions, arrays and strings, structures and union, bit operations, macros.
38
STEP:1
39
STEP:3&4
40
STEP:6-8
41
STEP:9
42
STEP:10-12
43
STEP:13-14
44
STEP:15-17
45
STEP:18-19
46
STEP:20-22
47
STEP:23
48
STEP:24
49
CHAPTER 6
CONCLUSION
This paper elaborates the design and construction of automatic street control system
circuit. Circuit works properly to turn street lamp ON/OFF. After designing the circuit which
controls the light of the street as illustrated in the previous sections. LDR sensor and the
photoelectric sensors are the two main conditions in working the circuit. If the two conditions
have been satisfied the circuit will do the desired work according to specific program. Each
sensor controls the turning ON or OFF the lighting column. The street lights has been
successfully controlled by microcontroller. With commands from the controller the lights will
be ON in the places of the movement when it's dark. Further more the drawback of the street
light system using timer controller has been overcome, where the system depends on
photoelectric sensor. Finally this control circuit can be used in a long roadways between the
cities.
FUTURE ENHANCEMENT
Wireless is the buzz of communication industry today. The field of
wireless communication is growing leaps and bounds day by day. There have been many
advancements taking place in the semiconductor industry leading to more and more
advancements in wireless technology.
The main aim of the project is to save the power, by using effectively we can save
more power, as we know that there is shortage of power nowadays in every where mostly in
villages etc. So to overcome that we can provide street lights automatically with the
centralized intelligent systems. So in future we can design many more advanced technologies
to save power.
50
CHAPTER 7
REFERENCES
[1] D. A. Devi and A. Kumar, Design and Implementation of CPLD based Solar Power
Saving System for Street Lights and Automatic Traffic Controller, International Journal of
Scientific and Research Publications, Vol. 2, Issue11, November 2012.
[2] J. Mohelnikova, Electric Energy Savings and Light Guides, Energy& Environment, 3rd
IASME/WSEAS International Conference on, Cambridge, UK, February 2008, pp.470-474.
[3] M. A. Wazed, N. Nafis, M. T. Islam and A. S. M. Sayem, Design and Fabrication of
Automatic Street Light Control System, Engineering e-Transaction, Vol. 5, No. 1, June 2010,
pp 27-34.
[4] R. Priyasree, R. Kauser, E. Vinitha and N. Gangatharan, Automatic Street Light Intensity
Control and Road Safety Module Using Embedded System, International Conference on
Computing and Control Engineering, April 2012.
[5] K. S. Sudhakar, A. A. Anil, K. C. Ashok and S. S. Bhaskar, Automatic Street Light
Control System, International Journal of Emerging Technology and Advanced Engineering,
Vol. 3, May 2013, PP. 188-189.
[6] K.Y. Rajput, G. Khatav, M. Pujari, P. Yadav, Intelligent Street Lighting System Using
Gsm, International Journal of Engineering Science Invention, Vol2, Issue 3, March 2013, PP.
60- 69.
[7] M. Popa, C. Cepic, Energy Consumption Saving Solutions Based on Intelligent Street
Lighting Control System. U.P.B. Sci. Bull., Vol. 73, April 2011, PP. 297-308.
[8] R. Mohamaddoust, A. T. Haghighat, M. J. M. Sharif and N. Capanni, A Novel Design of
an Automatic Lighting Control System for a Wireless Sensor Network with Increased Sensor
Lifetime and Reduced Sensor Numbers, Sensors, Vol. 11, PP. 8933-8952.
[9] L. Jasio, T. Wilmshurst, D. Ibrahim, J. Morton, M. Bates, J. Smith D. Smith and C.
Hellebuyck, PIC Microcontrollers: know it all, Publishing Elsevier Science, 2008.
[10] W. Bolton. Instrumentation and Control Systems, Elsevier Science & Technology
Books, August 2004. [11] PIC16F87XA Data Sheet. 2003 Microchip Technology.
51
52