SLS11

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 27

STREET LIGHT SWITCHING

ABSTRACT

This project is aiming the switching the street lights using time delay function. The
switching of the light is controlled by a time delay function that control switching on and off
times of led’s present in the light, in the course of the time setting, for every time delay,
number of led’s switching on and off changes.

In this system brightness is controlled using PREDEFINED TME SETTING and


combination of LED’s which are interfered with the ATMEGA8 microcontroller. According
to the programme code it controls the glowing of LED’s from morning to evening.

At evenings slowly, the intensity of street light gets increased with increase in number
of LED’s, once the complete darkness is occupied the street light gets fully intensified by
glowing of total number of LED’s. Morning when the sunlight slowly increases the intensity
of street light slowly decreases and gets completely turned off.

This system is better than any other system as intensity of light is controlled by time
setting. And this system does not need any sensors.

CMRCET-B. Tech 1 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER-1

ATMEGA8 MICRO CONTROLLER


1.1: INTRODUCTION

The abbreviation of AVR Microcontroller is “Advanced Virtual RISC” and MCU is


the short term of the Microcontroller. A Microcontroller is a tiny computer on a single chip
and it is also termed as a control device. Similar to a computer, the Microcontroller is made
with a variety of peripherals like input & output units, memory, Timers, serial data
communications, programmable. The applications of Microcontroller involve in embedded
applications & automatically controlled devices like medical devices, remote control devices,
control systems, office machines, power tools, electronic devices, etc. There are various kinds
of Microcontrollers available in the market like 8051, PIC and AVR microcontroller. This
article gives brief information about AVR Atmega8 microcontroller.

In 1996, AVR Microcontroller was produced by the “Atmel Corporation”. The


Microcontroller includes the Harvard architecture that works rapidly with the RISC. The
features of this Microcontroller include different features compared with other like sleep
modes-6, inbuilt ADC (analog to digital converter), internal oscillator and serial data
communication, performs the instructions in a single execution cycle. These Micro
controllers were very fast and they utilize low power to work in different power saving
modes. There are different configurations of AVR microcontrollers are available to perform
various operations like 8-bit, 16-bit, and 32-bit. AVR microcontrollers are available in three
different categories such as Tiny AVR, Mega AVR, and Xmega AVR.

Fig: 1.1 Atmega8 Micro controller

CMRCET-B. Tech 2 EEE DEPARTMENT


STREET LIGHT SWITCHING

 The Tiny AVR microcontroller is very small in size and used in many simple applications
 Mega AVR microcontroller is very famous due to a large number of integrated
components, good memory, and used in modern to multiple applications
 The Xmega AVR microcontroller is applied in difficult applications, which require high
speed and huge program memory.

1.2: ATMEGA8 MICROCONTROLLER PIN DESCRIPTION


The main feature of Atmega8 Microcontroller is that, all the pins of the
Microcontroller support two signals except 5-pins. The Atmega8 microcontroller consists of
28 pins where pins 9,10,14,15,16,17,18,19 are used for port B, Pins 23,24,25,26,27,28 and 1
are used for port C and pins 2,3,4,5,6,11,12 are used for port D.

Fig: 1.2 Atmega8 Microcontroller Pin Configuration

VCC Digital supply voltage.


GND Ground.
Port B (PB7...PB0) (XTAL1/XTAL2/TOSC1/TOSC2):
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port B output buffers have symmetrical drive characteristics with both high

CMRCET-B. Tech 3 EEE DEPARTMENT


STREET LIGHT SWITCHING

sink and source Capability. As inputs, Port B pins that are externally pulled low will source
current if the pull-up Resistors are activated. The Port B pins are tri-stated when a reset
condition becomes active, Even if the clock is not running.
Depending on the clock selection fuse settings, PB6 can be used as input to the
inverting Oscillator amplifier and input to the internal clock operating circuit. Depending on
the clock selection fuse settings, PB7 can be used as output from the inverting Oscillator
amplifier. If the Internal Calibrated RC Oscillator is used as chip clock source, PB7...6 is
used as TOSC2.

Port C (PC5...PC0):

Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port C output buffers have symmetrical drive characteristics with both high
sink and source Capability. As inputs, Port C pins that are externally pulled low will source
current if the pull-up Resistors are activated. The Port C pins are tri-stated when a reset
condition becomes active, Even if the clock is not running.

PC6/RESET:

If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C.
If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level
on this pin for longer than the minimum pulse length will generate a Reset, even if the clock
is not running. Shorter pulses are not guaranteed to generate a Reset.
Port D (PD7.PD0):
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port D output buffers have symmetrical drive characteristics with both high
sink and Source capability. As inputs, Port D pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset
condition becomes active, even if the clock is not running.

RESET:
Reset input. A low level on this pin for longer than the minimum pulse length will
generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to
generate a reset.

CMRCET-B. Tech 4 EEE DEPARTMENT


STREET LIGHT SWITCHING

AVCC:
AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6).
It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it
should be connected to VCC through a low-pass filter. Note that Port C (5.4) use digital
supply voltage, VCC.

AREFAREF is the analog reference pin for the A/D Converter.

ADC7.6 (TQFP and QFN/MLF Package Only):

In the TQFP and QFN/MLF package, ADC7.6 serve as analog inputs to the A/D
converter.
These pins are powered from the analog supply and serve as 10-bit ADC channels.
1.3: FEATURES
 High-performance, Low-power AVR® 8-bit Microcontroller
 Advanced RISC Architecture
– 130 Powerful Instructions
– Most Single-clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
 High Endurance Non-volatile Memory segments
– 8K Bytes of In-System Self-programmable Flash program memory
– 512 Bytes EEPROM
– 1K Byte Internal SRAM
– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
– Data retention: 20 years at 85°C/100 years at 25°C
– Optional Boot Code Section with Independent Lock Bits

In-System Programming by On-chip Boot Program

True Read-While-Write Operation


• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode.
CMRCET-B. Tech 5 EEE DEPARTMENT
STREET LIGHT SWITCHING

– Real Time Counter with Separate Oscillator.


– Programming Lock for Software Security.
– Three PWM Channels.
– 8-channel ADC in TQFP and QFN/MLF package Eight Channels 10-bit Accuracy.
– 6-channel ADC in PDIP package Six Channels 10-bit Accuracy
– Byte-oriented Two-wire Serial Interface
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with Separate On-chip Oscillator
– On-chip Analog Comparator
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, and Standby
• I/O and Packages
– 23 Programmable I/O Lines
– 28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF
• Operating Voltages
– 2.7 - 5.5V (ATmega8L)
– 4.5 - 5.5V (ATmega8)
• Speed Grades
– 0 - 8 MHz (ATmega8L)
– 0 - 16 MHz (ATmega8)
• Power Consumption at 4 MHz, 3V,25°C
– Active: 3.6mA
– Idle Mode: 1.0mA
– Power-down Mode: 0.5mA
The ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC
architecture. By executing powerful instructions in a single clock cycle, the ATmega8
achieves through puts approaching 1 MIPS per MHz, allowing the system designer to
optimize power consumption versus processing speed.

CMRCET-B. Tech 6 EEE DEPARTMENT


STREET LIGHT SWITCHING

1.4: BLOCK DIAGRAM

Fig1.3: block diagram of ATMEGA8 MICRO controller

The AVR core combines a rich instruction set with 32 general purpose working
registers. All the32 registers are directly connected to the Arithmetic Logic Unit (ALU),
allowing two independent registers to be accessed in one single instruction executed in one
clock cycle. The resulting architecture is more code efficient while achieving throughputs up
to ten times faster than conventional CISC microcontrollers.
The ATmega8 provides the following features: 8K bytes of In-System Programmable
Flash with Read-While-Write capabilities, 512 bytes of EEPROM, 1K byte of SRAM, 23
general purpose I/O lines, 32 general purpose working registers, three flexible
Timer/Counters with compare modes, internal and external interrupts, a serial programmable
USART, a byte oriented Two wire Interface, a 6-channel ADC (eight channels in TQFP and

CMRCET-B. Tech 7 EEE DEPARTMENT


STREET LIGHT SWITCHING

QFN/MLF packages) with10-bit accuracy, a programmable Watchdog Timer with Internal


Oscillator, an SPI serial port, and five software selectable power saving modes. The Idle
mode stops the CPU while allowing the SRAM; Timer/Counters, SPI port, and interrupt
system to continue functioning. The Power down mode saves the register contents but freezes
the Oscillator, disabling all other chip functions until the next Interrupt or Hardware Reset. In
Power-save mode, the asynchronous timer continues to run, allowing the user to maintain a
timer base while the rest of the device is sleeping.
The ADC Noise Reduction mode stops the CPU and all I/O modules except
asynchronous timer and ADC, to minimize switching noise during ADC conversions. In
Standby mode, the crystal/resonator Oscillator is running while the rest of the device is
sleeping. This allows very fast start-up combined with low-power consumption.The device is
manufactured using Atmel’s high density non-volatile memory technology.
The Flash Program memory can be reprogrammed In-System through an SPI serial
interface, by a conventional non-volatile memory programmer, or by an On-chip boot
program running on the AVR core. The boot program can use any interface to download the
application program in the Application Flash memory. Software in the Boot Flash Section
will continue to run while the Application Flash Section is updated, providing true Read-
While-Write operation. By combining an 8-bit RISC CPU with In-System Self-
Programmable Flash on a monolithic chip, the AtmelATmega8 is a powerful microcontroller
that provides a highly-flexible and cost-effective solution to many embedded control
applications.
The ATmega8 AVR is supported with a full suite of program and system
development tools, including C compilers, macro assemblers, program debugger/simulators,
In-Circuit Emulators, and evaluation kits.

CMRCET-B. Tech 8 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER -2

LIGHT EMITTING DIODE

2.1: INTRODUCTION
Light emitting diodes are the most commonly used semiconductor devices among all
the semiconductor devices available today. Light emitting diodes emit either visible light or
invisible infrared light when forward biased. The led’s which emit invisible infrared lights are
used for remote controls. Alight emitting diode is an optical semiconductor device that emits
light when voltage is applied. In other words led is an optical semiconductor device that
converts electrical energy into light energy.

When light emitting diode (LED) is forward biased, free electron in the conduction
band recombine with the holes in the valence band and releases energy in the form of light.
The process of emission of light in response to the strong electric field or flow of current is
called electro luminance.

A normal p-n junction diode allows the current only in one direction. It also allows
when it is forward biased and doesn’t allow the current when it I reverse biased. Thus normal
p-n junction diode operates in only forward biased condition.

Fig:2.1 light emitting diode

Like normal p-n junction diodes led’s also operate in only forward biased condition. To
create an LED an n-type material should be connected to the negative terminal of the battery

CMRCET-B. Tech 9 EEE DEPARTMENT


STREET LIGHT SWITCHING

and p type material should be connected to the positive terminal of the battery.In other words
the n type material should be negatively charged and p type material should be positively
charged.

2.2: LED SYMBOL

Fig2.2: led symbol

2.2.1: LED CONSTRUCTION

One of the methods used to construct LED is to deposit three semiconductorlayers


on the substrate. The three semiconductor layers deposited on the substrate are n-type
semiconductor p-type semiconductor layers. When LED is forward free electrons from n-
type semiconductor and holes from p type semiconductor are

Fig2.3: Led construction

CMRCET-B. Tech 10 EEE DEPARTMENT


STREET LIGHT SWITCHING

Pushed towards the active region .When free electrons from n-side and holes from p-side
recombine with the opposite charge carriers (free electrons with holesor holes with free
electrons) in active region a visible or invisible light is emitted by the active region.

2.3: LED LAYERS

A light emitting diode led consists of three layers.

P- type semiconductor and n type semiconductor and depletion layer. The p type
semiconductor and n type semiconductor are separated by the depletion layer.

2.3.1: P TYPE SEMICONDUCTOR

When trivalent impurities are added to the intrinsic or pure semiconductor, a p type
semiconductor is formed.

In p type semiconductor holes are majority charge carriers and free electrons are
minority charge carriers. Thus holes carry most of the electric current in p type
semiconductor.

2.3.2: N TYPE SEMICONDUCTOR

When pentavalent impurities are added to the intrinsic semiconductor, a n type


semiconductor is formed.

In n type semiconductor free electrons are majority carriers and holes are the minority
charge carriers. Thus free electrons carry most of the electric current in an n type
semiconductor.

2.3.3: DEPLETION LAYER OR REGION

Depletion region is a region present between n type and p type semiconductor where
no mobile charge carriers (free electrons and holes) are present. This region acts as a barrier
to the electric current. It opposes the flow of electrons from n type semiconductor and flow of
holes from p type semiconductor.

To overcome the barrier of depletion layer, we need to apply a voltage which is greater
than the barrier potential of the depletion layer.If the applied voltage is greater than the
barrier potential of the depletion layer the electric current starts flowing.

CMRCET-B. Tech 11 EEE DEPARTMENT


STREET LIGHT SWITCHING

2.4: LED COLOURS

One of the major characteristics of led is its color.Initially led colors were very
restricted. For the first years only red LEDs are available.However as semiconductor
processes were improved and new research was undertaken to investigate new materials for
LED, different colors available.

Fig2.4: Led color curve

CMRCET-B. Tech 12 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER-3

WORKING OF LED

3.1: EMISSION OF LIGHT


When external voltage is applied to the valence electrons, they gain sufficient energy
and break the bonding with the parent atom. The valence electrons which break bonding with
the parent atom are called free electrons.

When the valence electrons left the parent atom, they leave an empty space in the
valence shell at which valence electrons left. This empty space in the valence shell is called
hole.

Fig:3.1 emission of light

the energy loses of free electron or intensity of emitted light depends upon the forbidden gap
or energy gap between conduction band or valence band. The free electrons in the conduction
band do not stay for long period. After a short period, the free electrons lose energy in the
form of light and recombine with the holes in the valence band. Each recombination of
charge carrier will emit some light energy.

3.2: BIASING OF LED

The safe forward voltage a rating of most LEDs is from 1V to 3 V and forward
current ratings is from 200mA to 100mA. If the voltage applied to LED is in between 1V to
3V, LED works perfectly because the current flow for the applied voltage is in the operating
range. However, if the voltage applied to LED is increased to a value greater than 3 volts.
The depletion region in the LED breaks down and the electric current suddenly rises. This
sudden rise in current may destroy the device .To avoid this we need to place a resistor (R) in

CMRCET-B. Tech 13 EEE DEPARTMENT


STREET LIGHT SWITCHING

series with the LED. The resistor (R) must be placed in between voltage source (V) and
LED.

Fig:3.2 biasing of led

the resistor placed between LED and voltage source is called current limiting resistor. This

Resistor restricts extra current which may destroy the LED. Thus, current limiting resistor

protects LED from damage. The current flowing through the LED is mathematically written
as

3.3 OUTPUT CHARACTERISTICS OF LED:

Fig:3.4 output characteristics of led

CMRCET-B. Tech 14 EEE DEPARTMENT


STREET LIGHT SWITCHING

3.4 : ADVANTAGES AND DISADVANTAGES OF LED

Light emitting diodes consumes low amount of energy. Led’s are very cheap and
readily available. Led’s are light in weight. Smaller in size. Led’s have no longer life time.
Led’s operate very fast. They can be turned on and off in very less time. Led’s do not contain
toxic material like mercury which is used in fluorescent lamps. But led’s need more power to
operate than normal p-n junction diode. Other disadvantage is, luminous efficiency of led’s
is low.

3.5: APPLICATIONS OF LED

 Traffic signals
 Burglar alarm system
 Calculators
 Millimeters

CMRCET-B. Tech 15 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER 4

STREET LIGHT SWITCHING TECNIQUE

4.1: DESIGN OF STREET LIGHT USING LED

In this project the street light will be the combination of led lights. The number of led
lights in the street light depends upon the size of the light. Led lights are randomly connected
in the light. This gives the uniform distribution of light. This in turn gives the uniform change
in the intensity.

Here the intensity of street light is increased by increasing the number of led lights that are
glowing.

4.2: BLOCK DIAGRAM OF CONNECTION

Fig:4.1 block diagram of circuit connection

4.3: WORKING

NOTE: Here the working was explained with the help of four led lights. Working depends
upon the time setting.

4.3.1: EXPERIMENTAL SET UP

The hardware connection of the project was shown below. It shows the connection of
led lights to their corresponding port numbers.

This setup was further connected to the software using a cable.

CMRCET-B. Tech 16 EEE DEPARTMENT


STREET LIGHT SWITCHING

4.3: CONNECTIONS:

PB0 ___ LED 1

PB1 ___ LED 2

PB2 ___ LED 3

PB4 ___ LED 4

Time setting:

5:00 PM___LED 1

6:00 PM___LED 2

7:00 PM___LED 3

8:00 PM___LED 4

9:00 PM to 5:00 AM ___ FOUR LED’S glow ( street light is completely turned on)

5:00 AM ___ LED 4

CMRCET-B. Tech 17 EEE DEPARTMENT


STREET LIGHT SWITCHING

6:00 AM ___LED 3

7:00 AM ___ LED 2

8:00 AM ___ LED 1

8:00 AM to 5:00 PM ___ FOUR LED’S turned off ( street light is completely turned off)

Therefore the light is turned on and off depending upon the time setting.

CMRCET-B. Tech 18 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER 5

SOURCE PROGRAMME CODE

#include<stdio.h>

#include<conio.h>

main()

DDRB=0b00001111;

While(1)

PORTB=0b00000001;

_delay_ms(5000);

PORTB=0b00000011;

_delay_ms(5000);

PORTB=0b00000111;

_delay_ms(5000);

PORTB=0b00001111;

_delay_ms(5000);

PORTB=0b00000111;

_delay_ms(5000);

PORTB=0b00000011;

_delay_ms(5000);

PORTB=0b00000001;

_delay_ms(5000);

PORTB=0b000000;

_delay_ms(5000);

}}

CMRCET-B. Tech 19 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER 6

INSTALLATION OF SOFTWARE

6.1: AVR STUDIO 4 TOOL (STEPS)

 Step 1: Search for avr studio 4 in the search option

Fig:6.1 Screen displayed when we search for AVR Studio 4

Step 2: once we click on avr studio 4 we will get a screen below

Fig:6.2 avr studio 4 opening screen

 Step3: After the above screen a new window will be opened where we need to select
the new project option

CMRCET-B. Tech 20 EEE DEPARTMENT


STREET LIGHT SWITCHING

Fig:6.3 Welcome screen

 Step 4: After the new project click next and then click on AVR GCC option and then
type the name of the project and then click next

Fig:6.4 Project name selection screen

 Step 5:After the above step select AVR SIMULATOR and select ATMEGA8 and
then click finish

CMRCET-B. Tech 21 EEE DEPARTMENT


STREET LIGHT SWITCHING

Fig: 6.5 Selection of debug platform and device screen

 Step 6: After the above step we will get a new window where the code for the
program is writtren.

Fig: 6.6 New screen for program code

 Step 7: After the above step, go to Build and click on Build. After clicking on build it
will generate warnings which are neglected. Again click on build and run the
program.

CMRCET-B. Tech 22 EEE DEPARTMENT


STREET LIGHT SWITCHING

Fig: 6.7 Screen for running the code

This will generate hex file of the code. Use that Hex file to run your microcontroller.

CMRCET-B. Tech 23 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER 7

ADVANTAGES, DISADVANTAGES AND APPLICATIONS

7.1: ADVANTAGES

 Power consumption is less:

Led lights consume low amount of energy. Therefore the over all power consumption is less.

 Fast response:

The on and off times of led lights are very less. Therefore they respond very fast.

 Automatic control:

The light switched on and off automatically depending upon the program code.

 Low maintenance cost:

Led lights are cheaper. And can be repaired or replaced with low cost.

7.2: DISADVANTAGES

 Complexity in programming:

This designing requires more number of lines of program code. The number of lines increases
with increase in number of led lights.

 Requires more led’s:

Here more number of led lights are required for more intensity of light.

 Low flexibility:

Switching of light does not vary with the light conditions of the surroundings.

 Low intensity:

The intensity of led lights is very low. Therefore the intensity of light is less.

7.3APPLICATIONS

1. STREET LIGHT CONTROL:

As discussed this program can be used for road or street light controlling. By setting
different time delays different lights can be switched on and off.
CMRCET-B. Tech 24 EEE DEPARTMENT
STREET LIGHT SWITCHING

2. DOMESTIC APPLIENCES:

The same switching technique can be used in the domestic appliances. For different type of
uses different type of LEDs can be used.

3. PARTY DECORATIONS:

The different colored LEDs can be used as decorating lights.

By setting small time delay this switching can be used for flashing the lights.

CMRCET-B. Tech 25 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER 8

CONCLUSION

The automatic street light switching using LEDs has been implemented using time
delay function. It is cost effective system. Due to this principle of time delay function the
problem of manual switching the STREET LIGHTS or LIGHTS can be automatically
controlled. In this project Switching of LEDs only depend on time but not on surrounding
light conditions.

CMRCET-B. Tech 26 EEE DEPARTMENT


STREET LIGHT SWITCHING

CHAPTER 9

REFERENCES

BOOKS:

 Robotics Demystified
 Electric Drives

Websites:

 www.epanorama.com
 www.robotics.com
 www.automation.com

CMRCET-B. Tech 27 EEE DEPARTMENT

You might also like