1. i
REDUCTION IN POWER CONSUMPTION OF
LIGHTING SYSTEM USING PULSE WIDTH
MODULATION
A PROJECT REPORT
Submitted by
R.SURYA (REG NO: 113111106106)
K.GANESH KUMAR (REG NO: 113111106030)
S.RAMESH (REG NO: 113111106080)
In partial fulfilment for the award of the degree
of
BACHELOR OF ENGINEERING
in
ELECTRONICS AND COMMUNICATION ENGINEERING
VEL TECH MULTI TECH DR.RANGARAJAN DR.SAKUNTHALA
ENGINEERING COLLEGE, AVADI-62
ANNA UNIVERSITY:: CHENNAI-600 025
APRIL 2015
2. ii
ANNA UNIVERSITY:: CHENNAI-600 025
BONAFIDE CERTIFICATE
Certified that this project report “REDUCTION IN POWER CONSUMPTION
OF LIGHTING SYSTEMS USING PULSE WIDTH MODULATION” is the bonafide
work of the following students.
R.SURYA (REG.NO.113111106106)
K.GANESH KUMAR (REG.NO.113111106030)
S.RAMESH (REG.NO.113111106080)
Who carried out the project work under my supervision. Certified further that, to the
best of the knowledge, the work reported herein does not from part of any other project
report or dissertation on the basis of which a degree or award was conferred on an
earlier occasion this or any other candidate.
SIGNATURE SIGNATURE
(Mr.V.PRABHU M.E.,) (Mr.S.PRABHU KUMAR M.E.,)
HEAD OF THE DEPARTMENT SUPERVISOR
Department of Electronics and Department of Electronics and
Communication engineering Communication engineering
Vel .Tech.Multi.Tech.Dr.Rangarajan Vel.Tech.Multi.Tech.Dr.Rangarajan
Dr.sakunthala Engineering College Dr.sakunthala Engineering College
Alamathi road, Avadi, Alamathi road, Avadi,
Chennai-600 062. Chennai-600 062.
The project report was submitted for viva-voice held on …………… at
VEL TECH MULTI TECH Dr.RANGARAJAN Dr.SAKUNTHALA
ENGINEERING COLLEGE, AVADI-62.
INTERNAL EXAMINER EXTERNAL EXAMINER
3. iii
ACKNOWLEDGEMENT
“Project is the product out of experience that goes a long way in shaping
up a person‘s calibre. The experience and success one attains is not by oneself
but with a group of kind hearts behind‖.
First and Foremost, we wish to express our sincere thanks and heartfelt
gratitude to our founder, chairman Col. Prof. Dr. Vel R.Rangarajan
,B.E.,(Elec), B.E.,(Mech),M,S.,(Auto),D.Sc., and our vice chairman
Dr.Mrs.Sakunthala Rangarajan, M.B.B.S. for providing us with adequate
infrastructure and congenital academic environment. We also record our sincere
thanks to our honourable principal Dr. V.Rajamani, M.E., Ph.D for his kind
support to take up this project.
We express our gratitude to Mr. V.Prabhu, M.E., head of the department
of Electronics and Communication Engineering whose guidance and
encouragement has helped us in completing this project work.
We extent our sincere and special thanks to our guide and Project
Coordinator Mr. S.Prabhu Kumar,M.E., Department of Electronics and
Communication Engineering for giving confidence to complete the project
successfully by providing the valuable suggestions and interest at every stage of
the project.
Our special thanks to our external guide K.Senthil Kumar, B.E for his
full support and assistance in doing the project.
GANESH KUMAR.K
SURYA.R
RAMESH.S
5. v
ABSTRACT
This project aims at designing a wireless street light
monitoring system with optimized management and efficiency. Source is
the hybrid combination of solar and line source. It uses many sensors to
get the required information and parameters to be satisfied we are using
a RF module for transmitting and receiving the fault information in case
of failure. A GUI has been developed to receive that information in the
remote area to locate the exact location of fault. All the operations are
combined with micro-controller (PIC) and relays.
6. vi
TABLE OF CONTENTS
CHAPTER
NO
TITLE PAGE NO
ABSTRACT v
LIST OF FIGURES ix
LIST OF TABLES x
LIST OF ABBREVIATIONS xi
1 INTRODUCTION 1
1.1 Objective 1
2 LITERATURE SURVEY 4
2.1 Existing System 8
2.2 Proposed System 9
3 PRINCIPLE OF OPERATION 10
3.1 Pulse Width Modulation 11
3.2 Fault Detection
4 HARDWARE DESCRIPTION 14
4.1 Hybrid Power Supply 15
4.1.1 Rectifier Part 15
4.1.2 Source Combining Part 15
4.1.3 Regulation Part 16
4.1.3.1 IC 7805 16
4.1.3.2 IC 7812 16
4.1.4 PWM Signal Generation (MOSFET) 17
4.1.5 Transformer 18
4.1.5.1 Step Down Transformer 19
4.2 Micro Controller 20
4.2.1 PIC 16F877A 20
7. vii
4.2.2 Features Of PIC16F877A 21
4.2.3 Specifications 22
4.2.4 Requirements Of PIC16F877A 23
4.2.5 Merits Of Controller 23
4.3 RS232 Interface 25
4.3.1 Introduction 25
4.3.2 Power Supply Section 27
4.3.3 MAX 232 28
4.3.3.1 Introduction 28
4.3.3.2 Features 28
4.3.3.3 Pin Diagram And Description 28
4.3.3.4 Working 29
4.3.3.5 Applications 30
4.3.3.6 Transmitter Section 31
4.3.3.7 Receiver Section 31
4.4 Relay 32
4.4.1 Operation 33
4.4.2 Electro-Mechanical Relay 34
4.4.3 Uses Of Relay 34
4.5 Light Emitting Diodes 35
4.5.1 Features 36
4.5.2 Specifications 36
4.5.3 Advantages 37
4.5.4 Applications 37
4.6 IR Sensor 38
4.6.1 Working 38
4.7 RF Module 39
4.7.1 RF Transmitter And RF Receiver 39
8. viii
4.7.2 Pin Description 40
5 SOFTWARE DESCRIPTION 41
5.1 Embedded C 41
5.2 PIC C Compiler 42
5.3 Visual Basics 43
6 EXPERIMENTAL RESULTS 45
6.1 Transmitter Section 45
6.2 Receiver Section 46
6.3 Results 46
6.3.1 No Obstacle Street View 46
6.3.2 Street With Obstacle 46
6.3.3 Visual Basic 46
7 APPLICATION AND FUTURE ENHANCEMENT 48
7.1 Application 48
7.2 Future Enhancement 48
REFERENCE
9. ix
LIST OF FIGURES
FIGURE
NO
TOPIC PAGE NO
1.1 Actual system vs Proposed System 2
2.1 HID lamps 8
2.2 LED lamps 9
3.1 Optimized street light monitoring system 11
3.2 PWM with 25% 12
3.3 PWM with 50% 13
3.4 PWM with 75% 13
3.5 Fault detection 14
4.1 Hybrid Board 15
4.2 Bridge Rectifier 15
4.3 IC 7805 17
4.4 IC 7812 17
4.5 MOSFET 18
4.6 Transformer 19
4.7 Pin Diagram of PIC 21
4.8 Block Diagram of PIC 24
4.9 RS232 interface 26
4.10 Pin diagram of MAX232 27
4.11 Interconnection of MAX232 with RS232 29
4.12 Relay outer and inner structure 33
4.13 Working of relay 34
4.14 LED 35
4.15 IR Sensor 38
4.16 RF Module pin description 39
10. x
LIST OF TABLES
TABLE NO TOPIC PAGE NO
4.1 Specification of pic 22
4.2 Function table 30
4.3 Led specifications 36
4.4 RF Transmitter configuration 40
4.5 RF receiver configuration 40
11. xi
LIST OF ABBREVIATIONS
PWM Pulse Width Modulation
FSLs Faulted Street Lights
MOSFET Metal Oxide Semi-conductor Field Effect Transistor
LED Light Emitting Diode
RF Radio Frequency
GUI Graphical User Interface
12. 1
CHAPTER 1
INTRODUCTION
1.1 Objective
Reducing the energy consumption is a challenge worldwide. The main
problem now-a-days is facing energy crisis. Using the energy efficient system in
industrial commercial and street lights is the best approach to resolve this
problem. Daily usage of power in Tamilnadu is 14,970 megawatts. In India
lighting systems consume 18% of the total power consumption, which is higher
than the other countries.
The other major issue we are facing is light maintenance. Due to the
failure of the lights many accidents may occur. However, maintaining
streetlights and monitoring involves high cost and need more labor work. Until
today the faulted street lights (FSLs) are monitored by electrical inspectors from
the local government. These officials only report the FSLs to the EB office.
After that the required maintenance will be carried out.
Lighting system plays a major role providing lighting to our homes, street
light, industries etc… As discussed before reducing the power consumed by
those systems will reduce the overall power consumption. Lighting systems
especially street lights are designed per the previous standards and they do not
use the latest technological developments. In the previous standards the
conventional streets lights are used. The use of conventional lights (high
intensity lights) leads to emission of co2 and other environmental environment
effects. The source to system is nonrenewable energy.
13. 2
Fig 1.1 ACTUAL SYSTEM vs PROPOSED SYSTEM
For all of these problems related to energy we design a streetlight system
that will consume less energy when compared with the conventional lights
system. The new technology for the source of light is to replace the
conventional lights by LED‘s. LED lights are more reliable than the
conventional streetlights. They have higher life time and it will consume less
power than the HID lamps. Using LED will reduce the power consumption to
greater extent and LED has the feature to control its intensity. The intensity
control variation is achieved from the PIC microcontroller. The intensity
variation reduction is nothing but the reduction of luminance of the LED.
The use of renewable energy source instead of typical power source takes
this concept to next level. By doing this, it will take care of the environment
issues. For this we can use the solar energy source. It is the most often resource
used in a long run recently.
The next major aspect in maintaining the street light is delivering the
faulted information to the control room. For reporting the FSLs to the control
room we use RF module. The faulted information is get from the streetlights
and it automatically transfers the exact location to the control room.
14. 3
Our work mainly focused on two prospects,
1) Making energy efficient lighting systems that could automatically
switches ON and OFF depending upon the environment conditions.
2) Monitoring the streetlights and reporting the FSLs to the control room.
The coming chapters will ensure that they will provide the additional
exact information‘s on the operating principle, pulse width modulation,
algorithms, how sensing has been done, method for reporting fault information
and finally conclusion.
15. 4
CHAPTER 2
LITERATURE SURVEY
1. “A Low-Cost and Non-invasive System for the Measurement and
Detection of Faulty Streetlights.”Huang-Chen Lee, Senior Member, IEEE and
Huang-Bin Huang.
Abstract: Due to bad lighting in the roads there occur many problems
such as accidents, heavy traffic and loss of lives. Bad lighting is due to faults in
the street lights and loss of proper maintenance of the lights. So it is very
important to rapidly detect faulty lights and report the relevant authorities to
take action against that. But the old one was the inspection done by the
electrical inspectors which takes very long time and cause many inconvenience.
In this paper there is a non-invasive method for detecting faulty lights that
involves designing a special equipment called the Hitchhiker, which could be
installed on vehicles and would collect information about streetlights intensity.
This system would not involve in the modification of conventional street lights.
The collected data would be used to create the illumination maps which are
known as IMaps, this could help in the identification of light intensity in
specific regions. This system could be extended to a citywide scale with
minimal cost, this can help the electricity boards and can reduce their works.
This method has the IMaps which is used to find the difference in the regions.
The IMaps are recorded periodically and gets transmitted to the control station
the time interval between the recording is set by the user, then the difference in
the illumination of the IMaps are found in the system, this difference denote the
fault in the light by denoting its light intensity. Hence it gives the location of the
faulted light. The hitchhiker device is used to create the IMaps, these devices
are installed in the top of the moving devices like cars, buses and some other
16. 5
means of transport devices. It consists of a light meter and the GPS module, this
is in the roof of the cars. The light meter in the car while crossing the street
lights measures the intensity of each and every light and it sends the data to the
specified street control system, the data is transmitted by the use of the GPS
module which is costly. This data are used to create the Illumination maps. The
light meter is generally the LDR, which generates a pulse when large amount of
light is incident on it. This makes the GPS module to send the data to the control
unit. Thus the light meter has the certain range according to the intensity of the
light from the street, if it gets lower then the GPS module will transmit the
faulted information to the control unit that alerts the electrical inspectors to take
the required action and to clear the fault.
Conclusion: The configuration scheme of a non-invasive system for detection
of faulty street lights for the streets is discussed. Based on this analysis the use
of illumination maps can reduce the human effort, but GPS module is of more
cost and it has to monitored periodically, maintenance of this devices will be of
more cost. As we made a clear system for the entire control of the light system
and the fault detection by varying the intensity of the light. Thus it helps in
saving the power and also more efficient.
2. “A smart street lighting control system for optimization of energy
consumption and lamp life”Mohsen Mahoor, ToorajAbbasianNajafaabadi and
FarzadRajaeiSalmasi University of Tehran , Iran.
Abstract: This paper introduces the optimization of energy consumption and
lamp life for street lighting control system. The main components of this system
17. 6
are: Monitoring and management software, Internet protocol, Segment
controller, LonWorks power line communication Technology and outdoor
lighting Controller. The native exhaustive search algorithm optimizes energy
consumption and the lamp life every 30 minutes subject to its constraint. The
search space is limited to five dimming levels and the three group arrangements
of street lighting lamps. The premier scenario is applied to the smart street
lighting control system in order to reduce energy consumption and increase
lamp life. The experimental results for a group of 30 400-watt lamps
demonstrate the efficacious and operational of proposed method. The total
energy consumption is decreased by 20% and the average lamp life is increased
by 100% in 12 working hours. The protocol used for the transmission is Power
line communication, which monitors all the street lights and the life of the street
light is monitored. The power to all lights is controlled by the monitoring unit,
there by distributing the same power to all the lights. This by reducing the
voltage fluctuation in the system which can reduce the damage of the bulbs.
Due to drastic change in the power line the lighting system is get spoiled this
can be reduced by use of this system.
Conclusion: This paper has given the design of lighting control system for
optimization of energy consumption and lamp life. This method was evaluated
for group of 30 lamps with nominal power of 400 watt, nominal flux of 22000
lm, lamp life of 22000 hours. This makes the premier scenario for every 30
minutes over 12 hours. Thus by the use of algorithms the optimization of streets
is done for every 50 metres of width 15 meter. The result of evaluation shows
that electrical power consumption was decreased during peak hours.
18. 7
3. “ Adaptive local Dimming Lighting of Mercury- Free flat Fluorescent
lamp using Dual Auxiliary Electrode ”Jae-Chul Jung, ByungJoo Oh, In Woo
Seo and Ki-WoongWhang.
Abstract: This method is designed for the adaptive local dimming lighting of a
multi structured 32-in diagonal-sized mercury-free flat fluorescent lamp
(MFFL) which consists of a matrix array of 10 x 16 60-mm diagonal-sized unit
cells is proposed. The adoption of the dual auxiliary electrode and the bipolar-
pulse drive schemes resulted in a wide stable operating voltage margin at low
driving voltages. The cell turn-on or turn-off selectively can be obtained
through the change of the connection state of the connection state of the dual
electrode as a data electrode and the subfield method, a new drive scheme for a
2-b adaptive local dimming control of 10 x 16 lamp arrays with one inverter
system is proposed and demonstrated. LCD is one of the main flat display
devices and is continuously backlight system using a cold cathode fluorescent
lamp (CCFL) has been seeking more intelligent lighting capability for better
picture quality. So for low ambient temperatures and a relatively long build-up
time to reach the saturated and uniform luminance level. This light is
environmentally safe and consumes less power due to dimming.
Conclusion: This paper for dimming of mercury free flat fluorescent using
dual electrode is makes the light reliable and also power effective with the help
of auxiliary electrode. By the use of this method we in our project use a
technique for dimming the intensity of the street lights (LED), pulse width
modulation is the technique used in our project. Thus the use of relays for
switching the lights with high and low intensity circuits. This helps in reducing
the consumption of power for the lighting system.
19. 8
2.1 Existing System
Fig 2.1 HID lamps
The existing system has high intensity discharge lights (HID) as the street
lights. The power consumption is very high when compared with LED lights.
The intensity variation is a difficult task in HID lamps. This model uses ZigBee
module to transmit the faulted information. There is no proper method for
demonstrating the faulted street light. No hybrid combination of source is used
here.
20. 9
2.2 Proposed System
Fig 2.2 LED lamps
This proposed system uses LED lights instead of HID lamps. As the
LEDs are more power saving and reliable it can be used in longer run. The life
span of the LED is high when compared with the HID lamps. The fault
detection is made through proper method. The intensity variation is possible in
LED. The intensity variation is achieved by the pulse width modulation. Source
is a hybrid combination of solar and line power. The GUI is created to find out
the exact location of the street light which is not in a proper situation or needs
maintenance. By using PWM the power consumed by the light will reduce to
greater extent.
21. 10
CHAPTER 3
PRINCIPLE OF OPERATION
Many sensors are placed in the street lamp post, which gives the
accurate result in detecting the obstacle movement. The main principle involves
dimming the LED by Pulse Width Modulation (PWM). This technology enables
us to reduce the power delivered to the LED based on the sensors value. LED
intensity can be controlled; it is done here by pulse width modulation technique.
The IR sensors are used to detect the obstacle movement, based on the
value of the IR sensor the light is either glow at full intensity (100%) or glow at
reduced intensity approximately (25%). If obstacle comes in the region of IR
sensor the light will glow at higher intensity otherwise at lower intensity. This
switching is achieved by the Relay.
Solar panel is used as the power source. This project uses the hybrid
board which combines the solar power and the line voltage. The LED have
lower power consumption than the conventional lights, this dimming concept
will reduce the power consumption to greater extend.
The other major prospect is detecting the faulted lights in the street
(FSLS). For this we connected the high resistance across all the street lights. The
street lights are connected to ports of the micro controller. If the all lights is in
ON condition; if any one light fails to glow (OFF condition) the exact light
which is failed to glow follows the high resistance path to the controller. Then
the controller transmits the data depending upon the feedback get from street.
This information is transfer to the control room through the RF module.
22. 11
In the receiver side, the transmitted information is received by the RF
receiver and the pic controller transmits this data to the GUI, created using
visual basic to detect the exact location of the FSLS
Fig 3.1 Optimized street light monitoring system
3.1 Pulse Width Modulation
A pulse width modulation is a technique for generating analog signal
using digital source. It consists of two main components that will show their
behavior:
1) Duty cycle
2) Frequency
23. 12
Duty Cycle
The duty cycle describes the amount of time the signal is in on state of
total time takes to complete one cycle.
Frequency
The frequency tells how fast the PWM completes a cycle (i.e. 2000 HZ
would be 2000 cycles per second)
Therefore it switches very fast between the high and low states. With a
certain duty cycle the output will behave like a constant voltage analog signal
when given power to the devices.
Example
To create a 3V signal from a source that can be either high (on) at 5V or
low (off) at 0V, if we use PWM with a duty cycle of 60%, the output will 5V
60% of the time. If the digital signal is cycled fast, then the voltage seen at the
output appears to be the average voltage. If the digital low, then the average
voltage can be calculated by the digital high voltage multiplied by the duty
cycle, or 5V x 0.6 = 3V. Setting the duty cycle of 80% would yield 4V, 20%
would yield 1V, and so on.
Below some graphs showing PWM signals with different duty cycles
Fig 3.2 25% Duty Cycle
24. 13
Fig 3.3 50% Duty cycle
Fig 3.4 75% Duty cycle
Applications
I. servos
II. voltage regulation
25. 14
III. power delivery
IV. intensity control
3.2 Fault Detection
The fault detection is made by adding high value of resistor across the
negative terminal of the LED. If the LED fails to glow; if it is in ON condition
the current will take the higher resistance path, the higher resistance path is
connected back to the port of the microcontroller.
The controller accepts the feedback from the street and transmitted the
information through the RF module to the control room. In the receiver side the
RF receiver accepts the data and then it is given to controller.
Fig 3.5 Fault detection
In the above image the resistor with orange orange brown is 330Ω. The other
resistor with yellow violet black is 47Ω.
26. 15
CHAPTER 4
HARDWARE DESCRIPTION
4.1 Hybrid Power Supply:
Hybrid supply combines two sources, solar and line. The following picture
depicts the circuit configuration. This includes 4 parts such as rectifier part,
source combining part, regulation part and PWM signal generation part.
Fig 4.1 Hybrid power supply
4.1.1 Rectifier Part
It consists of a Bridge rectifier circuit to convert the Alternating current to
direct current. Here both positive and negative cycles of AC sources are
converted. It is shown below,
Fig 4.2 Bridge rectifier
27. 16
4.1.2 Source Combining Part
This part hybrids different power sources of different properties and give
a continuous and constant output to the load.
4.1.3 Regulation Part
Regulation of voltage plays an important role in any power supply unit.
Voltage regulators are incorporated in the hybrid circuit. The primary purpose
of a regulator is to aid the rectifier and filter circuit in providing a constant DC
voltage to the device. Power supplies without regulators have an inherent
problem of changing DC voltage values due to variations in the load or due to
fluctuations in the AC linear voltage. A regulator connected to the DC output,
the voltage can be maintained within a close tolerant region of the desired
output. IC7805 and IC7812 are used in this project for providing constant 5v
and 12V DC supply.
4.1.3.1 IC 7805
IC 7805 is a voltage regulator integrated circuit. It is a member of 78xx
series of fixed linear voltage regulator ICs. The voltage source in a circuit may
have fluctuations and would not give the fixed voltage output. The voltage
regulator IC maintains the output voltage at a constant value. The xx in 78xx
indicates the fixed output voltage it is designed to provide. 7805 provides +5V
regulated power supply. Capacitors of suitable values can be connected at input
and output pins depending upon the respective voltage levels.
28. 17
Fig 4.3 5V Regulator
4.1.3.2 IC 7812
These linear voltage regulators are monolithic integrated circuits designed
as fixed-voltage regulators for a wide variety of applications including local, on-
card regulation. These regulators employ internal current limiting, thermal
shutdown, and safe-area compensation.
Fig 4.4 12V Regulator
4.1.4 PWM Signal Generation (MOSFET)
MOSFET is used to modulate the width of the pulse, (i.e.) to adjust the
ON and OFF time of the pulse. If the "on" periods are equal to the "off" periods,
one could think of the average current being half (50%) of the full "on" current.
29. 18
If the "on" periods are much smaller than the "off" periods, then we get a lower
average current. Longer "on" periods and shorter "off" periods will give us
higher average current. By varying the ratio of "on" time to "off" time, we can
get continuously variable control.
Fig 4.5 MOSFET
So, we need a switch that can be switched on and off many thousands of
times per second, a speed which rules out the practical use of a mechanical
switch. Fully electronic switches can, of course, be made. An ordinary bipolar
transistor may be used as a switch, for instance. But at high current levels, a
more efficient switch can be made using a MOSFET (Metal Oxide
Semiconductor Field-Effect Transistor). This transistor can be switched on and
off very rapidly (millions of times per second), has a very low resistance when
"on" and can handle the large currents. Prior to the above arrangement, there
should be a transformer to step down the line voltage.
4.1.5 Transformer
A transformer is a static device that transfers electrical energy from one
circuit to another through inductively coupled conductors—the transformer's
coils. A varying current in the first or primary winding creates a varying
magnetic flux in the transformer's core and thus a varying magnetic field
30. 19
through the secondary winding. This varying magnetic field induces a varying
electromotive force (EMF) or "voltage" in the secondary winding. This effect is
called mutual induction
Fig 4.6 Transformer
4.1.5.1 Step Down Transformer
When AC is applied to the primary winding of the power transformer it
can either be stepped down or up depending on the value of DC needed. In our
circuit the transformer of 230v/15-0-15v is used to perform the step down
operation where a 230V AC appears as 15V AC across the secondary winding.
One alteration of input causes the top of the transformer to be positive and the
bottom negative. The next alteration will temporarily cause the reverse. The
current rating of the transformer used in this project is 2A. Apart from stepping
down AC voltages, it gives isolation between the power source and power
supply circuitries.
4.2 Micro Controller
To perform the various operations and conversions required to switch,
control and monitor the devices a processor is needed. The processor may be a
microprocessor, micro controller or embedded controller. In this project an
embedded controller has been preferred because of its industrial advantages in
power electronics like built in ADC, RAM, ROM, ports, USART, DAC. This
31. 20
leads to lesser space occupation by the circuit and also the speed of embedded
controllers are more compared to other processors. The embedded controller
selected for this project is PIC16F877A due to its various features.
4.2.1 PIC 16F877A
Peripheral Interface Controller (PIC) is enhanced version of
microcontrollers. It is an embedded controller. PIC microcontroller contains
several families. They are classified as three categories.
Low End Family:
It has 33 instructions. For example, PIC 12XXX
Mid Range Family:
It has 35 instructions. For example, PIC 16XXX
High End Family:
It has 77 instructions. For example, PIC 17XXX and PIC 18XXX
Fig 4.7 Pin Diagram of PIC
32. 21
4.2.2 Features Of PIC16F877A
The PIC16F877A has five serial ports namely A, B, C, D and E. It has
five parallel ports namely:
1. PSP (Parallel Slave Port 8 bit wide)
2. SSP (Serial Synchronous Port)
3. MSP (Master Serial Synchronous Port)
4. I2C (Inter Integrated Circuit)
5. SPI (Serial Peripheral Interface)
256 × 8 bytes data memory
4k × 14 words program memory
It has three timers
1. Timer 0 – 8 bit timer
2. Timer 1 – 16 bit timer
3. Timer 2 – 8 bit timer
10 bit 8 channel
10 bit accuracy
No external hardware multiplexer is needed
Sleep mode processor
No power will be consumed during ideal condition
Built in temperature sensor
Built in RAM and EPROM
33. 22
RAM is used to control ADC. MSB is stored in RAM when LSB is outputted.
4.2.3 Specifications
Table 4.1 PIC Specifications
4.2.4 Requirements Of PIC16F877A
A separate power supply for digital and analog supplies must be provided
to prevent affecting the quality of analog measurement due to digital
current fluctuations.
Double regulated completely filtered analog reference supply.
Needs external power on reset and CPU synchronization switch.
External quartz crystal to be used for frequency stability.
10Hz for 9600 baud rate, 20 MHz for 19200 baud rate.
RS232 converter is used to link it with the computer.
For all the analog inputs voltage should not exceed 5V.
For digital outputs we should not consume current beyond 25mA.
34. 23
4.2.5 Merits Of Controller
There are certain demerits by using the microprocessor. So we go for the
embedded microcontroller. The advantage of using the embedded
microcontroller is described below.
1. Microprocessor needs different kind of peripheral for its operation
2. Microcontroller = microprocessor + peripheral.
3. Micro controller + direct industrial functions = Embedded controller.
Direct industrial functions =ADC, DAC, PWM, USART, UART.
4. Built in ADC of multi-channel without multiplexer, 5V=210=1024 5000 mV
/ 1024 ≈ 5 mV.
5. Built in RAM (data memory) and EPROM (program memory)
6. PC interface speed up to 19200 baud rate
7. USART and UART
8. Built in communication ports
Serial Synchronous Port (SP)
Parallel Slave port (PP)
Serial Peripheral Interface (SSP)
Inter Integrated Circuit(IIC)
IEEE Standard
9. Built in configurable I/O ports
10. Reduced Instruction Set Computing (RISC) oriented processor:
11. Low Power consumption and less space
12. All I/O ports can deliver current up to 25mA source / sink
35. 24
13. Watch dog timer to match host system software (To monitor the serial
Communication)
14. No need of any DLL for PC interfaces.
15. Built in temperature sensing, once if the chip temperature goes beyond the
reference temperature the chip goes safe mode automatically – sleep mode.
16. Built in voltage window comparator, once if the operating voltage is not
within the limit the chip goes to sleep mode.
17. Low cost, minimum PCB space, less failure probability.
18. Embedded improves utility factor of equipments.
Fig 4.8 Block Diagram of PIC
PIC16F877A
Analog Power
Supply
Digital Power
Supply
Crystal
Oscillator
Synchronous
Switch
Analog Ref
Voltage 5V
8 channel
Analog Input
External
USART
Logic I/O
Connector
C
P
U
36. 25
4.3 RS232 Interface
4.3.1 Introduction
The most common communication interface for short distance is RS-232.
RS-232 defines a serial communication for one device to one computer
communication port, with speeds up to 19,200 baud. Typically 7 or 8 bit
(on/off) signal is transmitted to represent a character or digit. The 9-pin
connector is used. The pin detail is given below. The Max 232 is a dual RS-232
receiver / transmitter that meets all EIA RS232C specifications while using only
a +5V power supply. It has 2 onboard charge pump voltage converters which
generate +10V and –10V power supplies from a single 5V power supply. It has
four level translators, two of which are RS232 transmitters that convert TTL
CMOS input levels into + 9V RS232 outputs. The other two level translators are
RS232 receivers that convert RS232 inputs to 5V
TTLCMOS output level. These receivers have a nominal threshold of
1.3V, a typical hysteresis of 0.5V and can operate up to + 30V input.
Fig 4.9 RS232 interface
1. Suitable for all RS232 communications.
37. 26
2. +12V power supplies required
3. Voltage quadrapular for input voltage up to 5.5V (used in power supply
Section of computers, peripherals, and modems).
Three main sections of MAX232 are
1. A dual transmitter
2. A dual receiver
3. +5V to + 10V dual charge pump voltage converter.
4.3.2 Power Supply Section
The MAX232 power supply section has 2 charge pumps the first uses
external capacitors C1 to double the +5V input to +10V with input impedance
invert +10V to –
Normally these
capacitors are low cost aluminum electrolyte capacitors or tantalum if size is
-10V inverter by
creasing the value of C3 and C4 lowers the ripple on the power
supplies thereby lowering the 16 KHz ripple on the RS232 output. The value of
impedance at –10V input.
38. 27
Fig 4.10 MAX232 Pin diagram
4.3.3 MAX 232
4.3.3.1 Introduction
The MAX232 is an integrated circuit that converts signals from an
RS-232 serial port to signals suitable for use in TTL compatible digital logic
circuits. The MAX232 is a dual driver/receiver and typically converts the RX,
TX, CTS and RTS signals. The drivers provide RS-232 voltage level outputs
(approx. ± 7.5 V) from a single + 5 V supply via on-chip charge pumps and
external capacitors. This makes it useful for implementing RS-232 in devices
that otherwise do not need any voltages outside the 0 V to + 5 V range, as
power supply design does not need to be made more complicated just for
driving the RS-232 in this case. The receivers reduce RS-232 inputs (which may
be as high as ± 25 V), to standard 5 V TTL levels. These receivers have a
typical threshold of 1.3 V, and a typical hysteresis of 0.5 V.
4.3.3.2 Features
1) Input voltage levels are compatible with standard СMOS levels
39. 28
2) Output voltage levels are compatible with EIA/TIA-232-E levels
3) Single Supply voltage: 5V
4) Low input current: 0.1μA at ТA= 25 °С
5) Output current: 24Ma
4.3.3.3 Pin Diagram And Description
Another device is the MAX-232. It includes a Charge Pump, which
generates +10V and -10V from a single 5v supply. This I.C. also includes two
receivers and two transmitters in the same package. This is handy in many cases
when you only want to use the Transmit and Receive data Lines. You don't need
to use two chips, one for the receive line and one for the transmit.
Fig 4.11 Interconnection of MAX232 with RS232
40. 29
4.3.3.4 Working
In MAX 232 IC used as level logic converter. The MAX232 is a dual
driver/receiver that includes a capacitive voltage generator to supply EIA 232
voltage levels from a single 5v supply. Each receiver converts EIA-232 to 5v
TTL/CMOS levels. Each driver converts TLL/CMOS input levels into EIA-232
levels.
EACH DRIVER
INPUT TIN OUTPUT TOUT
L H
H L
H = High level L = Low level
EACH RECEIVER
INPUT RIN OUTPUT ROUT
L H
H L
H = High level L = Low level
Table 4.2 MAX232 Function Table
In this circuit the microcontroller transmitter pin is connected in the
MAX232 T2IN pin which converts input 5v TTL/CMOS level to RS232 level.
41. 30
Then T2OUT pin is connected to reviver pin of 9 pin D type serial connector
which is directly connected to PC.
In PC the transmitting data is given to R2IN of MAX232 through
transmitting pin of 9 pin D type connector which converts the RS232 level to 5v
TTL/CMOS level. The R2OUT pin is connected to receiver pin of the
microcontroller. The data is transmitted and received between the
microcontroller and PC
4.3.3.5 Applications
MAX232 is purposed for application in high-performance
information processing systems and control devices of wide application
Battery-Powered RS232 Systems
Terminals
Modems
Computers.
4.3.3.6 Transmitter Section
Each of the two transmitters is a CMOS inverter powered by + 10V
internally generated supply. The input is TTL and CMOS compatible with a
logic threshold of about 26% of Vcc. The input if an unused transmitter section
can be left unconnected: an internal 4
the transistor input and Vcc will pull the input high forming the unused
transistor output low. The open circuit output voltage swing is guaranteed to
meet the RS232 specification + 5v output swing under the worst of both
42. 31
powered done output impedance
to the output with Vcc =0V.The outputs are short circuit protected and can be
short circuited to ground indefinitely.
4.3.3.7 Receiver Section
The two receivers fully conform to RS232 specifications. They‗re input
switching threshold is within the +3V of RS232 specification. To ensure
compatibility with either RS232 IIP or TTlCMOS input. The MAX232
receivers have VIL of 0.8V and VIH of 2.4V the receivers have 0.5V of
hysteresis to improve noise rejection. The TTLCMOS compatible output of
receiver will be low whenever the RS232 input is greater than 2.4V. The
receiver output will be high when input is floating or driven between +0.8V and
–30V.
Electrical characteristics of MAX232
Vcc = 6v V+ = 12v V- = 12v
Input voltage:
T1in, T2in: -0.3 to (Vcc+ 0.3v)
R1in, R2in: +30v or –30v
Output voltage:
T1out, T2out: ((V+) +0.3v) to ((V-) +0.3v)
R1out, R2out: -0.3V to (Vcc+0.3V)
Power dissipation: 375mW
Output resistance: 300 ohm
43. 32
4.4 Relay
A Relay is an electrical hardware device having an input and output gate.
The output gate consists of one or more electrical contacts that switch when the
input gate is electrically excited. It can implement a decoupler, a router or
braker for the electrical power, on the base of the wiring, complicated logical
functions containing and, or and flip-flop.
Fig 4.12 Relay outer and inner structure
4.4.1 Operation
When a current flows through the coil, the resulting magnetic field
attracts an armature that is mechanically linked to a moving contact. When the
current to the coil is switched off, the armature is returned by a force
approximately half as strong as the magnetic force to its relaxed position.
If the coil is energized with DC, a diode is frequently installed across the
coil, to dissipate the energy from the collapsing magnetic field which generate a
spike of voltage and might cause damage to circuit components. If the coil is
designed to be energized with AC, a small copper ring can be crimped to the
end of the solenoid. This "shading ring" creates a small out-of-phase current,
which increases the minimum pull on the armature during the AC cycle.
44. 33
Fig 4.13 Working of relay
4.4.2 Electro-Mechanical Relay
It consists in a fixed coil (a) and a moving armature (b) mechanically
linked (c) to a moving contact (d). Feeding the coil by means of electrical
current a magnetic field rises. Then the moving armature is attracted to the coil
and, the contact can be moved. The movement of the contact either makes or
breaks an electrical connection with a fixed contact (e). When the feeding
current of the coil is removed, the armature and the feed contact return to their
relaxed position by means of the elasticity of the contact. An electromechanical
relay has galvanic insulation between the input and output gate and between the
terminals of the contacts when they are in break position.
4.4.3 Uses Of Relay
To control a high-voltage circuit with a low-voltage signal.
To control a high-current circuit with a low-current signal, as in the
starter solenoid of an automobile.
45. 34
To isolate the controlling circuit from the controlled circuit when the two
are at different potentials, for example when controlling a mains-powered
device from a low-voltage switch.
To perform time delay functions. Relays can be modified to delay
opening or delay closing a set of contacts. A very short (a fraction of a
second) delay would use a copper disk between the armature and moving
blade assembly. Current flowing in the disk maintains magnetic field for
a short time, lengthening release time. For a slightly longer (up to a
minute) delay, a dashpot is used. A dashpot is a piston filled with fluid
that is allowed to escape slowly. The time period can be varied by
increasing or decreasing the flow rate. For longer time periods, a
mechanical clockwork timer is installed.
4.5 Light Emitting Diodes
A light-emitting diode (LED) is a two-lead semiconductor light source
that emits visible light when an electric current passes through it. It is a pn-
junction diode. When a suitable voltage is applied to the leads, electrons are
able to recombine with electron holes within the device, releasing energy in the
form of photons. The light is not particularly bright, but in most LEDs it is
monochromatic, occurring at a single wavelength. The output from an LED can
range from red (at a wavelength of approximately 700 nanometers) to blue-
violet (about 400 nanometers).
Fig 4.14 LED
46. 35
4.5.1 Features
LEDs can last over 100,000 hours (10+ years) if used at rated current
No annoying flicker like from fluorescent lamps
LEDs are impervious to heat, cold, shock and vibration
No breakable glass is used
Solid-State, high shock and vibration resistant
Extremely fast turn On/Off times
Low power consumption puts less load on the electrical systems
increasing battery life
4.5.2 Specifications
Table 4.3 LED Specifications
4.5.3 Advantages:
Benefits of LEDs compared with incandescent and fluorescent illuminating
devices, include:
Low power requirement: Most types can be operated with battery power
supplies.
47. 36
High efficiency: Most of the power supplied to an LED or IRED is
converted into radiation in the desired form, with minimal heat
production.
Long life: When properly installed, an LED or IRED can function for
decades.
4.5.4 Applications:
Indicator lights: These can be two-state (i.e., on/off), bar-graph, or
alphabetic-numeric readouts.
LCD panel backlighting: Specialized white LEDs are used in flat-panel
computer displays.
Fibre optic data transmission: Ease of modulation allows wide
communications bandwidth with minimal noise, resulting in high speed
and accuracy.
Remote control: Most home-entertainment "remotes" use IREDs to
transmit data to the main unit.
Opto isolator: Stages in an electronic system can be connected together
without unwanted interaction.
4.6 IR Sensor
An Infrared sensor (IR sensor) is used to detect obstacle movement in
front of its arrangement within its coverage region. It has a pair of LEDs. One is
for emitting (white) and the other one is for detecting (black) purpose. This is
also used to distinguish between colors depending on the configuration of the
sensor.
48. 37
Fig 4.15 IR Sensor
4.6.1 Working
Emitter and detector diodes are placed opposite to each other in a street.
There are two cases which are listed below,
I) When the ray from emitter is detected by the detector, there is no obstacle in
the sensor region.
II) When the ray from emitter is not detected by the detector, there is obstacle in
the sensor region.
Thereby the existence of obstacle is detected and the signal is transmitted
to the Relay
49. 38
4.7 RF Module
The RF module, as the name suggests, operates at Radio Frequency. The
corresponding frequency range varies between 30 kHz & 300 GHz. In this RF
system, the digital data is represented as variations in the amplitude of carrier
wave. This kind of modulation is known as Amplitude Shift Keying (ASK).
Transmission through RF is better than infrared (IR), because of many
reasons. Firstly, signals through RF can travel through larger distances making
it suitable for long range applications. Also, while IR mostly operates in line-of-
sight mode, RF signals can travel even when there is an obstruction between
transmitter & receiver. Next, RF transmission is more strong and reliable than
IR transmission.
RF communication uses a specific frequency unlike IR signals which are
affected by other IR emitting sources. This RF module comprises of an RF
Transmitter and an RF Receiver. The transmitter/receiver (Tx/Rx) pair
operates at a frequency of 434 MHz. An RF transmitter receives serial data and
transmits it wirelessly through RF through its antenna connected at pin4. The
transmission occurs at the rate of 1Kbps - 10Kbps.The transmitted data is
received by an RF receiver operating at the same frequency as that of the
transmitter. The RF module is often used along with a pair of encoder/decoder.
50. 39
4.7.1 RF Transmitter And RF Receiver
Fig 4.16 RF Module pin description
4.7.2 Pin Description:
RF Transmitter
Pin
No
Function Name
1 Ground (0V) Ground
2 Serial data input pin Data
3 Supply voltage; 5V Vcc
4 Antenna output pin ANT
Table 4.4 RF Transmitter configuration
51. 40
RF Receiver
Pin
No
Function Name
1 Ground (0V) Ground
2 Serial data output pin Data
3 Linear output pin; not connected NC
4 Supply voltage; 5V Vcc
5 Supply voltage; 5V Vcc
6 Ground (0V) Ground
7 Ground (0V) Ground
8 Antenna input pin ANT
Table 4.5 RF receiver configuration
52. 41
CHAPTER 5
SOFTWARE DESCRIPTION
5.1 Embedded C
Embedded processors are used to analyze analogue signals and
process these signals by applying filtering algorithms to the data received. The
common data type used in filtering algorithms is the fixed point data type, and
in order to achieve the necessary speed, embedded processors are often
equipped with special hardware for fixed-point data. The C language does not
provide support for fixed-point arithmetic operations, currently leaving
programmers with no option but to handcraft most of their algorithms in
assembly language. This technical report specifies a fixed-point data type for C,
definable in a range of precision and saturation options. Optimizing C compilers
can generate highly efficient code for fixed-point for integer and floating-point
data.
Many embedded processors have multiple distinct banks of memory
and require that data be grouped in different banks to achieve maximum
performance. Ensuring the simultaneous flow of data and coefficient data to the
multiplier/accumulator of processors designed for FIR filtering. In order to
allow the programmer to declare the memory space from which a specific data
object must be fetched. This technical report specifies basic support for multiple
address spaces. As a result, optimizing compilers can utilize the ability of
processors that support multiple address spaces, for instance, to read data from
two separate memories in a single cycle to maximize execution speed.
53. 42
5.2 PIC C Compiler
The mikroC PRO for PIC is a powerful, feature-rich development tool for
PIC microcontrollers. It is designed to provide the programmer with the easiest
possible solution to developing applications for embedded systems, without
compromising performance or control. PIC and C fit together well: PIC is the
most popular 8-bit chip in the world, used in a wide variety of applications, and
C, prized for its efficiency, is the natural choice for developing embedded
systems. mikroC PRO for PIC provides a successful match featuring highly
advanced IDE, ANSI compliant compiler, broad set of hardware libraries,
comprehensive documentation, and plenty of ready-to-run examples.
Features
mikroC PRO for PIC allows you to quickly develop and deploy complex
applications:
Write your C source code using the built-in Code Editor (Code and
Parameter Assistants, Code Folding, Syntax Highlighting, Auto
Correct, Code Templates, and more.)
Use included mikroC PRO for PIC libraries to dramatically speed up
the development: data acquisition, memory, displays, conversions,
communication etc.
Monitor your program structure, variables, and functions in the Code
Explorer.
Generate commented, human-readable assembly, and standard HEX
compatible with all programmers.
Use the integrated mikroICD (In-Circuit Debugger) Real-Time
debugging tool to monitor program execution on the hardware level.
Inspect program flow and debug executable logic with the
integrated Software Simulator.
54. 43
Generate COFF (Common Object File Format) file for software and
hardware debugging under Microchip's MPLAB software.
Active Comments enable you to make your comments alive and
interactive.
Get detailed reports and graphs: RAM and ROM map, code statistics,
assembly listing, calling tree, and more.
mikroC PRO for PIC provides plenty of examples to expand,
develop, and use as building bricks in your projects. Copy them
entirely if you deem fit – that‘s why we included them with the
compiler.
5.3 Visual Basics
Fig 5.1 INITIAL WINDOW
59. 48
CHAPTER 7
APPLICATION AND FUTURE ENHANCEMENT
7.1 Applications
Used in Street light control to reduce the power consumption.
Used to monitor traffic based on the intensity of the lights.
This system can be used in light maintenance and monitoring the
faulted street lights.
This system can be deployed in industries to reduce the overall
consumption.
7.2 Future Enhancement
This technology is very impressive towards reducing the power
consumption. This proposed system integrates the new technologies offering
optimized power management and maintenance of the street lights. There are
many constraints for reducing the power for the industrial and commercial
purposes. The future search should be done mainly concentrating on using the
renewable source as the hybrid of solar and wind. The future search has to pay
the way for wireless street light system that will reduce the maintenance cost.
Further studies has to be done in system reliability, increasing sensors accuracy,
reduced energy consumption.