Street Light Glow On Detecting Vechile Movement Using Sensor.
Street Light Glow On Detecting Vechile Movement Using Sensor.
Movement
Group Members
Supervisor
CERTIFICATE......................................................................................................................i
Abstract................................................................................................................................ii
Acknowledgements (optional)............................................................................................iii
List of Figures.....................................................................................................................vi
List of Tables.....................................................................................................................vii
Chapter 1 Introduction......................................................................................................1
1.1 Motivations...........................................................................................……….. 1
1.2 Objectives and Scope..........................................................................................1
1.3 Organisations.......................................................................................................1
Chapter 2 Literature Review.............................................................................................2
2.1 Introduction............................................................................................................2
2.2 List of Components used........................................................................................2
2.3 Microcontroller.......................................................................................................2
2.4 Physical Characteristics..........................................................................................2
2.5 IR Sensor Circuit Diagram and Working Principle................................................2
Group Members
Supervisor
HOD Signature
Supervisor Signature
i
UNDERTAKING
We certify that research work titled “ Street Light that Glow on Detection
Vehicle Movement” is our own work. The work has not been presented
elsewhere for assessment. Where material has been used from other
sources it has been properly acknowledged /referred.
ii
Abstract
iii
Acknowledgements
I would also like to pay special thanks to HOD Electrical Dr. Fazli Qayum
Yousafzai for his tremendous support and cooperation. I appreciate his patience
and guidance throughout the whole thesis and project.
I would also like to thank Engr. Ahmad Bilal for being my thesis guidance and
evaluation committee.
DEDICATION
This is dedicated to our respected, supervisor, our inspiring teachers and HOD, those
who helped us and our prestigious institute
iv
v
List of Figures
Figure 2.1: Arduino mega2560..........................................................................................10
Figure 2.2: IR Sensor........................................................................................................13
Figure 2.3: IR Sensor 2.....................................................................................................16
Figure 2.4: IR Sensor circut .............................................................................................21
Figure 2.5: Gas Analyzer..................................................................................................25
Figure 2.6 Ir image device.................................................................................................26
Figure 2.7: Pin diagram of 16X2 line LCD.......................................................................36
Figure 2.8: SIM900 pin diagram.......................................................................................39
Figure 2.9: Voltage Regulator 7805..................................................................................43
Figure 2. 10: Relay “JQC-3FC (T73)”..............................................................................44
Figure 2.11: 4 - pin relay...................................................................................................53
Figure2.13 : JQC-3FC(T73)..............................................................................................54
Figure 2. 14:Back view of JQC-3FC(T73)........................................................................56
Figure 2.15:Relay driver ic circuit....................................................................................60
Figure 3.2.1: Circuit Design..............................................................................................61
Figure 3.2.2: Circuit Design with Relay............................................................................61
Figure 3.5: Virtual cellular network..................................................................................61
Figure 3.6: Two ways of constructing MCNs...................................................................63
Figure 3.7: Illustration of the UCAN architecture............................................................64
Figure 3.8: Illustration of the CMCN architecture............................................................66
Figure 3.9: Illustration of inter-microcell handoff in CMCN...........................................67
Figure 3.10: Cell and multihop cell in HMCN..................................................................69
vi
List of Tables
Table 2-1: Represents the Components of Street lights glow on detection of vehicle......30
Table 3-1: Comparison of selected MCN architectures....................................................74
Table 4-1: Call blocking with different (N0, N1) combinations at ρ=5 Erlangs...............103
Table 4-2: System capacity for uplink and downlink vs. channel combinations............107
Table 5-1: Interference Information Table for uplink......................................................113
Table 5-2: Interference Constraint Table for the simulated network...............................113
Table 5-3: Packing-based Channel Searching for uplink................................................116
Table 6-1: System parameters for TDD CDMA systems................................................139
Table 6-2: Supported number of simultaneous voice users.............................................146
Table A-1: Example of uplink call combinations for state (8,2,1,2,1,3,2)......................164
Table B-1: Example of downlink call combinations for state (24,2,1,2,1,3,2)...............168
vii
Chapter 1
Introduction
1.1 Motivations
Now a day the demand of electricity is increasing day by day and frequent
power cut is causing many problems in various areas like industries, hospitals
and houses. An alternative arrangement for power source is thus desirable.
Due to short fall of energy and power so we need to save energy as much we
can in all fields of utilization of power, our team has noticed that lot of energy
has been wasted in street light system. No of high voltage consuming bulbs
and lights are connected in street lights and working. These lights working
throughout the night even if there is no vehicle on the road so, when there is
no vehicle on the road lot of energy is wasted. Then we started to work on
such project in which we can save energy which is wasting in street lights.
After lot of research and hard work me and my team find solution and design
this project.
1
agriculture productivity & better quality of life of the people. This has increased the
demand for commercial energy considerably.
In order to improve the energy situation, some steps have been taken for efficient
utilization uninterrupted power supply. The solar and wind have received particular
attention [14-16]. Since 1981, eighteen PV systems for rural electrification and/or
water supplies have been installed. There are four desalination plants, including a
6000 gallon per day for Pakistan navy. Out of seven wind systems two generates
18kW and five are used for water pumping. Apart from solar and wind, biogas has
also made mentionable contribution. [17]
only a block of street lights ahead of vehicle, and to switch OFF the trailing
2
During night all the lights on the highway remain ON for the vehicles, but lots
The main objective of this project is to save power or electricity. As here in Pakistan
load shedding is increasing day by day, and due to this interruption we cannot
complete our daily routine works. In universities, colleges, houses and hospitals
everywhere there is massive need of all the time presence of electricity. In universities
students need to complete their lectures or they need to do some practical works in
laboratories so there must be presence of electricity, because all the equipments works
on the electricity so if there is no electricity there will be no work in laboratories, or if
there is interruption in electricity there will be interruption in work or may be the
whole work done by student is lost.
In our hospitals we have huge machineries and medical equipments these all the
equipments works on electricity, and in hospitals patient are being admitted to recover
their health, and also operations are being done in hospitals and there we need all time
electricity we cannot afford a single minute of electricity because all the operation
accessories work on electricity so we need a 1complete electricity there, a single
minute of load shedding can damage a life there. The same case is for houses in our
houses we all have bought accessories that work on electricity, so we need
uninterrupted supply of electricity in our houses. Microwave oven, iron, washing
machines, stitching machines, computers etc all work on electricity so there a must
need of saving power.
3
Our main concern is to save electricity by this project. We use I.Cs and sensors in
street light systems to make it advance street lightning system. This system would we
Chapter 2
Hardware Architecture
2.1 Introduction
The main components of this project is AT mega2560, IR sensor (IR receiver and IR
Transmitter) and LED,s. During the development of hardware we had to face many
challenges e.g. design of a circuit and collection of components was one of the big
issue. We had to visit different markets inside and outside the city for this purpose.
Once all circuit components were collected then implementations of different circuits
becomes the next challenge. But all these hurdles were crossed by the passage of time
and with the help of our project supervisor. So under the scope of this chapter we will
see the different stages of hardware development. We will discuss the circuit
components with their role in the project and function.
4
2.2 List of Components used:
Following are the list of major components used for Street lights glow on detection of
vehicle, Table 2. 1 Represents the Components of Street lights glow on detection of
vehicle
01 Microcontroller ATMEGA-2560 1
02 Relays JQC-3F(T73) 4
04 Transistor C945
05 LCD 16X2 01
06 Capacitor 100uf
07 Resistors 04
5
08 LED
12 Regulator 7805 01
13 Adopter 12volt 01
14 GSM Sim900
2.1 Microcontroller:
2.3.1: Introduction
A microcontroller is a self-contained system with peripherals, memory and a
processor that can be used as an embedded system. Most programmable
microcontrollers that are used today are embedded in other consumer products or
machinery including phones, peripherals, automobiles and household appliances for
computer systems. Due to that, another name for a microcontroller is "embedded
controller." Some embedded systems are more sophisticated, while others have
minimal requirements for memory and programming length and a low software
complexity. Input and output devices include solenoids, LCD displays, relays,
switches and sensors for data like humidity, temperature or light level, amongst
others.
6
refine your search results according to the required specifications. Programmable
microcontrollers contain general purpose input/output pins. The number of these pins
varies depending on the microcontroller. They can be configured to an input or an
output state by software. When configured to an input state, these pins can be used to
read external signals or sensors. When they are configured to the output state, they
can drive external devices like LED displays and motors.
It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16
analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB
connection, a power jack, an ICSP header, and a reset button.
7
Analog Input Pins 16 DC
SRAM 8 KB
EEPROM 4 KB
2.3.3.2: Power
The Arduino Mega can be powered via the USB connection or with an external power
supply. The power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or
battery. The adapter can be connected by plugging a 2.1mm centre-positive plug into
8
the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin
headers of the POWER connector.
The board can operate on an external supply of 6 to 15 volts. If supplied with less than
7V, however, the 5V pin may supply less than five volts and the board may be
unstable. If using more than 12V, the voltage regulator may overheat and damage the
board. The recommended range is 7 to 12 volts.
VIN. The input voltage to the Arduino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying
voltage via the power jack, access it through this pin.
5V. this pin outputs a regulated 5V from the regulator on the board. The board
can be supplied with power either from the DC power jack (7 - 12V), the USB
connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via
the 5V or 3.3V pins bypasses the regulator, and can damage your board. We
don't advise it.
3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current
draw is 50 mA.
GND. Ground pins.
IOREF. This pin on the Arduino board provides the voltage reference with
which the microcontroller operates. A properly configured shield can read the
IOREF pin voltage and select the appropriate power source or enable voltage
translators on the outputs for working with the 5V or 3.3V.
2.3.3.3: Memory
The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is
used for the boot loader), 8 KB of SRAM and 4 KB of EEPROM (which can be read
9
and written with the EEPROM library).
Each of the 54 digital pins on the Mega can be used as an input or output, using pin
Mode (), digital Write (), and digital Read () functions. They operate at 5 volts. Each
pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 kohms. In addition, some pins have specialized
functions:
10
The Mega2560 has 16 analog inputs, each of which provides 10 bits of resolution (i.e.
1024 different values). By default they measure from ground to 5 volts, though is it
possible to change the upper end of their range using the AREF pin and
analogReference () function.
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add
a reset button to shields which block the one on the board.
2.3.3.5: Communication
A Software Serial library allows for serial communication on any of the Mega2560's
digital pins.
The ATmega2560 also supports TWI and SPI communication. The Arduino software
includes a Wire library to simplify use of the TWI bus; For SPI communication, use
the SPI library.
11
2.3.3.6: Programming
The Arduino Mega can be programmed with the Arduino software (download).
The ATmega2560 on the Arduino Mega comes preburned with a boot loader that
allows you to upload new code to it without the use of an external hardware
programmer. It communicates using the original STK500 protocol.
You can also bypass the boot loader and program the microcontroller through the
ICSP (In-Circuit Serial Programming) header using Arduino ISP or similar;
The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is
available in the Arduino repository. The ATmega16U2/8U2 is loaded with a DFU
boot loader, which can be activated by:
On Rev1 boards: connecting the solder jumper on the back of the board (near
the map of Italy) and then resetting the 8U2.
On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB
line to ground, making it easier to put into DFU mode. You can then
use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X
and Linux) to load a new firmware. Or you can use the ISP header with an
external programmer (overwriting the DFU boot loader).
Rather than requiring a physical press of the reset button before an upload, the
Arduino Mega2560 is designed in a way that allows it to be reset by software running
on a connected computer. One of the hardware flow control lines (DTR) of the
ATmega8U2 is connected to the reset line of the ATmega2560 via a 100 Nano farad
capacitor. When this line is asserted (taken low), the reset line drops long enough to
reset the chip. The Arduino software uses this capability to allow you to upload code
by simply pressing the upload button in the Arduino environment. This means that the
12
boot loader can have a shorter timeout, as the lowering of DTR can be well-
coordinated with the start of the upload.
This setup has other implications. When the Mega2560 is connected to either a
computer running Mac OS X or Linux, it resets each time a connection is made to it
from software (via USB). For the following half-second or so, the boot loader is
running on the Mega2560. While it is programmed to ignore malformed data (i.e.
anything besides an upload of new code), it will intercept the first few bytes of data
sent to the board after a connection is opened. If a sketch running on the board
receives one-time configuration or other data when it first starts, make sure that the
software with which it communicates waits a second after opening the connection and
before sending this data.
The Mega2560 contains a trace that can be cut to disable the auto-reset. The pads on
either side of the trace can be soldered together to re-enable it. It's labelled "RESET-
EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor
from 5V to the reset line.
The Arduino Mega2560 has a resettable poly fuse that protects your computer's USB
ports from shorts and over current. Although most computers provide their own
internal protection, the fuse provides an extra layer of protection. If more than 500
mA is applied to the USB port, the fuse will automatically break the connection until
the short or overload is removed.
13
Diecimila or Duemilanove. Digital pins 0 to 13 (and the adjacent AREF and GND
pins), analog inputs 0 to 5, the power header, and ICSP header are all in equivalent
locations. Further the main UART (serial port) is located on the same pins (0 and 1),
as are external interrupts 0 and 1 (pins 2 and 3 respectively). SPI is available through
the ICSP header on the Mega2560 and Duemilanove / Diecimila. Please note that I2C
is not located on the same pins on the Mega (20 and 2) as the Duemilanove /
Diecimila (analog inputs 4 and 5).
14
detected by an infrared sensor. The emitter is simply an IR LED (Light
Emitting Diode) and the detector is simply an IR photodiode which is
sensitive to IR light of the same wavelength as that emitted by the IR LED.
When IR light falls on the photodiode, the resistances and these output
voltages, change in proportion to the magnitude of the IR light received.
IR Sensor
15
IR Sensor Circuit
In this project, the transmitter section includes an IR sensor, which transmits
continuous IR rays to be received by an IR receiver module. An IR output terminal of
the receiver varies depending upon its receiving of IR rays. Since this variation cannot
be analyzed as such, therefore this output can be fed to a comparator circuit. Here an
operational amplifier (op-amp) of LM 339 is used as comparator circuit.
When the IR receiver does not receive a signal, the potential at the inverting input
goes higher than that non-inverting input of the comparator IC (LM339). Thus the
output of the comparator goes low, but the LED does not glow. When the IR receiver
module receives signal to the potential at the inverting input goes low. Thus the output
of the comparator (LM 339) goes high and the LED starts glowing. Resistor R1
(100 ), R2 (10k ) and R3 (330) are used to ensure that minimum 10 mA current passes
through the IR LED Devices like Photodiode and normal LEDs respectively. Resistor
VR2 (preset=5k ) is used to adjust the output terminals. Resistor VR1 (preset=10k ) is
used to set the sensitivity of the circuit Diagram. Read more about IR sensors.
2.5.1:Different Types of IR Sensors and Their Applications
IR sensors are classified into different types depending on the applications. Some of the typical
applications of different types of sensors are
The speed sensor is used for synchronizing the speed of multiple motors. The temperature sensor is
used for industrial temperature control. PIR sensor is used for automatic door opening system and
Ultrasonic sensor are used for distance measurement.
IR sensors are used in various Sensor based projects and also in various electronic devices which
measures the temperature that are discussed in the below.
16
IR sensors are used in radiation thermometers to measure the temperature depend
upon the temperature and the material of the object and these thermometers have
some of the following features
• Faster response
Flame Monitors
These types of devices are used for detecting the light emitted from the flames and to
monitor how the flames are burning. The Light emitted from flames extend from UV
to IR region types. PbS, PbSe, Two-color detector, pyro electric detector are some of
the commonly employed detector used in flame monitors.
Moisture analyzers use wavelengths which are absorbed by the moisture in the IR
region. Objects are irradiated with light having these wavelengths(1.1 µm, 1.4 µm, 1.9
µm, and 2.7µm) and also with reference wavelengths. The Lights reflected from the
objects depend upon the moisture content and is detected by analyzer to measure
moisture (ratio of reflected light at these wavelengths to the reflected light at
reference wavelength). In GaAs PIN photodiodes, Pbs photoconductive detectors are
employed in moisture analyzer circuits.
IR sensors are used in gas analyzers which use absorption characteristics of gases in
the IR region. Two types of methods are used to measure the density of gas such as
dispersive and non dispersive.
17
Fig: 2.4 Gas Analyzer
This type of configuration is commonly referred to as non dispersive infrared (NDIR) technology. This
type of analyzer is used for carbonated drinks, whereas non dispersive analyzer is used in most of the
commercial IR instruments, for an automobile exhaust gas fuel leakages.
For examples Water, rocks, soil, vegetation, an atmosphere, and human tissue all
features emit IR radiation. The Thermal infrared detectors measure these radiations in
IR range and map the spatial temperature distributions of the object/area on an image.
Thermal imagers usually composed of a Sb (indium antimonite), Gd Hg (mercury-
doped germanium), Hg Cd Te (mercury-cadmium-telluride) sensors.
18
Thus, this is all about IR sensor circuit with working and applications. These sensors
are used in many sensor based electronics projects.
LCD:
A liquid crystal display (LCD) is a thin, flat display device made up of any number of
color or monochrome pixels arrayed in front of a light source or reflector. Each pixel
consists of a column of liquid crystal molecules suspended between two transparent
electrodes, and two polarizing filters, the axes of polarity of which are perpendicular
to each other. Without the liquid crystals between them, light passing through one
would be blocked by the other. The liquid crystal twists the polarization of light
entering one filter to allow it to pass through the other.
Many microcontroller devices use 'smart LCD' displays to output visual information.
LCD displays designed around Hitachi's LCD HD44780 module, are inexpensive,
easy to use, and it is even possible to produce a readout using the 8x80 pixels of the
display. They have a standard ASCII set of characters and mathematical symbols. For
an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit data
bus it only requires the supply lines plus seven extra lines. When the LCD display is
not enabled, data lines are tri-state and they do not interfere with the operation of the
microcontroller. Data can be placed at any location on the LCD. For 16×2 LCD, the
address locations are:
First line 80 81 82 83 84 85 86 through 8F
Second line C0 C1 C2 C3 C4 C5 C6 through CF
1) Enable (E)
This line allows access to the display through R/W and RS lines. When this line is
19
low, the LCD is disabled and ignores signals from R/W and RS. When (E) line is
high, the LCD checks the state of the two control lines and responds accordingly.
2) Read/Write (R/W)
This line determines the direction of data between the LCD and microcontroller.
When it is low, data is written to the LCD. When it is high, data is read from the LCD.
20
5) Set E line to low
Pin Description:
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins
(Two pins are extra in both for back-light LED connections).
Opto-coupler (PC817):
PC817 is a standard optocoupler; we use this IC to isolate two parts of a circuit.
Isolation prevents ground loops and transmission of unwanted noise.
Input LED has a forward voltage of 1.2 V and a forward current of 50mA. A current
limiting resistor must be used to prevent input LED to be blow out.
Frequency depends on the pull up resistor we use on the output transistor.
Features of PC817:
1. Current transfer ratio
21
Applications:
1. Computer terminals.
2. System appliances, measuring instruments.
3. Registers, copiers, automatic vending machines.
4. Electric home appliances such as fan, heaters etc.
5. Signal transmission between circuits of different potentials and impedances.
Description:
SIMCom presents an ultra compact and reliable wireless module. The SIM900A is a
complete Dual-band GSM/GPRS module in a SMT type which is designed especially
for Chinese market, allowing you to benefit from small dimensions and cost-effective
solutions.
22
Fig: 2.8 SIM900 pin diagram
Features:
Class 1 (1 W @ 1800/1900MHz)
23
Commands)
Regulator (7805):
The voltage source in a circuit may have fluctuations and would not give the fixed
voltage output.
Capacitors of suitable values can be connected at input and output pins depending
upon the respective voltage levels.
Name
24
1 Input voltage (5V-18V) Input
Relay (SPDT):
The Single Pole Double Throw SPDT relay is quite useful in certain applications
because of its internal configuration.
one can be Normally Closed and the other one is opened or it can be
Normally Open and the other one closed.
So basically you can see the SPDT relay as a way of switching between 2 circuits:
when there is no voltage applied to the coil one circuit “receives” current, the
other one doesn’t and when the coil gets energized the opposite is happening.
In this project we are using the relay JQC-3FC (T73). This relay has
following properties.
25
Relay Operations:
All relays operate using the same basic principle. Our example will use a commonly
used 4 - pin relay. Relays have two circuits: A control circuit (shown in GREEN) and
a load circuit (shown in RED). The control circuit has a small control coil while the
load circuit has a switch. The coil controls the operation of the switch.
When no voltage is applied to pin 1, there is no current flow through the coil. No
current means no magnetic field is developed, and the switch is open. When voltage is
supplied to pin 1, current flow though the coil creates the magnetic field needed to
close the switch allowing continuity between pins 2 and 4.
26
Relay De Energized (OFF):
When current stops flowing through the control circuit, pins 1 and 3, the relay
becomes de- energized. Without the magnetic field, the switch opens and current is
prevented from flowing through pins 2 and 4. The relay is now OFF.
Relay Applications:
Relays are remote control electrical switches that are controlled by another switch,
such as a horn switch or a computer as in a power train control module. Relays allow
a small current flow circuit to control a higher current circuit. Several designs of
relays are in use today, 3- pin, 4-pin, 5-pin, and 6-pin, single switch or dual switches.
27
Properties of JQC-3FC(T73):
MAX. SWITCHING CURRENT:7A, 10A
MAX. SWITCHING VOLTAGE:28V DC/ 250V AC
DIELECTRIC STRENGTH VR.M.S: BETWEEN OPEN CONTACTS
=750VAC; BETWEEN COIL AND CONTACTS =1000VAC; BETWEEN
CONTACTS FORM =1000VAC
AMBIENT TEMPERATURE: -40°C to +85°C
OPERATION/RELEASE TIME:=10/8MS
CONTACT CAPACITY: 10A 125V, 7A 250V
28
relays.
While working on electronics projects which used microcontroller, we need to use
relays to control AC loads or high voltage loads. Relays are used to provide isolation
between microcontroller’s circuits and high voltage operating loads. Microcontrollers
are only used to provide on/off signals to relays. Microcontrollers don’t have enough
current sourcing ability to derive relays. Therefore relay driver circuits IC is used to
derive relays properly. There are many ways to design relay driver circuits. But
dedicated relay driver circuits integrated circuits are available which serve the
purpose of relay driver IC. Relay driver circuit IC ULN2003 is one of popular relay
driver circuits.
29
30
Chapter 3
The principle behind the working of the project lies in the functioning of IR Sensor. We
are going to use a Transmissive type IR Sensor in this project.
In Transmissive IR Sensor, the IR transmitter and receiver are placed facing each other so
that IR receiver always detects IR Rays emitted by the IR Transmitter.
If there is an obstacle between the IR Transmitter and Receiver, the IR Rays are blocked
by the obstacle and the IR Receiver stops detecting the IR Rays.
This can be configured to turn ON or OFF the LEDs (or street lights) with the help of
microcontroller.
31
FIGURE 3.2.1
FIGURE 3.2.2
The main components of the project are AT89C52 Microcontroller, IR Sensor (IR
Transmitter and IR Receiver) and LEDs.
The basic connections required for 8051 Microcontroller involve crystal, reset and
External Access.
In order to use the on-chip oscillator, the 8051 microcontroller requires an external clock.
This is provided by a crystal oscillator. An 11.0592MHz quartz crystal is connected to
XTAL1 and XTAL2 pins with two 22pF ceramic capacitors connected to it.
The reset circuit of the microcontroller consists of a 10K resistor, 10uF capacitor and a
push button. All the connections of the reset circuit are shown in the circuit diagram.
External access Pin is used to access external memory when it is connected to ground.
Anyway, we are not going to use any external memory here. So, connect this pin to Vcc
via a 10K resistor.
32
The next hard ware we are going to connect is the IR Receiver. We are going to connect
the 8 IR receivers to port 0 pins of the microcontroller. In order to use the PORT0 as I/O
port, we need to connect external pullup resistors to the port 0 pins.
After that, connect the output of the IR receiver i.e. anode terminal of the photo diode to
port 0 pins. Cathode terminals of the photo diodes are connected to supply. Also, a 3.3k
Resistor is connected between the anode terminal and ground.
The next part of the circuit is IR transmitter. IR transmitter is not a part of the
microcontroller connections as the only job of the IR transmitter is to continuously emit
infrared rays.
Finally, we need to connect the LEDs. We need to connect the LED’s with the help of
transistors to the PORT2 of the microcontroller. The base of the 8 2N2222 transistors is
connected to the PORT 2 of the microcontroller while the emitters of the transistors are
connected to ground.
An LED along with a series current limiting resistor of 100 ohms is connected to the each
of the collector terminal of the transistor.
3.3 Working
The aim of this project is to design a street light control system using 8051
microcontroller, which automatically turns on or off the street lights by detecting the
movement of vehicles.
The IR transmitter is placed directly in line of sight with IR receiver, so that the IR
receiver continuously receives infrared rays. Once the IR receiver receives infrared rays,
the microcontroller will detect Logic 1. If the infrared rays are blocked by some means,
the microcontroller will detect logic 0.
So, the program for the microcontroller must be written in such a way that it will turn ON
the LEDs, which means here the street lamp, when it detects Logic 0 and it will turn OFF
the LEDs, when it detects Logic 1.
33
Consider the two IR sensors i.e. IR Transmitter and IR Receiver are placed on the either
side of the road. As per the circuit diagram, the IR receivers are connected to the PORT0
and the LEDs are connected to the PORT2 of the microcontroller.
At the beginning, when there is no obstacle, the IR receiver continuously detects IR light
transmitted by the IR Transmitter. When a car or any other vehicle blocks any of the IR
sensor, the microcontroller will turn ON the immediate three LEDs.
If the car blocks the first IR sensor, the first three LEDs are turned ON by the
microcontroller. As the car moves forward and blocks the second IR sensor, the
corresponding next three LEDs will be turned ON and the first LED of the previous set is
turned OFF. The process continues this way for all the IR Sensors and LEDs.
Chapter 4
4.1 Conclusions
This project smart power consumption system is a cost effective, eco-friendly and the
safest way to utilization of solar energy.
It clearly tackles the two problems that world is facing today, saving of energy & global
warming, very efficiently.
According to statistical data we can save more that 70 % of electrical energy that is now
consumed by the street light.
Initial cost and maintenance can be the draw backs of this project.
With the advances in renewable technology and good resource planning the cost of the
project can be cut down and also with the use of good equipment the maintenance can
also be reduced in terms of periodic checks.
The LEDs have long life, emit cool light, donor have any toxic material and can be used
for fast switching.
For these reasons our project presents far more advantages which can over shadow the
34
present limitations.
Keeping in view the long term benefits and the initial cost would never be a problem as
the investment return time is very less.
The project has scope in various other applications like for providing lighting in
industries, campuses, office and parking lots of huge shopping malls.
This can also be used for surveillance in corporate campuses and industries
Street-lights are a large consumer of energy for cities using up to 50 percent of a city's
energy budget.
If every city installs the proposed system then a lot of power can be saved.
Proposed system is power saving mechanism for street lights by using LED lamps as
replacement of normal lamps and using special power savings mechanism for
microcontroller rand ZigBee modules.
It turns out most reliable and time efficient way to switch ON/OFF streetlights.
It provides an effective measure to save energy by preventing unnecessary wastage of
electricity, caused due to manual switching or lighting of street-lights when it is not
required.
It adopts a dynamic control methodology for traffic flow.
The proposed system is especially appropriate for street lighting in remote urban and
rural areas where the traffic is low at times.
The system is versatile, extendable and totally adjustable to user needs.
Add to the Smart Grid to monitoring all the lights and energy backup purposes
With adding other renewable energy sources
Railway signaling aspects
We can LDR circuits for automatically operation in night.
We can use solar panels for supply.
35
…
36
Chapter 4 References
[1]Suganya, S., Sinduja, R., Sowmiya, T., & Senthilkumar, S. STREET LIGHT GLOW
ON DETECTING VECHILE MOVEMENT USING SENSOR.
[2] Schwab, R.N., Walton, N.E., Mounce, J.M., and Rosenbaum, M.J. (1982) Synthesis of
Safety Research Related to Traffic Control and Roadway Elements-Volume 2,
Chapter 12: Highway Lighting. Report No. FHWA-TS-82233. Federal Highway
Administration.
[4] Electrical Safety of Street Light Systems,Giuseppe Parise, Fellow, IEEE, Luigi
Martirano, Senior Member, IEEE, and Massimo Mitolo, Senior Member, IEEE,
VOL. 26, NO. 3, JULY 2011.
[5] Energy Efficient Lighting Control System Design For Corridor illumination, Jayashri
A.Bangali, Arvind D.Shaligram International Journal of Scientific & Engineering
Research Volume 3, Issue 4, April-2012 ,ISSN 2229-5518.
[6] Wireless Streetlight Control System, Deepak Kapgate, G.H. Raisoni College of
engineering, Nagpur University, International Journal of Computer Applications
(0975 –8887),Volume 41– No.2, March 2012
[7] Design and fabrication of automatic street light control system, M. A. Wazed, N.
Nafis, M. T. Islam and, Vol. 5, No. 1,June 2010, pp 27-34
[8] "The Saracens themselves were the originators not only of algebra, chemistry, and
geology, but of many of the so-called improvements or refinements of
civilization, such as street lamps, window-panes, firework, stringed instruments,
cultivated fruits, perfumes, spices, etc."
[9] Scott, S. P. (1904). History of the Moorish Empire in Europe. Philadelphia and
London.: J. B. Lippincott Company. p. 3 vols. Artz, F. B. (1980). The Mind of the
Middle Ages. Third edition revised. University of Chicago Press. pp. 148–50.
37
[10] "Sir Joseph Wilson Swan". home.frognet.net. Retrieved 16 October 2010.
38
Appendix
Code of Entire Project
#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,10,11,12,13);
39
boolean msgComeFlag;
int moduleReady;
/////////////////////////
void gsmInit();
void gsmSend(char n[],char m0[],String m1,char m2[],String m3,char m4[]);
void msgReceive(); //
void arrayShift(); //
///////////////////////////////////
void SendSms();
void gsmStable();
int out1=22;
int out2=23;
int out3=24;
int out4=25;
int out5=26;
int in1=31;
int in2=28;
int in3=29;
int in4=30;
int in5=32;
int read1;
int read2;
int read3;
int read4;
int read5;
boolean in1Flag;
boolean in2Flag;
boolean in3Flag;
boolean in4Flag;
boolean in5Flag;
int countTime1;
int countTime2;
int countTime3;
40
int countTime4;
int countTime5;
boolean timeOut1;
boolean timeOut2;
boolean timeOut3;
boolean timeOut4;
boolean timeOut5;
boolean in1Send;
boolean in2Send;
boolean in3Send;
boolean in4Send;
boolean in5Send;
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Project Start");
pinMode(smsLed,OUTPUT);
pinMode(in1,INPUT);
pinMode(in2,INPUT);
pinMode(in3,INPUT);
pinMode(in4,INPUT);
pinMode(in5,INPUT);
pinMode(out1,OUTPUT);
pinMode(out2,OUTPUT);
pinMode(out3,OUTPUT);
pinMode(out4,OUTPUT);
pinMode(out5,OUTPUT);
41
digitalWrite(out1,HIGH);
digitalWrite(out2,HIGH);
digitalWrite(out3,HIGH);
digitalWrite(out4,HIGH);
digitalWrite(out5,HIGH);
///////////////////////////////////////////////////// /////////////////////
gsmStable();
///////////////////////////////////////////////////
//Serial.println("Initilizing Complete:");
///////////////////////////////////////////////////
Serial.print("RSSI: ");Serial.println(rssiValue);
gsmSend(N,"Street Light Detection \n","RSSI ",rssiValue,"","");
lineFlag==LOW;
///////////////////////////////////////////////////
}
void loop()
{
//////////////////////////-GPS Receiving-/////////////////////////////////////
unsigned long currentMillis = millis();
if(currentMillis - previousMillis >= interval)
{
previousMillis = currentMillis;
//////////////////////////////////////////
if(in1Flag==HIGH){countTime1++;}
if(in2Flag==HIGH){countTime2++;}
if(in3Flag==HIGH){countTime3++;}
if(in4Flag==HIGH){countTime4++;}
if(in5Flag==HIGH){countTime5++;}
lcd.setCursor(1,0);
if(countTime1>10)
42
{
countTime1=0;in1Send=HIGH;MsgSendFlag=HIGH;
lcd.print("Ligit 1 Hold");
}
if(countTime2>10)
{
countTime2=0;in2Send=HIGH;MsgSendFlag=HIGH;
lcd.print("Ligit 2 Hold");
}
if(countTime3>10)
{
countTime3=0;in3Send=HIGH;MsgSendFlag=HIGH;
lcd.print("Ligit 3 Hold");
}
if(countTime4>10)
{
countTime4=0;in4Send=HIGH;MsgSendFlag=HIGH;
lcd.print("Ligit 4 Hold");
}
if(countTime5>10)
{
countTime5=0;in5Send=HIGH;MsgSendFlag=HIGH;
lcd.print("Ligit 5 Hold");
}
Serial.println(countTime1);
Serial.println(countTime2);
Serial.println(countTime3);
Serial.println(countTime4);
Serial.println(countTime5);
timeOut1=LOW;
timeOut2=LOW;
timeOut3=LOW;
timeOut4=LOW;
timeOut5=LOW;
43
}
read1=digitalRead(in1);
read2=digitalRead(in2);
read3=digitalRead(in3);
read4=digitalRead(in4);
read5=digitalRead(in5);
if(read1==LOW){digitalWrite(out1,LOW);timeOut1=HIGH;in1Flag=HIGH;}
if(read2==LOW){digitalWrite(out2,LOW);timeOut2=HIGH;in2Flag=HIGH;}
if(read3==LOW){digitalWrite(out3,LOW);timeOut3=HIGH;in3Flag=HIGH;}
if(read4==LOW){digitalWrite(out4,LOW);timeOut4=HIGH;in4Flag=HIGH;}
if(read5==LOW){digitalWrite(out5,LOW);timeOut5=HIGH;in5Flag=HIGH;}
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
////////////-Send All Sms-//////////////////////////////
if(MsgSendFlag==HIGH){MsgSendFlag=LOW;
SendSms();}
////////////////////////////////////////////////////////////
msgReceive(); //
////////////////////////////////////////////////////////////
if(msgComeFlag==HIGH)
{msgComeFlag=LOW;
///////-shift Data from data Array-////////////
44
arrayShift();}
//////////////////////////////////////////////-Msg
Responce-////////////////////////////////////////////////////////////////////////
if(msgComplete==HIGH)
{
msgComplete=LOW;
if(rxCommand[0]=='s'){Serial.println("Reset");}
if(rxCommand[0]=='r'){RssiSend=HIGH;MsgSendFlag=HIGH;}
if(rxCommand[0]=='1'){in1Send=HIGH;MsgSendFlag=HIGH;}
if(rxCommand[0]=='2'){in2Send=HIGH;MsgSendFlag=HIGH;}
if(rxCommand[0]=='3'){in3Send=HIGH;MsgSendFlag=HIGH;}
if(rxCommand[0]=='4'){in4Send=HIGH;MsgSendFlag=HIGH;}
if(rxCommand[0]=='5'){in5Send=HIGH;MsgSendFlag=HIGH;}
rxCommand[0]=0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////-Testing-//////////////////////////////////////////////////////////////
if(Serial.available() >0)
{
char a=Serial.read();
if(a=='a'){Serial.println("-Msg Send-");gsmSend(N,"Sending","","","","");}
if(a=='b'){Serial.println("-Number-");Serial.println(rxNumber);}
if(a=='c'){Serial.println("-Command-");Serial.println(rxCommand);}
if(a=='r'){Serial.print("RSSI: ");Serial.println(rssiValue);}
if(a=='1'){Serial.println("Out1 ON");digitalWrite(out1,LOW);}
if(a=='2'){Serial.println("Out2 ON");digitalWrite(out2,LOW);}
if(a=='3'){Serial.println("Out3 ON");digitalWrite(out3,LOW);}
if(a=='4'){Serial.println("Out4 ON");digitalWrite(out4,LOW);}
if(a=='5'){Serial.println("Out5 ON");digitalWrite(out5,LOW);}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}////-Main End
void gsmStable()
{
///////GSM Inizilizing-////////////////////////////
while(1)
{
45
/////////////////////////-Module ON-/////////////////////////////
Serial1.println("AT");
//if(gsmResponse()==0){Serial.println("Module is Already
ON");}else{Serial.println("Module
ON");digitalWrite(gsmPKey,HIGH);delay(500);digitalWrite(gsmPKey,LOW
);}
////////////////-Wating for module Stablization-////////////////
////////////////-Apply AT Command-////////////////////////////////////////////////
gsmInit();
///////////////-Check Module is Ready-///////////////////////////////
if(moduleReady==0){Serial.println("Module Get Signal");break;}
Serial.println("Waiting For Module Signal");
/////////////////////////-Module OFF-/////////////////////////////
Serial.println("Module OFF");
//digitalWrite(gsmPKey,HIGH);delay(2000);digitalWrite(gsmPKey,LOW);
////////////////-Wating for module Stablization-////////////////
}
}
void SendSms()
{
if(RssiSend ==HIGH){RssiSend
=LOW;Serial1.println("AT+CSQ");gsmResponse();gsmResponse();gsmSend
(N,"","RSSI ",rssiValue,"","");Serial.print("RSSI:
");Serial.println(rssiValue);}
if(in1Send==HIGH){in1Send=LOW;Serial.println("Light One
Hold");gsmSend(N,"","Light 1 Hold ","","","");}
if(in2Send==HIGH){in2Send=LOW;Serial.println("Light Two
Hold");gsmSend(N,"","Light 2 Hold ","","","");}
if(in3Send==HIGH){in3Send=LOW;Serial.println("Light Three
Hold");gsmSend(N,"","Light 3 Hold ","","","");}
if(in4Send==HIGH){in4Send=LOW;Serial.println("Light Four
Hold");gsmSend(N,"","Light 4 Hold ","","","");}
if(in5Send==HIGH){in5Send=LOW;Serial.println("Light Five
Hold");gsmSend(N,"","Light 5 Hold ","","","");}
46
void arrayShift()
{
// memset(rxNumber,0, sizeof(rxNumber));
// memset(rxCommand,0, sizeof(rxCommand));
/////////////////////-Array Shift-//////////////////////////////////////////
/*
N[0]=rxNumber[0]=msgDetail[7];
N[1]=rxNumber[1]=msgDetail[8];
N[2]=rxNumber[2]=msgDetail[9];
N[3]=rxNumber[3]=msgDetail[10];
N[4]=rxNumber[4]=msgDetail[11];
N[5]=rxNumber[5]=msgDetail[12];
N[6]=rxNumber[6]=msgDetail[13];
N[7]=rxNumber[7]=msgDetail[14];
N[8]=rxNumber[8]=msgDetail[15];
N[9]=rxNumber[9]=msgDetail[16];
N[10]=rxNumber[10]=msgDetail[17];
N[11]=rxNumber[11]=msgDetail[18];
N[12]=rxNumber[12]=msgDetail[19];
//rxNumber[13]=msgDetail[20];
*/
////////////////////////////
rxCommand[0]=msgText[1];
rxCommand[1]=msgText[2];
rxCommand[2]=msgText[3];
rxCommand[3]=msgText[4];
//rxCommand[4]=msgText[5];
//rxCommand[5]=msgText[6];
//rxCommand[6]=msgText[7];
//rxCommand[7]=msgText[8];
//rxCommand[8]=msgText[9];
//rxCommand[9]=msgText[10];
}
47
cc=Serial1.read();
if(cc=='+')
{
msgComeFlag=HIGH;
while(1)
{
digitalWrite(smsLed,!digitalRead(smsLed));
if(lineFlag==LOW)
{
//Serial.print(cc);
msgDetail[aa++]=cc;
delay(50);
cc=Serial1.read();
if(cc==0x0d){aa=0;lineFlag=HIGH;break;}
}}}
if(lineFlag==HIGH)
{
while(1)
{
cc=Serial1.read();
//Serial.print(cc);
msgText[bb++]=cc;
if(cc==0x0d){bb=0;lineFlag=LOW; msgComplete=HIGH;break;}
}}}
digitalWrite(smsLed,LOW);///LED OFF
}
/////////////////////-READ GSM RESPONCE-///////////////////////
int gsmResponse()
{
int count = 0;
char data;
int moduleStatus;
int getCount=0;
while(1)
{
if(Serial1.available())
{
data =Serial1.read();
Serial.print(data);
if(data=='Q'){rssiFlag=HIGH;}
48
if(rssiFlag==HIGH){rssiValue[getCount++]=data; }
if(data == 'K'){moduleStatus=0;Serial.println("OK");}
if(data == 'R'){moduleStatus=1;Serial.println("GSM Not Working");}
if(data == 'E'){moduleStatus=2;Serial.println("Error");}
//delay(5);
//if(data==0x0D){EnterCount=1;}
}
count++;
delay(1);
if(count == 1000){if(data!=0){}else{Serial.println("GSM not Found");}break;}
}
rssiFlag=LOW;
return moduleStatus;
}
///////////////////////////////////////////////////
/////////////////////////////////////////////////////
void gsmInit()
{
Serial.println("AT");
Serial1.println("AT");
gsmResponse();
delay(1000);
Serial.println("ATE0"); // sets the SMS mode to text
Serial1.println("ATE0"); // sets the SMS mode to text
gsmResponse();
delay(1000);
///////////////////////////
//Serial1.println("AT+CFUN"); // check module is ready or not
//gsmResponse();
Serial.println("AT+CMGF=1"); // sets the SMS mode to text
Serial1.println("AT+CMGF=1"); // sets the SMS mode to text
gsmResponse();
delay(1000);
Serial.println("AT+CNMI=2,2,0,0,0"); // sets the SMS mode to text
Serial1.println("AT+CNMI=2,2,0,0,0"); // sets the SMS mode to text
gsmResponse();
delay(1000);
//Serial1.println("AT+CMGD");////delede all message reference.
//gsmResponse();
49
Serial.println("AT+CSQ"); // sets the SMS mode to text
Serial1.println("AT+CSQ");
//Serial1.println("AT+CSQ=?");////check signal Strength
gsmResponse();
gsmResponse();
delay(1000);
Serial.println("AT+CPIN=?");
Serial1.println("AT+CPIN=?");////
moduleReady=gsmResponse();
}
/////////////////////////////////////////////////////
void gsmSend(char n[],char m0[],String m1,char m2[],String m3,char m4[])
{
Serial1.print("AT+CMGS=\""); // send the SMS number
Serial1.print(n);
Serial1.println("\"");
delay(200);
Serial1.print(m0);
Serial1.print(m1);
Serial1.print(m2);
Serial1.print(m3);
Serial1.print(m4);
Serial1.write(0x1A);
delay(1000);
}
/////////////////////////////////////////////////////
50