Page 1
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
1. INTRODUCTION
This project includes the designing of multiple sensor data acquisition and simulating its
components using EMBEDDED SYSTEM. An Embedded System is a combination of
computer hardware and software, and perhaps additional mechanical or other parts, designed
to perform a specific function. An embedded system is a microcontroller-based, software
driven, reliable, real-time control system, autonomous, or human or network interactive,
operating on diverse physical variables and in diverse environments and sold into a
competitive and cost conscious market.
An embedded system is not a computer system that is used primarily for processing, not a
software system on PC or UNIX, not a traditional business or scientific application. High-end
embedded & lower end embedded systems. High-end embedded system - Generally 32, 64
Bit Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc.
Lower end embedded systems - Generally 8,16 Bit Controllers used with an minimal
operating systems and hardware layout designed for the specific purpose. Examples Small
controllers and devices in our everyday life like Washing Machine, Microwave Ovens, where
they are embedded in.
Page | 1
Page 2
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
2. HARDWARE DESCRIPTION
2.1 Block Diagram
Fig 2.1: Block Diagram
Page | 2
Page 3
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
2.1.1 PowerSupply
The circuit uses standard power supply comprising of a step-down transformer from 230v to
12v and 4 diodes forming a Bridge Rectifier that delivers pulsating dc which is then filtered
by an electrolytic capacitor of about 470microf to 100microF. The filtered dc being
unregulated IC LM7805 is used to get 5v constant at its pin no 3 irrespective of input dc
varying from 9v to 14v. The input dc shall be varying in the event of input ac at 230volts
section varies in the ratio of v1/v2=n1/n2.
The regulated 5volts dc is further filtered by a small electrolytic capacitor of 10 micro f for
any noise so generated by the circuit. One LED is connected of this 5v point in series with a
resistor of 330ohms to the ground i.e. negative voltage to indicate 5v power supply
availability. The 5v dc is at 12v point is used for other applications as on when required.
2.1.2 Transisor Acting As Switch
An NPN transistor is "on" when its base is pulled high relative to the emitter. The arrow in
the NPN transistor symbol is on the emitter leg and points in the direction of the conventional
current flow when the device is in forward active mode. Whenever base is high, then current
starts flowing through base and emitter and after that only current will pass from collector to
emitter.
Fig 2.1.2: Transistor as a switch
Page | 3
Page 4
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
2.1.3 IR & Photo Diode Sensing Switch
IR diode is connected through a resistance to the dc supply. A photo diode is connected in
reverse biased condition through a potential divider of a 10k variable resistance and 1k in
series to the base of the transistor. While the IR rays fall on the reverse biased photo diode it
conducts that causes a voltage at the base of the transistor. The transistor then works like a
switch while the collector goes to ground. Once the IR rays are obstructed the driving voltage
is not available to the transistor thus its collector goes high. This low to high logic can be
used for the microcontroller input for any action as per the program.
Fig 2.1.3: IR & Photo Diode Sensing Switch
2.1.4 Connections
The output of the power supply which is 5v is connected to 11 and 32 pins of micro
controller and GND is connected to its 12 and 31 pins. port C and D up to RD5 of micro
controller are connected to street lights. Port B is used as input port.
2.1.5 Working
The highway model consists of 14 leds as streetlights and 8 pairs of photodiodes-IR diodes
used as sensors, variable resistors and transistors which acts as switch as explained above.
The IR diodes are placed on one side of the road and photodiodes are placed on the other side
of the road, directly facing the IR diodes.
Consider the case when there is no vehicle on the highway. In this case, the IR radiation
emitted from the IR diode directly falls on the photodiode which is exactly opposite to it.
This causes the photodiode to fall in conduction state. This implies that photodiode conducts
and current passes through it. The current passes through the photodiode and goes through
the variable resistor and the base-emitter region of the transistor. This in turn connects the
Page | 4
Page 5
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
collector of the transistor to the emitter. From the circuit diagram we can see that emitter is
connected to ground which implies that the collector also goes to the ground. The collector
region of the transistor is connected to the port B (input port) which in turn goes to ground
i.e., logic ZERO. So, to summarize we can say that, when there is no vehicle on the highway,
then all the inputs to the microcontroller port B is ZERO.
Consider the case when a vehicle obstructs the IR radiation path. In this case, IR radiation is
blocked and hence it does not fall on the photodiode. This in turn implies that photodiode
doesn't conduct. Hence there is no current flowing through this first transistor. So, the
collector is at HIGH state. Let us assume that the first Photodiode-IR diode pair IR path is
obstructed. This leads to a transition from ZERO to HIGH at RB0 pin.
The microcontroller is programmed in such a way that, whenever the pin RB0 goes high, then
a window of seven led lights ahead from the vehicle glows. In other words, the respective
pins of port C and port D go HIGH. This process goes on i.e., as the vehicle moves forward,
the street lights ahead of it glows and the trailing lights goes back to its original off state.
There are two basic modes of operation,
1. Transition of streetlights from dim to bright state.
2. Transition of streetlights from dark to bright state.
1. In the first mode of operation, initially when the vehicle is not sensed, all the streetlights
will be in dim state. This is achieved by use of pulse width modulation technique through the
program stored in the microcontroller. When a vehicle is not present on the highway, then the
streetlights are made to glow for about 1ms and then for 100ms they are switched off. Thus,
we get streetlights with less brightness. When a vehicle is sensed, all the streetlights are
illuminated for 1ms and the window of streetlights are illuminated for 100ms. Thus we have a
PWM wave of 99% duty cycle for those seven leds.
2. In the second mode of operation, when the vehicle is not present, all the streetlights will be
in dark state. When a vehicle is sensed then the window of streetlights is illuminated in front
of the vehicle.
Page | 5
Page 6
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
2.2 COMPONENT DESCRIPTION
2.2.1 Transformer
Transformers convert AC electricity from one voltage to another with a little loss of power.
Step-up transformers increase voltage, step-down transformers reduce voltage. Most power
supplies use a step-down transformer to reduce the dangerously high voltage to a safer low
voltage. Transformers waste very little power so the power out is (almost) equal to the power
in. The ratio of the number of turns on each coil, called the turn’s ratio, determines the ratio
of the voltages. A step-down transformer has a large number of turns on its primary (input)
coil which is connected to the high voltage mains supply, and a small number of turns on its
secondary (output) coil to give a low output voltage.
Fig 2.2.1: Transformer
2.2.2 Voltage Regulator
The LM78XX/LM78XXA series of three-terminal positive regulators are available in the
TO-220/D-PAK package and with several fixed output voltages, making them useful in a
Wide range of applications. Each type employs internal current limiting, thermal shutdown
and safe operating area protection, making it essentially indestructible. If adequate heat
sinking is provided, they can deliver over 1A output Current. Although designed primarily as
fixed voltage regulators, these devices can be used with external components to obtain
adjustable voltages and currents.
Page | 6
Page 7
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Fig 2.2.2: Voltage Regulator
2.2.3 Rectifier
A rectifier is an electrical device that converts alternating current (AC), which periodically
reverses direction, to direct current (DC), current that flows in only one direction, a process
known as rectification. Rectifiers have many uses including as components of power supplies
and as detectors of radio signals. Rectifiers may be made of solid state diodes, vacuum tube
diodes, mercury arc valves, and other components. The output from the transformer is fed to
the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full
wave rectifier. In this project, a bridge rectifier is used because of its merits like good
stability and full wave rectification. In positive half cycle only two diodes( 1 set of parallel
diodes) will conduct, in negative half cycle remaining two diodes will conduct and they will
conduct only in forward bias only.
Fig 2.2.3: Rectifier
Page | 7
Page 8
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
2.2.4 Filter
Capacitive filter is used in this project. It removes the ripples from the output of rectifier and
smoothens the D.C. Output received from this filter is constant until the mains voltage and
load is maintained constant. However, if either of the two is varied, D.C. voltage received at
this point changes. Therefore a regulator is applied at the output stage.
The simple capacitor filter is the most basic type of power supply filter. The use of this filter
is very limited. It is sometimes used on extremely high-voltage, low-current power supplies
for cathode-ray and similar electron tubes that require very little load current from the supply.
This filter is also used in circuits where the power-supply ripple frequency is not critical and
can be relatively high. Below figure can show how the capacitor changes and discharges.
Fig 2.2.4: Filter
2.2.5 Photodiodes
A photodiode is a type of photo detector capable of converting light into either current or
voltage, depending upon the mode of operation. Photodiodes are similar to regular
semiconductor diodes except that they may be either exposed (to detect vacuum UV or X-
rays) or packaged with a window or optical fibre connection to allow light to reach the
sensitive part of the device. Many diodes designed for use specifically as a photodiode will
also use a PIN junction rather than the typical PN junction.
Fig 2.2.5: Photodiode
Page | 8
Page 9
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
2.2.6 Push buttons
Fig 2.2.6: Push Buttons
A push-button or simply button is a simple switch mechanism for controlling some aspect of
a machine or a process. Buttons are typically made out of hard material, usually plastic or
metal. The surface is usually flat or shaped to accommodate the human finger or hand, so as
to be easily depressed or pushed. Buttons are most often biased switches, though even many
un-biased buttons (due to their physical nature) require a spring to return to their un-pushed
state. Different people use different terms for the "pushing" of the button, such as press,
depress, mash, and punch.
In industrial and commercial applications push buttons can be linked together by a
mechanical linkage so that the act of pushing one button causes the other button to be
released. In this way, a stop button can "force" a start button to be released. This method of
linkage is used in simple manual operations in which the machine or process have no
electrical circuits for control.
Pushbuttons are often color-coded to associate them with their function so that the operator
will not push the wrong button in error. Commonly used colors are red for stopping the
machine or process and green for starting the machine or process.
Red pushbuttons can also have large heads (mushroom shaped) for easy operation and to
facilitate the stopping of a machine. These pushbuttons are called emergency stop buttons and
are mandated by the electrical code in many jurisdictions for increased safety. This large
mushroom shape can also be found in buttons for use with operators who need to wear gloves
for their work and could not actuate a regular flush-mounted push button. As an aid for
operators and users in industrial or commercial applications, a pilot light is commonly added
to draw the attention of the user and to provide feedback if the button is pushed. Typically
this light is included into the center of the pushbutton and a lens replaces the pushbutton hard
center disk.
Page | 9
Page 10
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
The source of the energy to illuminate the light is not directly tied to the contacts on the back
of the pushbutton but to the action the pushbutton controls. In this way a start button when
pushed will cause the process or machine operation to be started and a secondary contact
designed into the operation or process will close to turn on the pilot light and signify the
action of pushing the button caused the resultant process or action to start.
In popular culture, the phrase "the button" refers to a (usually fictional) button that a military
or government leader could press to launch nuclear weapons.
2.2.7 Push to ON button:
Fig 2.2.7: Push ON Button
Initially the two contacts of the button are open. When the button is pressed they become
connected. This makes the switching operation using the push button.
2.2.8 Mosfet
The metal–oxide–semiconductor field-effect transistor (MOSFET, MOS-FET, or MOS FET)
is a device used for amplifying or switching electronic signals. The basic principle of the
device was first proposed by Julius Edgar Lilienfeld in 1925. In MOSFET’s, a voltage on the
oxide-insulated gate electrode can induce a conducting channel between the two other
contacts called source and drain. The channel can be of n-type or p-type and is accordingly
called an nMOSFET or a pMOSFET. It is by far the most common transistor in both digital
and analog circuits, though the bipolar junction transistor was at one time much more
common. A variety of symbols are used for the MOSFET. The basic design is generally a line
for the channel with the source and drain leaving it at right angles and then bending back at
right angles into the same direction as the channel. Sometimes three line segments are used
for enhancement mode and a solid line for depletion mode.
Comparison of enhancement-mode and depletion-mode MOSFET symbols, along with JFET
symbols (drawn with source and drain ordered such that higher voltages appear higher on the
page than lower voltages).
Page | 10
Page 11
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Fig 2.2.8: MOSFET as switch
In this circuit arrangement an Enhancement-mode N-channel MOSFET is being used to
switch a simple lamp "ON" and "OFF" (could also be an LED). The gate input voltage VGS is
taken to an appropriate positive voltage level to turn the device and the lamp either fully
"ON", (VGS = +ve) or a zero voltage level to turn the device fully "OFF", (VGS = 0).
If the resistive load of the lamp was to be replaced by an inductive load such as a coil or
solenoid, a "Flywheel" diode would be required in parallel with the load to protect the
MOSFET from any back-emf. Above shows a very simple circuit forswitching a resistive
load such as a lamp or LED. But when using power MOSFET's to switch either inductive or
Page | 11
Page 12
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
capacitive loads some form of protection is required to prevent the MOSFET device from
becoming damaged.
Driving an inductive load has the opposite effect from driving a capacitive load. For example,
a capacitor without an electrical charge is a short circuit, resulting in a high "inrush" of
current and when we remove the voltage from an inductive load we have a large reverse
voltage build up as the magnetic field collapses, resulting in an induced back-emf in the
windings of the inductor.
For the power MOSFET to operate as an analogue switching device, it needs to be switched
between its "Cut-off Region" where VGS = 0 and its "Saturation Region" where VGS (on) = +ve.
The power dissipated in the MOSFET (PD) depends upon the current flowing through the
channel ID at saturation and also the "ON-resistance" of the channel given as RDS (on).
2.2.9 IR transmitter and IR receiver
IR Transmitter Module is designed for IR communication which is widely used for operating
the television device wirelessly from a short line-of-sight distance. The remote control is
usually contracted to remote. Since infrared (IR) remote controls use light, they require line
of sight to operate the destination device. The signal can, however, be reflected by mirrors,
just like any other light source. If operation is required where no line of sight is possible, for
instance when controlling equipment in another room or installed in a cabinet, many brands
of IR extenders are available for this on the market. Most of these have an IR receiver,
picking up the IR signal and relaying it via radio waves to the remote part, which has an IR
transmitter mimicking the original IR control. Infrared receivers also tend to have a more or
less limited operating angle, which mainly depends on the optical characteristics of the
phototransistor. However, it’s easy to increase the operating angle using a matte transparent
object in front of the receiver.
Page | 12
Page 13
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
3. SOFTWARE DESCRIPTION
Using MPLAB software tool, a digital system can be designed and simulated. Then the
system can be implemented in EMBEDDED KIT.
3.1 Introduction to MPLAB
MPLAB IDE is a software program that runs on a PC to develop applications for Microchip
microcontrollers. It is called an Integrated Development Environment, or IDE, because it
provides a single integrated environment to develop code for embedded microcontrollers.
MPLAB IDE is a wrapper that coordinates all the tools from a single graphical user interface,
usually automatically. For instance, once code is written, it can be converted to executable
instructions and downloaded into a microcontroller to see how it works. In this process
multiple tools are needed: an editor to write the code, a project manager to organize files and
settings, a compiler or assembler to convert the source code to machine code and some sort of
hardware or software that either connects to a target microcontroller or simulates the
operation of a microcontroller.
3.2 Project Manager
The project manager organizes the files to be edited and other associated files so they can be
sent to the language tools for assembly or compilation, and ultimately to a linker. The linker
has the task of placing the object code fragments from the assembler, compiler and libraries
into the proper memory areas of the embedded controller, and ensures that the modules
function with each other. This entire operation from assembly and compilation through the
link process is called a project build.
From the MPLAB IDE project manager, properties of the language tools can be invoked
differently for each file, if desired, and a build process integrates all of the language tools
operations.
The source files are text files that are written conforming to the rules of the assembler or
compiler. The assembler and compiler convert them into intermediate modules of machine
code and placeholders for references to functions and data storage. The linker resolves these
placeholders and combines all the modules into a file of executable machine code. The linker
Page | 13
Page 14
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
also produces a debug file which allows MPLAB IDE to relate the executing machine codes
back to the source files. A text editor is used to write the code. It is not a normal text editor,
but an editor specifically designed for writing code for Microchip MCUs. It recognizes the
constructs in the text and uses colour coding to identify various elements, such as instruction
mnemonics, C language constructs and comments. The editor supports operations commonly
used in writing source code, such as finding matching braces in C, commenting and un-
commenting out blocks of code, finding text in multiple files and adding special bookmarks.
After the code is written, the editor works with the other tools to display code execution in the
debugger. Breakpoints can be set in the editor, and the values of variables can be inspected by
hovering the mouse pointer over the variable name. Names of variables can be dragged from
source text windows and then dropped into a Watch window.
3.3 Device Programming
After the application has been debugged and is running in the development environment, it
needs to be tested on its own. A device can be programmed with the in-circuit debugger or a
device programmer. MPLAB IDE can be set to the programmer function, and the part can be
burned. The target application can now be observed in its nearly final state. Engineering
prototype programmers allow quick prototypes to be made and evaluated. Some applications
can be programmed after the device is soldered on the target PC board. Using In-Circuit Serial
Programming (ICSPô) programming capability, the firmware can be programmed into the
application at the time of manufacture, allowing updated revisions to be programmed into an
embedded application later in its life cycle. Devices that support in-circuit debugging can
even be plugged back into the MPLAB ICD 2 after manufacturing for quality tests and
development of next generation firmware.
3.4 Components of MPLAB IDE
The MPLAB IDE has both built-in components and plug-in modules to configure the system
for a variety of software and hardware tools.
Page | 14
Page 15
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
3.4.1 MPLAB IDE Built-In Components
The built-in components consist of:
Project Manager
The project manager provides integration and communication between the IDE and the
language tools.
Editor
The editor is a full-featured programmer's text editor that also serves as a window into the
debugger.
Assembler/Linker and Language Tools
The assembler can be used stand-alone to assemble a single file, or can be used with the
linker to build a project from separate source files, libraries and recompiled objects. The
linker is responsible for positioning the compiled code into memory areas of the target
microcontroller.
Debugger
The Microchip debugger allows breakpoints, single stepping, watch windows and all the
features of a modern debugger for the MPLAB IDE. It works in conjunction with the editor to
reference information from the target being debugged back to the source code.
Execution Engines
There are software simulators in MPLAB IDE for all PIC micro MCU and dsPIC DSC
devices. These simulators use the PC to simulate the instructions and some peripheral
functions of the PIC micro MCU and dsPIC DSC devices. Optional in-circuit emulators and
in-circuit debuggers are also available to test code as it runs in the applications hardware.
3.4.2 Additional Optional Components for MPLAB IDE
Optional components can be purchased and added to the MPLAB IDE:
Compiler Language Tools
MPLAB C18 and MPLAB C30 C compilers from Microchip provide fully integrated,
Page | 15
Page 16
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
optimized code. Along with compilers from HI-TECH, IAR, micro Engineering Labs, CCS
and Byte Craft, they are invoked by the MPLAB IDE project manager to compile code that is
automatically loaded into the target debugger for instant testing and verification.
Programmers
PICSTART Plus, PIC kit 1 and 2, PRO MATE II, MPLAB PM3 as well as MPLAB ICD 2
can program code into target devices. MPLAB IDE offers full control over programming both
code and data, as well as the Configuration bits to set the various operating modes of the
target microcontrollers or digital signal controllers.
In-Circuit Emulators
MPLAB ICE 2000 and MPLAB ICE 4000 are full-featured emulators for the PIC micro
MCU and dsPIC DSC devices. They connect to the PC via I/O ports and allow full control
over the operation of microcontroller in the target applications.
In-Circuit Debugger
MPLAB ICD 2 provides an economic alternative to an emulator. By using some of the on-
chip resources, MPLAB ICD 2 can download code into a target microcontroller inserted in
the application, set breakpoints, single step and monitor registers and variables.
3.5 MPLAB IDE Features and Installation
MPLAB IDE is a WindowsÆ Operating System (OS) based Integrated Development
Environment for the PIC micro MCU families and the dsPIC Digital Signal Controllers. The
MPLAB IDE provides the ability to:
Create and edit source code using the built-in editor.
Assemble, compile and link source code.
Debug the executable logic by watching program flow with the built-in simulator or in
real time with in-circuit emulators or in-circuit debuggers.
Make timing measurements with the simulator or emulator.
View variables in Watch windows.
Program firmware into devices with device programmers (for details, consult the user
is guide for the specific device programmer).
Page | 16
Page 17
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
3.6 Design Flow of the Above Program in MPLAB IDE
STEP 1: To start MPLAB IDE, double click on the icon installed on the desktop after
installation or select Start>Programs>Microchip>MPLAB IDE vx.xx>MPLAB IDE. A screen
will display the MPLAB IDE logo followed by the MPLAB IDE desktop.
STEP 2: Choose the Select Device entry in the Configure menu, it would be written as
Configure>Select Device. Choose Configure>Select Device.
STEP 3: Create a project using the Project Wizard. Choose Project>Project Wizard. From
the Welcome dialog, click on Next> to advance.
Page | 17
Page 18
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
STEP 4: Step Two of the Project Wizard sets up the language tools that are used with this
project. Select Microchip MPASM Toolsuite in the Active Toolsuite list box.
STEP 5: To name the project and put it into a folder.
Page | 18
Page 19
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
STEP 6: Allows file selection for the project. A source file has not yet been selected, so we
will use an MPLAB IDE template file.
STEP 7: Press Add>> to move the file name to the right panel, and click on the checkbox at
the start of the line with the file name to enable this file to be copied to our project directory.
Page | 19
Page 20
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
STEP 8: Write down the code
STEP 9: Then press Next> to finish the Project Wizard. The final screen of the Project
Wizard is a summary showing the selected device, the tool suite and the new project file
name.
Page | 20
Page 21
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
STEP 10: After pressing the Finish button, review the Project Window on the MPLAB IDE
desktop. If the Project Window is not open, select View>Project.
3.7 Building The Project
From the Project menu, we can assemble and link the current files. They donít have any of
our code in them yet, but this ensures that the project is set up correctly.
To build the project, select either:
Page | 21
Page 22
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Project>Build All
Right click on the project name in the project window and select Build All
Click the Build All icon on the Project toolbar. Hover the mouse over icons to see
pop-up text of what they represent.
The Output window shows the result of the build process. There should be no errors on any
step. The warnings listed in Figure will not interfere with the operation of the tutorial pro-
gram. They are merely identifying a directive that has been deprecated, i.e., is being
discontinued in favor of another. To turn off the display of warnings, do the following:
Select Project>Build Options>Project and click on the MPASM Assembler tab.
Select ìOutputî from the ìCategoriesî drop-down list.
Select ìErrors onlyî from the ìDiagnostic levelî drop-down list.
Click OK.
0
3.8. CREATING CODE
Open the template file in the project by double clicking on its name in the Project Window, or
by selecting it with the cursor and using the right mouse button to bring up the context menu.
Page | 22
Page 23
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
4. ADVANTAGES AND DISADVANTAGES
Advantages
Page | 23
Page 24
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Major advantages of street lighting includes: prevention of accidents and increase in safety.
Studies have shown that darkness results in a large number of crashes and fatalities,
especially those involving pedestrians; pedestrian fatalities are 3 to 6.75 times more likely in
the dark than in daylight. Street lighting has been found to reduce pedestrian crashes by
approximately 50%.Furthermore, lighted intersections and highway interchanges tend to have
fewer crashes than unlighted intersections and interchanges.
Towns, cities, and villages use the unique locations provided by light poles to hang
decorative or commemorative banners.Many communities in the U.S. use light poles as a tool
for fund raising via light pole banner sponsorship programs first designed by a U.S. based
light pole banner manufacturer.
Disadvantages
The major criticisms of street lighting are that it can actually cause accidents if misused, and
cause light pollution.
There are two optical phenomena that need to be recognized in street light installations.
The loss of night vision because of the accommodation reflex of drivers' eyes is the
greatest danger. As drivers emerge from an unlighted area into a pool of light from a
street light their pupils quickly constrict to adjust to the brighter light, but as they
leave the pool of light the dilation of their pupils to adjust to the dimmer light is much
slower, so they are driving with impaired vision. As a person gets older the eye's
recovery speed gets slower, so driving time and distance under impaired vision
increases.
Oncoming headlights are more visible against a black background than a grey one.
The contrast creates greater awareness of the oncoming vehicle.
Stray voltage is also a concern in many cities. Stray voltage can accidentally electrify
light poles and has the potential to injure or kill anyone who comes into contact with
the pole. Some cities have employed the Electrified Cover Safeguard(TM) technology
which sounds an alarm and flashes a light, to warn the public, when a pole becomes
dangerously electrified.
Page | 24
Page 25
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
There are also physical dangers. Street light stanchions (poles) pose a collision risk to
motorists and pedestrians, particularly those affected by poor eyesight or under the influence
of alcohol. This can be reduced by designing them to break away when hit (frangible or
collapsible supports), protecting them by guardrails, or marking the lower portions to increase
their visibility. High winds or accumulated metal fatigue also occasionally topple street
lights.
5. CONCLUSION
Embedded systems are real time operating system. Embedded systems are electronic devices
Page | 25
Page 26
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
that incorporate a computer (usually a microcontroller) within their implementation.
Embedded system contains programmed instruction running via processor chips. They
perform control, protection and monitoring tasks. Embedded systems are programmable
devices or systems which are generally used to control or monitor things like processes
machinery, environmental equipment and communications.with the help of embedded
systems and mplab ide we are able to design street light that glows show the road ahead for
1/2KM only on sensing vehicles or any movement successfully.
6. APPENDIX
Page | 26
Page 27
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
APPENDIX-A
KA78XX/KA78XXA3-Terminal 1A Positive Voltage Regulator
Features
• Output Current up to 1A
• Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
• Thermal Overload Protection
• Short Circuit Protection
• Output Transistor Safe Operating Area Protection
Page | 27
Page 28
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Page | 28
Page 29
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
1N4001 THRU 1N4007
Features
• The plastic package carries Underwriters laboratory Flamability Classification
94v-0
• Low cost construction utilizing void-free molded plastic technique
• Diffused junction
• Low reverse leakage
• High current capability
• Easy cleaned wit Freon, Alcohol, Chlorothen and similar solvents
• High temperature soldering guaranteed:265 degree centigrade/.375”(9.5mm)
lead lengths at 5 lbs(2.3 kg) tension
Maximum ratings and electrical characteristics
Ratings at 25 deg C ambient temperature unless otherwise specified. Single phase,
half wave, 60 Hz, resistive or inductive load. For capacitive load moderate current by
20%.
Light Dependent Resister
Page | 29
Page 30
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Page | 30
Page 31
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
LED
A Light emitting diode (LED) is essentially a pn junction diode. When carriers are injected
across a forward-biased junction, it emits incoherent light. Most of the commercial LEDs are
realized using a highly doped n and a p Junction.
To understand the principle, let’s consider an unbiased pn+ junction. The depletion region
extends mainly into the p-side. There is a potential barrier from Ec on the n-side to the Ec on
Page | 31
Page 32
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
the p-side, called the built-in voltage,V0. This potential barrier prevents the excess free
electrons on the n+ side from diffusing into the p side.When a Voltage V is applied across the
junction, the built-in potential is reduced from V0 to V0 – V. This allows the electrons from
the n+ side to get injected into the p-side. Since electrons are the minority carriers in the p-
side, this process is called minority carrier injection. But the hole injection from the p side to
n+ side is very less and so the current is primarily due to the flow of electrons into the p-side.
These electrons injected into the p-side recombine with the holes. This recombination results
in spontaneous emission of photons (light). This effect is called injection
electroluminescence. These photons should be allowed to escape from the device without
being reabsorbed.
The recombination can be classified into the following two kinds
• Direct recombination
• Indirect recombination
Direct Recombination:
In direct band gap materials, the minimum energy of the conduction band lies directly above
the maximum energy of the valence band in momentum space energy. In this material, free
electrons at the bottom of the conduction band can recombine directly with free holes at the
top of the valence band, as the momentum of the two particles is the same. This transition
from conduction band to valence band involves photon emission (takes care of the principle
of energy conservation). This is known as direct recombination. Direct recombination occurs
spontaneously. GaAs is an example of a direct band-gap material.
Page | 32
Page 33
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Indirect Recombination
In the indirect band gap materials, the minimum energy in the conduction band is shifted by a
k-vector relative to the valence band. The k-vector difference represents a difference in
momentum. Due to this difference in momentum, the probability of direct electronhole
recombination is less.
In these materials, additional dopants(impurities) are added which form very shallow donor
states. These donor states capture the free electrons locally; provides the necessary
momentum shift for recombination. These donor states serve as the recombination centers.
This is called Indirect (non-radiative) Recombination.
Figure3 shows the E-k plot of an indirect band gap material and an example of how Nitrogen
serves as a recombination center in GaAsP. In this case it creates a donor state, when SiC is
doped with Al, it recombination takes place through an acceptor level.
The wavelength of the light emitted, and hence the color, depends on the band gap energy
of the materials forming the p-n junction.
The emitted photon energy is approximately equal to the band gap energy of the
semiconductor. The following equation relates the wavelength and the energy band gap.
hν = Eg
hc/λ = Eg
λ = hc/ Eg
Where h is Plank’s constant, c is the speed of the light and Eg is the energy band gap. Thus, a
semiconductor with a 2 eV band-gap emits light at about 620 nm, in the red. A 3 eV band-gap
Page | 33
Page 34
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
material would emit at 414 nm, in the violet. Appendix 4 shows a list of semiconductor
materials and the corresponding colors.
QSD2030F Plastic Silicon Photodiode
Features
• PIN photodiode
• Package type: T-1 3/4 (5mm lens diameter)
• Wide reception angle, 40°
• Daylight filter
• Package material and color: black epoxy
• High sensitivity
• Peak sensitivity λ= 880nm
• Radiant sensitive area: 1mm x 1mm
Absolute Maximum Ratings (TA= 25°C unless otherwise specified)
Stresses exceeding the absolute maximum ratings may damage the device. The device may
not function or be operable above the recommended operating conditions and stressing the
parts to these levels is not recommended.\In addition, extended exposure to stresses above the
recommended operating conditions may affect device reliability.The absolute maximum
ratings are stress ratings only.= 25°C unless otherwise specified) Stresses exceeding the
absolute maximum ratings may damage the device. The device may not function or be
operable above the recommended operating conditions and stressing the parts to these levels
is not recommended.
In addition, extended exposure to stresses above the recommended operating conditions may
affect device reliability.The absolute maximum ratings are stress ratings only.
Page | 34
Page 35
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
AMPLIFIER TRANSISITORS
NPN Silicon
Page | 35
Page 36
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Page | 36
Page 37
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
PLASTIC INFRARED LIGHT EMITTING DIODE
Description
The QED233 / QED234 is a 940 nm GaAs / AlGaAs LED encapsulated in a clear untinted,
plastic T-1 3/4 package.
Page | 37
Page 38
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Features
• Chip material =GaAs with AlGaAs window
• Package type: T-1 3/4 (5mm lens diameter)
• Matched Photosensor: QSD122/123/124
• Medium Emission Angle, 40°
• High Output Power
• Package material and color: Clear, untinted, plastic
• Ideal for remote control applications
Page | 38
Page 39
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
1206 Package Silicon PIN Photodiode
Features
• Fast response time
• High photo sensitivity
• Small junction capacitance
• Package in 8mm tape on 7“ diameter reel.
Description
PD15-22B/TR8 is a high speed and high sensitive PIN photodiode in miniature flat top view
lens SMD package and it is molded in a black transparent plastic. The device is spectrally
matched with the infrared emitting diode.
Applications
• High speed photo detector
• Copier
• Optoelectronic switch
Page | 39
Page 40
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
1206 Package Silicon PIN Photodiode
PIC16F87XA
High-Performance RISC CPU
• Only 35 single-word instructions to learn
• All single-cycle instructions except for program branches, which are two-cycle
• Operating speed: DC – 20 MHz clock input DC – 200 ns instruction cycle
• Up to 8K x 14 words of Flash Program Memory, Up to 368 x 8 bytes of Data
Memory
(RAM), Up to 256 x 8 bytes of EEPROM Data Memory
• Pinout compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX
microcontroller
Peripheral Features
• Timer0: 8-bit timer/counter with 8-bit prescaler
• Timer1: 16-bit timer/counter with prescaler, can be incremented during Sleep via
external
crystal/clock
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
• Two Capture, Compare, PWM modules
- Capture is 16-bit, max. resolution is 12.5 ns
- Compare is 16-bit, max. resolution is 200 ns
- PWM max. resolution is 10-bit
Page | 40
Page 41
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
• Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™ (Master/Slave)
• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit
address detection
• Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls (40/44-
pin only)
• Brown-out detection circuitry for Brown-out Reset (BOR)
Analog Features
• 10-bit, up to 8-channel Analog-to-Digital Converter (A/D)
• Brown-out Reset (BOR)
• Analog Comparator module with:
- Two analog comparators
- Programmable on-chip voltage reference (VREF) module
- Programmable input multiplexing from device inputs and internal voltage reference
- Comparator outputs are externally accessible
Special Microcontroller Features
• 100,000 erase/write cycle Enhanced Flash program memory typical
• 1,000,000 erase/write cycle Data EEPROM memory typical
• Data EEPROM Retention > 40 years
• Self-reprogrammable under software control
• In-Circuit Serial Programming™ (ICSP™) via two pins
• Single-supply 5V In-Circuit Serial Programming
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
• Programmable code protection
• Power saving Sleep mode
• Selectable oscillator options
• In-Circuit Debug (ICD) via two pins
CMOS Technology
• Low-power, high-speed Flash/EEPROM technology
• Fully static design
• Wide operating voltage range (2.0V to 5.5V)
• Commercial and Industrial temperature ranges
Page | 41
Page 42
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
Pin Diagram
Page | 42
Page 43
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
PIC16F873A/876A devices are available only in 28-pin packages, while
PIC16F874A/877A devices are avail- able in 40-pin and 44-pin packages. All devices in
the PIC16F87XA family share common architecture with the following differences:
• The PIC16F873A and PIC16F874A have one-half of the total on-chip memory of
the PIC16F876A and PIC16F877A.
• The 28-pin devices have three I/O ports, while the 40/44-pin devices have five.
• The 28-pin devices have fourteen interrupts, while the 40/44-pin devices have
fifteen.
• The 28-pin devices have five A/D input channels, while the 40/44-pin devices
have eight.
• The Parallel Slave Port is implemented only on the 40/44-pin devices.
Page | 43
Page 44
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
APPENDIX-B
MPLAB IDE code for Street Light that Glows Showing the road Ahead for 1/2KM
only on Sensing Vehicles or any Movement
#include<16F877A.h>
#include<string.h>
#use delay(clock=4000000)
#byte portb = 6
#byte port1 = 7
#byte port2 = 8
void main{}
{
set_tris_b(0xff);
set_tris_c(0x00);
set_tris_d(0x00);
set_tris_e(0x00);
portb=0xFF;
leds1=0x00;
leds2=0x00;
output_high(PIN_E0);
while(true)
{
while(input(PIN_E0))
{
if(input(PIN_B0))
{
leds1=0x7F;
leds2=0x00;
}
Page | 44
Page 45
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
if(input(PIN_B1))
{
leds1=0xFE;
leds2=0x00;
}
if(input(PIN_B2))
{
leds1=0xFC;
leds2=0x01;
}
if(input(PIN_B3))
{
leds1=0xF8;
leds2=0x03;
}
if(input(PIN_B4))
{
leds1=0xF0;
leds2=0x07;
}
if(input(PIN_B5))
{
leds1=0xE0;
leds2=0x0F;
}
if(input(PIN_B6))
{
leds1=0xC0;
leds2=0x1F;
}
if(input(PIN_B7))
{
leds1=0x80;
leds2=0x3F;
Page | 45
Page 46
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
}
if(portb==0x00))
{
leds1=0x00;
leds2=0x00;
}
}
while(input(PIN_E0))
{
if(input(PIN_B0))
{
leds1=0xFF;
leds2=0xFF;
delay_ms(1);
leds1=0x7F;
leds2=0x00;
delay_ms(10);
{
if(input(PIN_B1))
{
leds1=0xFF;
leds2=0xFF;
delay_ms(1);
leds1=0xFE;
leds2=0x00;
delay_ms(10);
}
if(input(PIN_B2))
{
leds1=0xFF;
leds2=0xFF;
delay_ms(1);
leds1=0xFC;
Page | 46
Page 47
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
leds2=0x01;
delay_ms(10);
}
if(input(PIN_B3))
{
leds1=0xFF;
leds2=0xFF;
delay_ms(1);
leds1=0xF8;
leds2=0x03;
delay_ms(10);
}
if(input(PIN_B4))
{
leds1=0xFF;
leds2=0xFF;
delay_ms(1);
leds1=0xF0;
leds2=0x07;
delay_ms(10);
}
if(input(PIN_B5))
{
leds1=0xFF;
leds2=0xFF;
delay_ms(1);
leds1=0xE0;
leds2=0x0F;
delay_ms(10);
}
if(input(PIN_B6))
{
leds1=0xFF;
leds2=0xFF;
Page | 47
Page 48
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
delay_ms(1);
leds1=0xC0;
leds2=0x1F;
delay_ms(10);
}
if(input(PIN_B7))
{
leds1=0xFF;
leds2=0xFF;
delay_ms(1);
leds1=0x80;
leds2=0x3F;
delay_ms(10);
}
if(port==0x00)
{
leds1=0xFF;
leds2=0xFF;
delay_ms(1);
leds1=0x00;
leds2=0x00;
delay_ms(10);
}
}
}
}
Page | 48
Page 49
STREET LIGHT THAT GLOWS SHOWING THE ROAD AHEAD FOR 1/2KM ONLY ON SENSING VEHICLES OR ANY MOVEMENT
6. REFERENCES
www.atmel.com
Jhon crisp” Introduction to microprocessor and micro controller”
A.P Godse and d.A Godse “Microprocessor and micro controller by”
www.beyondlogic.org
www.howstuffworks.com
www.engineersgarage.com
Page | 49