Uploaded by Mohi Bennani

ece project1

advertisement
Introduction:
A lighting control system is an intelligent network based lighting control solution that
incorporates communication between various system inputs and outputs related to lighting
control with the use of one or more central computing devices. Lighting control systems are
widely used on both indoor and outdoor lighting of commercial, industrial, and residential
spaces. Lighting control systems serve to provide the right amount of light where and when
it is needed.
In an energy-conservation centered world as today, innovative cost effective and efficient
techniques for automation are a necessity. Automatic lighting systems in homes and
workplaces provide convenience and conserve energy notably. With automatic lighting and
control, the amount of light being used in a room can be controlled depending on the intensity
of ambient light as well as the occupancy of the room.
This project describes the design aspects of an automatic lighting system which involves the
automatic switching on/off of lights in a room with the help of LDR sensors and PIR
occupancy (motion) sensors as well as the automatic intensity control, using LDR sensors, of
the artificial lights in accordance to available natural light.
Advantages of Automatic Lighting Systems:
Automatic lightings help conserve costs, save energy and also improve home safety.

Cost/Energy Aspects:
As automatic lights function only on sensing persons, waste of electricity caused by active
lights in unused areas can be avoided. Minimal usage of lamps also increases lamp-life thereby
reducing maintenance and replacement costs.
A simple observation of light usage in a work room over 24 hours would show that out of 8
hours of activity in the room, for approximately 3.25 hours the lights are switched on without
any activity in the room. With automatic lights, an estimate of 40.6% of energy is conserved.

Daylight availability :
Electric lighting energy use can be adjusted by automatically dimming and/or switching
electric lights in response to the level of available daylight. Reducing the amount of
electric lighting used when daylight is available is known as daylight harvesting.

Alarm conditions:
Alarm conditions typically include inputs from other building systems such as the fire
alarm or HVAC system, which may trigger an emergency 'all lights on' or ' all lights flashing'
command for example.

Program logic:
Program logic can tie all of the above elements together using constructs such as if-thenelse statements and logical operators.

Safety Aspects:
Automatic lights provide an occupied feel to homes when empty and can light a path for
entry to the home at night time.
Types of lighting control systems:
There are two types of lighting control systems which are:


Analog lighting control
Digital lighting control
Examples for analog lighting control systems are:



0-10V based system.
AMX192 based systems (often referred to as AMX) (USA standard).
D54 based systems (European standard).
In production lighting 0-10V system was replaced by analog multiplexed systems such as
D54 and AMX192, which themselves have been almost completely replaced by DMX512.
For dimmable fluorescent lamps (where it operates instead at 1-10 V, where 1 V is minimum
and 0 V is off) the system is being replaced by DSI, which itself is in the process of being
replaced by DALI.
Examples for digital lighting control systems are:




DALI based system.
DSI based system
DMX512 based systems (often referred to as simply DMX).
KNX based systems
Those are all wired lighting control systems.
Design of automatic Lighting systems:
Three major techniques for automatic control of lights have been employed, namely:



Scheduled Control
Daylight Harvesting
Occupancy Sensing
1. Scheduled Control:
In this method, the lighting systems are installed with a timer control where the user sets a
time to switch on and switch off the lights in the day. With such a control, the lights will be
active only through prescribed times in the day.
2. Daylight Harvesting:
Daylight Harvesting is a method to control the intensity of active lights based on ambient
light available in the room. Here, optical sensors like LDR, whose resistance varies with
incident light, is employed to sense the level of ambient light and thereby, control the intensity
of the lamps.
3. Occupancy sensors:
This method is employed to activate the room lights depending on if the room is occupied or
not. The control senses the presence of persons in the room and switches on lights and in the
absence of persons switches off all lights.
PNP Transistor:
Transistors make our electronics world go 'round. They're critical as a control source
in just about every modern circuit. Sometimes you see them, but more-often-than-not they're
hidden deep within the die of an integrated circuit. Basically, in PNP type of transistor
construction the two diodes are reversed with respect to the NPN type giving a PositiveNegative-Positive type of configuration, with the arrow which also defines the Emitter
terminal this time pointing inwards in the transistor symbol. The construction of a “PNP
transistor” consists of two P-type semiconductor materials either side of an N-type material
as shown below.
A PNP Transistor Circuit :
The Output Characteristics Curves for a PNP transistor look very similar to those for an
equivalent NPN transistor except that they are rotated by 180o to take account of the
reverse polarity voltages and currents, (that is for a PNP transistor, electron current flows
out of the base and collector towards the battery). The same dynamic load line can be drawn
onto the I-V curves to find the PNP transistors operating points.
Identifying the PNP Transistor
Transistors are basically made up of two Diodes connected together back-to-back.
We can use this analogy to determine whether a transistor is of the PNP type or NPN type by
testing its Resistance between the three different leads, Emitter, Base and Collector. By
testing each pair of transistor leads in both directions with a multimeter will result in six tests
in total with the expected resistance values in Ohm’s given below.
1. Emitter-Base Terminals – The Emitter to Base should act like a normal diode
and conduct one way only.
2. Collector-Base Terminals – The Collector-Base junction should act like a
normal diode and conduct one way only.
3. Emitter-Collector Terminals – The Emitter-Collector should not conduct in
either direction.
Terminal Resistance Values for PNP Transistor:
Between Transistor TerminalsTerminals
PNP
Collector
Emitter
RHIGH
Collector
Base
RLOW
Emitter
Collector
RHIGH
Emitter
Base
RLOW
Base
Collector
RHIGH
Base
Emitter
RHIGH
Then we can define a PNP Transistor as being normally “OFF” but a small output current and
negative voltage at its Base (B) relative to its Emitter ( E ) will turn it “ON” allowing a much
large Emitter-Collector current to flow. PNP transistors conduct when Ve is much greater
than Vc.
In other words, a Bipolar PNP Transistor will ONLY conduct if both the Base and Collector
terminals are negative with respect to the Emitter
Bipolar transistor switches are used in many applications to switch a DC current “ON” or
“OFF”, from LED’s which require only a few milliamps of switching current at low DC
voltages, or motors and relays which may require higher currents at higher voltages.
Amplifier:
Amplifier is the generic term used to describe a circuit which produces and increased
version of its input signal. However, not all amplifier circuits are the same as they are
classified according to their circuit configurations and modes of operation.
In “Electronics”, small signal amplifiers are commonly used devices as they have the ability to
amplify a relatively small input signal, for example from a Sensor such as a photo-device, into
a much larger output signal to drive a relay, lamp or loudspeaker for example.
There are many forms of electronic circuits classed as amplifiers, from Operational Amplifiers
and Small Signal Amplifiers up to Large Signal and Power Amplifiers. The classification of an
amplifier depends upon the size of the signal, large or small, its physical configuration and
how it processes the input signal, that is the relationship between input signal and current
flowing in the load.
The type or classification of an Amplifier is given in the following table.
Classification of Signal Amplifier
Type of Signal
Type of
Classification
Frequency of
Configuration
Operation
Small Signal
Common Emitter
Class A Amplifier Direct Current (DC)
Large Signal
Common Base
Class B Amplifier
Audio
Frequencies
(AF)
Common Collector Class
AB Radio Frequencies (RF)
Amplifier
Class C Amplifier VHF, UHF and SHF
Frequencies
No one class of operation is “better” or “worse” than any other class with the type of
operation being determined by the use of the amplifying circuit. There are typical maximum
conversion efficiencies for the various types or class of amplifier, with the most commonly
used being:
● Class A Amplifier – has low efficiency of less than 40% but good signal
reproduction and linearity.
● Class B Amplifier – is twice as efficient as class A amplifiers with a maximum
theoretical efficiency of about 70% because the amplifying device only
conducts (and uses power) for half of the input signal.
● Class AB Amplifier – has an efficiency rating between that of Class A and
Class B but poorer signal reproduction than Class A amplifiers.
● Class C Amplifier – is the most efficient amplifier class but distortion is very
high as only a small portion of the input signal is amplified therefore the output
signal bears very little resemblance to the input signal. Class C amplifiers have
the worst signal reproduction.
Quartz Crystal Oscillators:
One of the most important features of any oscillator is its frequency stability, or
in other words its ability to provide a constant frequency output under varying load
conditions. Some of the factors that affect the frequency stability of an oscillator
generally include: variations in temperature, variations in the load, as well as changes to its
DC power supply voltage to name a few.
To obtain a very high level of oscillator stability a Quartz Crystal is generally used as the
frequency determining device to produce another types of oscillator circuit known generally
as a Quartz Crystal Oscillator, (XO).
When a voltage source is applied to a small thin piece of quartz crystal, it begins to change
shape producing a characteristic known as the Piezo-electric effect. This Piezo-electric
Effect is the property of a crystal by which an electrical charge produces a mechanical force
by changing the shape of the crystal and vice versa, a mechanical force applied to the crystal
produces an electrical charge.
Then, piezo-electric devices can be classed as Transducers as they convert energy of one kind
into energy of another (electrical to mechanical or mechanical to electrical). This piezoelectric effect produces mechanical vibrations or oscillations which can be used to replace
the standard LC tank circuit in the previous oscillators.
There are many different types of crystal substances that can be used as oscillators with the
most important of these for electronic circuits being the quartz minerals, due in part to their
greater mechanical strength.
The quartz crystal used in a Quartz Crystal Oscillator is a very small, thin piece or wafer of
cut quartz with the two parallel surfaces metallized to make the required electrical
connections. The physical size and thickness of a piece of quartz crystal is tightly controlled
since it affects the final or fundamental frequency of oscillations. The fundamental
frequency is generally called the crystals “characteristic frequency”.
Once cut and shaped, the crystal can not be used at any other frequency. In other words, its
size and shape determines its fundamental oscillation frequency.
Ocsilators and frequency:
The slope of the crystals impedance above shows that as the frequency increases across its
terminals. At a particular frequency, the interaction of between the series capacitor Cs and
the inductor Ls creates a series resonance circuit reducing the crystals impedance to a
minimum and equal to Rs. This frequency point is called the crystals series resonant frequency
ƒs and below ƒs the crystal is capacitive.
As the frequency increases above this series resonance point, the crystal behaves like an
inductor until the frequency reaches its parallel resonant frequency ƒp. At this frequency
point the interaction between the series inductor, Ls and parallel capacitor, Cp creates a
parallel tuned LC tank circuit and as such the impedance across the crystal reaches its
maximum value.
Then we can see that a quartz crystal is a combination of a series and parallel tuned resonance
circuits, oscillating at two different frequencies with the very small difference between the
two depending upon the cut of the crystal. Also, since the crystal can operate at either its
series or parallel resonance frequencies, a crystal oscillator circuit needs to be tuned to one
or the other frequency as you cannot use both together.
So depending upon the circuit characteristics, a quartz crystal can act as either a capacitor,
an inductor, a series resonance circuit or as a parallel resonance circuit and to demonstrate
this more clearly, we can also plot the crystals reactance against frequency as shown.
LIGHT EMITTING DIODES
A light-emitting diode (LED) is a semiconductor light source that emits light
when current flows through it. Electrons in the semiconductor recombine with electron
holes, releasing energy in the form of photons. This effect is called electroluminescence.
The color of the light (corresponding to the energy of the photons) is determined by the
energy required for electrons to cross the band gap of the semiconductor. White light is
obtained by using multiple semiconductors or a layer of light-emitting phosphor on the
semiconductor device.
Appearing as practical electronic components in 1962, the earliest LEDs emitted lowintensity infrared light. Infrared LEDs are used in remote-control circuits, such as those
used with a wide variety of consumer electronics. The first visible-light LEDs were of
low intensity and limited to red. Modern LEDs are available across the visible, ultraviolet,
and infrared wavelengths, with high light output.
Two types of LEDs are available, a lamp type (leaded) and a chip type (surface
mount). Users can select the ideal type based on set requirements.
Circuit:
HUMAN DETECTION
The basic need of any automation home environment is the detection of human being. The
turning OFF and ON of the main switch is directly dependent on the presence of human
being. If a person is detected than the main switch is turned ON using a relay circuit and if
no one is detected -i.e absence of that person- the whole system will be turned OFF. Due to
advancement of technology, innovation and technology have played a huge part in discovering
various methods for detection of human being.
In the circuit two IR sensor is used which are interfaced to a single microcontroller. The
Block diagram of human detection circuit is as shown below.
Micro controller:
In this project work the microcontroller is plays major role. Microcontroller were originally
used as components in complicated process-control systems. However, because of their small
size and low price, microcontrollers are now also being used in regulators
IR sensors:
An infrared sensor circuit is one of the basic and popular sensor module in an electronic
device. This sensor is analogous to human’s visionary senses, which can be used to detect
obstacles and it is one of the common applications in real time.
In case of active IR sensors, the sources are infrared lasers and LEDs of specific IR wavelengths. Next is the
transmission medium used for infrared transmission, which includes vacuum, the atmosphere, and optical
fibers. Thirdly, optical components such as optical lenses made from quartz, CaF2, Ge and Si, polyethylene
Fresnel lenses, and Al or Au mirrors, are used to converge or focus infrared radiation. Likewise, to limit
spectral response, band-pass filters are ideal. Finally, the infrared detector completes the system for detecting
infrared radiation. The output from the detector is usually very small, and hence pre-amplifiers coupled with
circuitry are added to further process the received signals.
Relay Switch:
Relay is an electrical to magnetic converting switch when input is high magnetic field is produced switch is
on otherwise switch is off.
Pin 1
The basics for all the relays are the same. This switch is controlled by the coil in the control
circuit. In simple, when a voltage is applied to pin 1, the electromagnet activates, causing a
magnetic field to be developed, which goes on to close the pins 2 and 4 causing a closed
circuit. When there is no voltage on pin 1, there will be no electromagnetic force and thus no
magnetic field. Thus the switches remain open.
Pin configuration of AT89c51 Microcontroller
The device is manufactured using Atmel’s high-density nonvolatile memory technology and is
functionally compatible with the industry-standard 80C51 microcontroller instruction set and
pin out. By combining versatile 8-bit CPU with Flash on a monolithic chip, the Atmel’s AT89c51
is a powerful microcomputer, which provides a high flexible and cost - effective solution to
many embedded control applications.
Fig3.1.2. 8051 microcontroller
Circuit basis:
IR sensor consists of an IR transmitter LED and a photodiode at the receiver end. The
photodiode converts the light into current which is converted into voltage and which is
compared against a fix voltage to get the output. The main problem with the IR sensor is its
range. The range of IR sensor can easily be increased by the adjusting potentiometer at the
receiver end.
When no person crosses the line of IR sensor the output of the IR sensor is low and when a
person crosses the IR sensor the infrared light is reflected back and light falls on photodiode
and output of the IR sensor is high. The output of photodiode is ranges from 2.8v for 20cm
to 0.4v for 200cm. Therefore, the reference voltage can be accordingly adjusted to get the
proper range of IR sensor.
In the circuit the 2 IR sensors are placed at the doorway of the area one once the opposite
at a distance of around fifty to 100cm. The operating of the circuit is as explained. While
coming into the area the person will cross the primary IR sensor then the person will cross
the second IR sensor. while departure the room person will cross the second IR sensor then
the person will cross the primary IR sensor. Therefore, the counter is incremented once the
person enters the room and decrement when the person leaves the room. And once the
counter value is zero then the output of microcontroller is low turning OFF the main switch
of the room. And when the counter value is larger than zero then the output of
microcontroller is high turning ON the main switch of the room using relay. The circuit
additionally displays the counter value of the person present within the room. This technique
is essentially design for home. As typically the dimensions of door are not as large compared
to alternative private sectors. Additionally, at home individuals do not get into the room in a
queue therefore the probability of error reduces. The system can even work in public and
private places having completely different entry and exit point. At such places the only sensor
will count the number of people entering and another sensor at the exit point can count the
number of people exiting the place.
The human detection circuit does not have power over any individual electrical appliances
rather it controls the principal switch of the room. It follows that if the room is empty than
automatically all the appliances will be turned OFF. A parallel switch is placed connected to
the main switch to give the flexibility of manually controlling the power in the room.
Arduino
What is Arduino?
Arduino is an open-source development prototyping platform. It is based on easy-to-use
hardware and software that is intended for tinkerers, hobbyists and anyone interests in
creating objects that interact with the real world.
Arduino boards contain various parts and interfaces, one basic board contains the following:

Pins: that connect the components used, there are 2 types:

Digital pins: they have only one state ON/OFF. Most Arduinos have 14 digital
I/O pins.
o Analog pins: they can read a range of values. Most Arduinos have six analog
pins.
 The pins are arranged in a specific manner so that an add-on board
“shield” is designed to fit most Arduino compatible devices easily.
Power connector: providing power to the device and low voltage for LEDs and
sensors. It can be either an AC adapter or a small battery.
Microcontroller: the primary chip. This component allows programing the Arduino to
execute commands and acts on the input. There are many types of chips depending
on the amount of onboard memory.
Serial connector: which mostly a USB port. It permits the communication between
the board and the Arduino board.
o


There are a lot of types of Arduino board that provide different forms of factors and
functionality:
-
-
-
Arduino Uno (R3):
It is a great choice for beginners.
It has all the basics that can be used
for any project. It has 14 digital input
/output pins, 6 analog inputs, a USB
connection, a power jack, a reset button
and more. It is for simple use, just connect
it to a computer or power it with a battery
to get it started.
LilyPad Arduino:
It is a wearable e-textile technology
developed by Leah Buechley. It designed to
have large connecting pads and a flat back
to let them be sewn into clothing with
conductive thread.
Arduino Mega (R3):
This board resembles Arduino Uno but in a
bigger shape. It has 54 lots of digital I/O pins,
16 analog inputs, USB connection, power
connector and a reset button.
-
Arduino Leonardo:
This board has a microcontroller with a
built in USB. Since the board is handling
USB directly, code libraries are available
which allow the board to emulate a
computer keyboard, mouse and others.
Programming an Arduino board is considered to be one of the most simple and easy codes to
write. Using the official integrated development environment and the open source written in
JAVA, it can work on different platforms. It allows the code to be written in a special
environment with syntax highlighting which makes coding easier. Then, it is loaded to the
device with a simple click of a button.
Code used
(part 1)
int
int
int
int
int
int
ledPin = 13; // choose the pin for the LED
switchPin =2; // choose the input pin (for a pushbutton)
val = 0; // variable for reading the pin status
counter = 0;
currentState = 0;
previousState = 0;
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(switchPin, INPUT); // declare pushbutton as input
Serial.begin(9600);
}
void loop(){
val = digitalRead(switchPin); // read input value
if (val == HIGH) { // check if the input is HIGH (button released)
digitalWrite(ledPin, HIGH); // turn LED on
currentState = 1;
}
else {
digitalWrite(ledPin, LOW); // turn LED off
currentState = 0;
}
if(currentState != previousState){
if(currentState == 1){
counter = counter + 1;
Serial.println(counter);
}
}
previousState = currentState;
delay(250);
}
In case we want to use a small screen to see the exact number of students, we may
use this algorithm written in C++ language :
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int counter1; #represents the number of students coming to the classroom
if (counter1==0) {
printf("\n There is no one in the class");
printf("\n Lights off");
}
else if (counter1>0) {
printf("\n The number of students is: %d,counter1");
printf("\n Lights on");
}
int counter2; #represents the number of students leaving the classroom
counter2++;
int Result=counter1-counter2;
if(Result !=0) {
printf("\n There still someone in the classroom!");
printf("\n Lights on! ");
}
else if ( Result==0) {
printf("\n The classroom is empty");
printf("\n Lights off. ");
}
return 0;
}
Code used (part 2)
#define trigPin 6 //Define the HC-SE04 triger on pin 6 on the arduino
#define echoPin 5 //Define the HC-SE04 echo on pin 5 on the arduino
#define bulb 9 //Define the relay signal on pin 9 on the arduino
void setup()
{
Serial.begin (9600); //Start the serial monitor
pinMode(trigPin, OUTPUT); //set the trigpin to output
pinMode(echoPin, INPUT); //set the echopin to input
pinMode (bulb, OUTPUT); //set the bulb on pin 9 to output
}
void loop()
{
int duration, distance; //Define two intregers duration and distance to be used to save
data
digitalWrite(trigPin, HIGH); //write a digital high to the trigpin to send out the pulse
delayMicroseconds(500); //wait half a millisecond
digitalWrite(trigPin, LOW); //turn off the trigpin
duration = pulseIn(echoPin, HIGH); //measure the time using pulsein when the echo
receives a signal set it to high
distance = (duration/2) / 29.1; //distance is the duration devided by 2 becasue the signal
traveled from the trigpin then back to the echo pin, then divide by 29.1 to convert to
centimeters
if (distance < 13) //if the distance is less than 13 CM
{
Light(); //execute the Light subroutine below
}
Serial.print(distance); //Dispaly the distance on the serial monitor
Serial.println(" CM"); //in centimeters
delay(500); //delay half a second
}
void Light() //Start the Light subroutine
{ digitalWrite(bulb, HIGH); //turn on the light
delay (15000); //wait 15 seconds
digitalWrite(bulb, LOW); //turn off the light
}
Cost estimation
SL NO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Components name
LDR
Transistors
Resistors
LED
Connecting wires
Power supply
Bread board
Sokler
Ragan
Varo board
Crock sheet
Glue
Knife
Carrying issue
jack
TOTAL
quantity
3
6
5
5
As required
2
2
1
As required
2
1
As required
1
As required
1
=
Cost (dh)
7.23
1.81
3.61
3.61
3.61
12.05
18.07
18.07
2.41
6.02
6.02
3.01
1.81
12.05
1.81
102.41
Automatique lightning system limitation
 It has a limitation of power
 Light turns on when shadow falls on LDR
 LED is a low voltage device
Future estimation
 By using same concept we can modify this project for
commercial use
 is It possible to make the project appropriate for high
voltage of power
biblio:
https://www.ukessays.com/essays/information-technology/the-automatic-lighting-systeminformation-technology-essay.php
https://www.electronics-tutorials.ws/transistor/tran_3.html
https://en.wikipedia.org/wiki/Lighting_control_system#Theatrical_lighting_control
https://www.electronics-tutorials.ws/amplifier/amp_1.html
https://en.wikipedia.org/wiki/Amplifier
https://whatis.techtarget.com/definition/amplifier
https://www.electronics-tutorials.ws/oscillator/crystal.html
https://www.elprocus.com/crystal-oscillator-circuit-and-working/
https://www.everythingrf.com/browse/crystal-oscillators
https://www.sciencedirect.com/topics/engineering/crystal-oscillator
https://learn.sparkfun.com/tutorials/transistors/all
https://en.wikipedia.org/wiki/Bipolar_junction_transistor
Download