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.
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.
An automatic system, when installed in a room, will sense the available ambient light as well as the number of persons in the room (portion of occupied space in the room) and light the area to a required intensity. The system will employ a combination of optical/sound sensors to detect human presence or activity as well as available light intensity, such as LDRs (Light Dependent Resistors), PIR (Passive pyro electric Infra-Red) Sensors and Ultra Sonic sensors. The signals from the sensors are received by a Micro Controller Unit (MCU) which processes the data and sends signals to the relay switches that control the lights.
1.3 Advantages of Automatic Lighting Systems
Automatic lightings help conserve costs, save energy and also improve home safety.
1.3.1 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.
1.3.2 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.
1.4 System Design using EDA Tools
Electronic Design and Automation Tools are software tools that help design electronic systems like PCBs (printed circuit boards) and ICs (integrated circuits). These tools help design a system and simulate its functions electronically to enable study and improvement of the system.
The aim of this project is to design a system using EDA tools.
As the requirements for simulating an automated lighting system using an MCU are Analog/Digital simulation and Programmable Logic Array simulation, the following EDA software were studied:
Cadence EDA Tools
PSPICE, having met all the requirements and also being a familiar tool due to prior use, has been selected for this project.
A microcontroller is a small computer on a single IC equipped with a processor core, memory and programmable I/O pins.
The reprogrammable ability of a microcontroller (EEPROM) provides the system with extreme flexibility; it leaves room in order to augment the system if expansion is required. With an MCU, an occupancy sensor and daylight harvester module can be integrated into a singular control unit.
Fig 1.1: Block Diagram of System using MCU
Design of Automatic Lighting Systems
Fig 2.1: Block diagram of Automatic Lighting System
2.1 Techniques for Automatic Light Control
Three major techniques for automatic control of lights have been employed, namely:
2.1.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.1.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.
2.1.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.
This project focuses on Automatic Lighting Systems using Occupancy Sensors as well as Daylight Harvesting.
2.2 Occupancy Sensors
Activity in the room can be detected using the following devices:
Ultrasonic Proximity Sensors
These devices use reflected or transmitted sound waves to detect motion. It detects if a target is present or absent, providing a Boolean output.
Light Dependent Resistors
LDRs can be employed in a sequence to recognize if a person entered or exited the room, keeping track of the number of persons in the room.
Passive Infra-Red Sensors
PIR sensors use infra-red waves to detect motion in an area and trigger a Boolean output, thereby remaining active as long as a person is present in the room.
For feasibility reasons, this project will focus on designing the system using LDR sensors and PIR sensors.
2.3 Daylight Harvesting
Daylight harvesting is achieved by sensing the available ambient light using a photo detector to provide a varying voltage dependent on the available light. An LDR or a Photodiode can be used for this purpose. The principle of an LDR (or photodiode) is that the resistance offered by it depends upon the intensity of light incident on the device. This varying resistance can be used to vary the potential difference across the device in order to sense the intensity of natural lights in terms of a voltage value.
Once the intensity of natural light is obtained in terms of a voltage, this voltage can decide the power fed into the artificial lighting source so as to control its intensity.
Design of Occupancy Sensor
3.1 Occupancy Sensor using LDR
An LDR can be set up in such a way so as to trigger if an object crosses its path. With this method, the concept should be built such that the system should sense if there are persons in the room or not. As both entry and exit will trigger the LDR, a logic should be derived so as to recognize an entry and exit distinctly. This logic can be established by using two LDRs in a sequence such that an entry will trigger only one of the outputs to the MCU and an exit will trigger the other. This arrangement will then be connected to a microcontroller unit which will keep track of entries and exits as a counter. With the first person entering the room, the counter will be raised from “0” and the system will switch on the lights, with the last person leaving the room the counter will return to “0” and the system will turn off all lights.
The schematic for the model using LDRs is shown in Fig 2.
Fig 3.1: Block diagram of Occupancy Sensor using LDR
Fig 3.2: Schematics of Occupancy Sensor using LDR (version 1)
3.1.1 Design using LDR Sensors
The schematic for the circuit using LDR sensors is shown in Fig 3.
The sensing modules consist of an IC 555 timer each, operating in the monostable mode. The LDR remains highly resistive or “open” as long as light is incident on it. When a person enters or exits, the light source to the LDR is momentarily cut whereby the resistance falls. The monostable timer is triggered by this negative edged pulse at terminal 2.
The detection module consists of an arrangement of 4 transistors to distinctly identify an ENTRY or EXIT. The two sensing modules present will be placed at the entrance of the room at an appropriate distance from each other.
When a person enters the room, sensor module 1 is triggered whereby diodes D1 and D2 (module 1) conduct. As D1 is conducting, there is a signal to the base of transistor Q1 and it also charges capacitor C3. The collector of Q1 is maintained at LOW as the second sensor is not yet triggered therefore, D2 (module 2) is maintained at LOW.
As D2 (module 1) is also conducting, collector of transistor Q3 goes HIGH but as diode D1 (module 2) is LOW, Q3 does not conduct.
When the person passes module 1 and eventually triggers module 2, diodes D1 and D2 (module 2) conduct. D2 (module 2) provides a HIGH to the collector of Q1. As the capacitor C3 was charged when sensor module 1 was triggered, it begins to discharge when D1 becomes LOW. At the instant the collector of Q1 goes HIGH, the base of Q1 becomes HIGH due to discharge of C3 thereby emitter of Q1 becomes active. Emitter of Q1 provides a HIGH at the base of Q2 and collector of Q2 is maintained at HIGH by diode D2 (module 2) therefore emitter of Q2 becomes active providing a HIGH signal to I/P 1 of the MCU.
Similarly, when a person exits the room, transistors Q3 and Q4 alone become active and provide a HIGH signal to I/P 2 of the MCU.
The MCU is connected to a relay circuit which switches ON/OFF the light source accordingly.
The concept of the detection logic is such that at no instance will both the monostable timers be active HIGH. The concept as explained earlier has been modified for simplicity. The four transistors are replaced by two AND gates as seen in the logic diagram below, Fig 4. When a person enters a room, Sensor 1 will be active HIGH i.e. signals a1 and a2 will be HIGH. At this point, gates G1, G2 will remain LOW as only one of the input signals is HIGH. During the ON pulse of the first Sensor, the capacitor C1 is charged. As the person crosses Sensor 1, all the output signals go LOW except a1 as the capacitor begins to discharge. When the person triggers the second Sensor, the outputs b1, b2 go HIGH. At this instance only gate G1 will be HIGH as a1 is maintained at HIGH due to discharge of capacitor C1 and b1 is HIGH due to triggering of the second Sensor. Therefore, the LED marked “Entry” will light up. Similarly, when a person exits, gate G2 will go HIGH, marking the exit of a person.
Fig 3.3: Schematic of Occupancy Sensor using LDR (version 2)
3.1.2 Design Specifics using LDR
IC 555 in Monostable mode (Sensing Module) (Fig. 3)
The two LDR sensors are to be placed at an elevation of 88cms from ground level, assuming the average height of a person to be 176cms, in order to be triggered by the navel region of a person of average physical dimensions.
Assuming the average width of a person (sideways) to be around 21.5cms, the sensors are placed at a distance 30cms apart so as to avoid triggering the two monostable vibrators simultaneously.
The average walking speed of a person is approximately 139cms/s (5kmph). Therefore, the person would take 0.22secs to cover a distance of 30cms. The second timer will show an active HIGH approximately 0.22 seconds after triggering the first sensor. In order to avoid simultaneous triggering, the width of the ON pulse of each timer should be less than 0.22 seconds. 0.2secs ON pulse width is selected.
The equation that provides the width (time) of the ON pulse is t=1.1RC where R and C are the threshold biasing resistor and discharge capacitor values.
0.2 â‰¥ 1.1RC will provide the values for R and C. As R and C can be set as per requirement, a combination of 3300â„¦ and 47µF gives us a pulse width of 0.17s.
The 555 IC in monostable is operated with 9V Vcc and a trigger voltage of 5V. It delivers an Output voltage of â‰ˆ7V.
Detection module and logic
The values for the capacitors C1, C2 and resistors R1, R2 are selected such that it will have enough charge to provide a HIGH signal when the next sensor module is triggered. The capacitance discharge is an exponential function and the voltage after a given time t when capacitance and resistance of the circuit are C and R resp. is given by V = V0e-t/RC where V0 is the initial voltage across the capacitor.
Say, the person triggers the first timer at t = t1. The second timer will be activated at time t = t1 + 0.22. The timer will provide a HIGH output for 0.176secs. Therefore, the capacitor will discharge for 0.22 – 0.176 â‰ˆ 0.05 seconds before the second timer is triggered. This implies that at a time 0.5 seconds after discharge, the capacitor should contain enough voltage to trigger the AND gate as a ‘Logic 1’.
Requiring a minimum voltage of 5.5V to trigger the AND gate, we have:
5.5 â‰¥ 7Ã-e-0.05/RC where the potential at the output of the sensor module is 7V. Taking R and C to be 4700â„¦ and 47µF, at time t = 0.05, V = 5.58V (â‰¥ 5.5V).
This provides us with the following observations:
The 555 monostable timers have an ON pulse width of 0.176 seconds
The R and C values of the timers are 3300â„¦ and 47µF respectively
The capacitors C1 and C2 and resistors R1 and R2 at the detection logic have values 47µF and 4700â„¦ each.
3.1.3 Errors observed in practice:
The circuit was practically tested by passing an object across the LDRs triggering one after the other, emulating the entry/exit of a person. The fault observed was that, after the first successful display of an Entry or Exit (by the lighting of the corresponding LED), the succeeding “entries” or “exits” resulted in the lighting of both LEDs simultaneously.
This is because when the gates remained LOW; the charge in the capacitors did not discharge, thereby, providing a voltage resulting in erroneous output. For this reason, the circuit is modified as seen in Fig 5.
A series resistor of value 1Kâ„¦ and a parallel resistor of value 33Kâ„¦ have replaced the resistance 4700â„¦. With this, when the gate is LOW, the circuit behaves as though there is a 34Kâ„¦ resistance grounding the capacitor. This helps discharge the capacitor to below the trigger voltage of the AND gate within â‰ˆ2 seconds. Therefore, the detection logic can distinctly identify an entry and exit within a time delay of 2 seconds. The resistor value was selected to allow a delay of 2 seconds (1.7 = 7Ã-e(-2/RÃ-47µ) => Râ‰ˆ30K; R=34k (33 + 1) => t = 2.26s).
With this correction, the circuit was able to identify an Entry and an Exit distinctly within a time gap of â‰ˆ2 seconds efficiently.
Fig 3.4: Schematic for Occupancy Sensor Using LDR (version 3)
Path of entry/exit to room Fig 3.5: Occupancy Sensor using LDR (version 4, final)
LDR Sensor Specifics:
The LDR sensor used in the design is NORP12 RS. It has spectral responses similar to that of the human eye. Its applications include smoke detection, automatic lighting control, batch counting and burglar alarm systems.
RISE TIME 1
FALL TIME 2
Table 3.1: LDR Specifications
Fig 3.6: Resistance as a function of Illumination (1 Ftc = 10.764 Lumens)
Fig 3.7: Spectral response of LDR (Relative Response VS Wavelength)
Fig 3.7: Physical dimensions of LDR (All units in millimeter)
Components and technical specifications
Timer used in monostable mode, 9V
4.7K, 3.3K, 1K, 33K
Quad 2 input AND gate
5V (for demonstration)
9V (IC 555)
5V (CD 4081, Relay)
As per required
Table 3.2: Component listing
As occupancy sensing using LDRs as described above keeps count of the number of persons in the room, the sensors are to be placed at the entrance of the room. Given a room with multiple entrances/exits, sensors are to be placed in at each entrance/exit. With the implementation of a microcontroller, multiple sensors can be interfaced to a single controller.
In order to conveniently and correctly identify an entry/exit, the sensors are best placed about 88cms from ground level and the LDRs of each sensor placed 30cms apart, horizontally, in view of average physical dimensions of a person.
3.2 Occupancy Sensor using PIR sensors
PIR sensors are passive infra-red detectors that sense apparent motion when an object with one temperature, e.g. a human, passes in front of an object with another temperature, e.g. a wall. As these devices sense motion, it will remain active as long as there is activity in the room.
As the PIR detecting device provides TTL output, it can be directly interfaced with the MCU, thereby eliminating the need for complex circuitry. This device has 3 pins – VDD (source), VSS (sink) and OUT, which is connected to an I/O pin set to INPUT mode or a BJT/MOSFET.
On sensing motion, the PIR detector sends a signal to the MCU, which activates a relay to switch on the lamps. When the PIR does not sense any motion, it goes inactive and the MCU, after a set delay, deactivates the relay switch.
As the PIR device senses motion in a given area, multiple sensors are installed in a room in order to activate lights in only those areas that are being used by persons.
PIR detectors have a range varying from 6ft to 30ft depending on the model. It has a radial range of vision. For this reason, it is better used as ceiling mounts and spaced equally, covering all areas in the room.
The schematic for the model using PIR detectors is shown in the figure.
3.2.1 Design specifics using PIR sensors
The PIR sensors are directly connected to the MCU as it provides TTL output. A (1K or 10K) resistor is used to buffer the output and an electrolytic capacitor as filter to prevent any false triggering. On sensing motion, the MCU sends a HIGH to its O/P peripheral and activates the relay to switch on the lamp.
Multiple sensors are to be placed in the room and connected to the MCU and corresponding to each sensor, an O/P should be assigned. In this manner, only the used areas in the room will be lit.
PIR Sensor Specifics:
The PIR sensor used in the design is RE200B by NICERA (KC7783R PIR Module). Its specifications are as follows:
STANDBY CURRENT (NO LOAD)
OUTPUT PULSE WIDTH
OUTPUT HIGH VOLTAGE
Table 3.3: PIR Sensor Specifications
Fig 3.8: Schematic of Occupancy Sensor using PIR sensors
Size – 25x35mm
Lens – Ball lens of 60° Detection angle
Connector – 3 leads flat cable, POWER, GND, OUT
Fig 3.9: Physical dimensions of the PIR sensor
3.2.2 Components and Technical Specifications
As per required
For each sensor,
As per required by lighting units
For each sensor (to filter output)
As per required
5V Relay (for demonstration)
As per required
As per required
Sensor, MCU – 5V
Table 3.4: Component Listing
PIR sensors, being sensitive to temperature change, should be operated in environments without rapid temperature changes, strong shock or vibration.
Sensor should not be exposed to direct sunlight or headlights of an automobile, direct wind from heater or air conditioner.
Depending on environmental temperature, detection range may vary.
The range of the PIR sensor, as seen in the following figure, is 5 meters from the center and 60° radial. The sensors work best when used as overhead sensors. Placing the sensors about 3-4 meters above ground provides a radial diameter of 2.4-4.6 meters.
Suppose, the PIR sensor is positioned to provide 4 meters (dm) radial coverage, and the following sensors are placed a distance just outside their ranges. This leads to a blind spot covering a max distance of 4 meters and a minimum distance of 1.66 meters across. This can be covered by overlapping the ranges of the adjacent sensors by â‰ˆ 0.83 meters.
Depending on the room dimensions, PIR sensors with the required ranges are selected and positioned accordingly.
Fig 3.10: Range of the RE200B PIR sensor
The occupancy sensor designed and described above was simulated using PSPICE. As some parts or components were unavailable for simulation, those were replaced by analogous components to simulate their functions.
The sensors were replaced by timed ON and OFF switches to show the triggering at set times.
The outputs of the detector (inputs to the MCU) were grounded via a resistor.
In the practical model developed to demonstrate the functioning of the system, LEDs were connected to the outputs of the detection logic to signal an entry/exit/presence of activity.
4.1 Simulation of Occupancy sensor using LDR
The simulation output of the Occupancy Sensor using LDRs is shown and explained below:
Fig 4.1: Simulation Output of Occupancy Sensor using LDR
A time transient analysis of the circuit was performed from 0s to 4s and voltage levels at the two sensors and the two indicators (entry and exit) measured.
X axis : Voltage (V)
Y axis : Time (s)
LDR 1 was replaced with a Closing Switch (closes at t=2s) and an Opening Switch (opens at t=2.17s). LDR 2 was replaced with a Closing Switch (closes at t=2.67s) and an Opening Switch (opens at t=2.84s). This shows that a person triggers both LDRs in 0.5s and each sensing module delivers a HIGH signal for duration of 0.17s each.
The green marker (square symbol, U5:2) shows the voltage level of the trigger of Sensing module 1 (IC 555 1). The red marker (circle symbol, U2:Trigger) shows the voltage level of the trigger of Sensing module 2 (IC 555 2). The blue marker (inverted triangle, U3:0) shows the voltage level of the O/P of the first gate (entry indicator). The yellow marker (triangle, R10:2) shows the voltage level of the O/P of the second gate (exit indicator).
The first sensor triggers at t=2s for a duration 0.17s (shown by green).
The second sensor triggers at t=2.67s for a duration of 0.17s (shown by red).
As the person triggers the second sensor, the detection logic marks this as an entry (shown by blue).
The second gate (exit) remains low throughout (shown by yellow).
4.2 Simulation of Occupancy Sensor using PIR sensors
The simulation output of the Occupancy Sensor using PIR sensors is shown and explained below:
Fig 4.2: Simulation Output of Occupancy Sensor using PIR sensor
A time transient analysis of the circuit was performed from 0s to 10s and voltage levels at the PIR sensor output and MCU output measured.
X axis : Voltage (V)
Y axis : Time (s)
The PIR sensor was replaced with a Closing Switch (closes at t=2s) and an Opening Switch (opens at t=6s). This shows that activity in the room is detected for a duration of 4 seconds from t=2s to t=6s. The microcontroller was replaced by a transistor with the sensor input going to the base and the emitter representing the MCU out.
The green marker (square symbol, U6:2) shows the voltage level of the output of the PIR sensor. The blue marker (circle symbol, Q3:3) shows the voltage level at the emitter of the transistor.
When motion/activity is detected by the sensor at t=2s, the sensor gives a HIGH signal (shown by green) which in turn activates the MCU and turns on the lights (shown by blue).
The lights stay active as long as the PIR detects motion.
At time t=6s, when the PIR detects no motion, the output returns to LOW and the MCU switches off all lights after a delay (can be set by user) (shown by parabolic section of blue plot).
An Automatic Lighting System using Occupancy Sensors was described and designed using PSPICE and its output simulated. The occupancy sensor was designed using LDR type sensors as well as PIR type sensors, the simulations of which were successful and in accordance with the objective.
The circuit using LDR sensors was partially constructed on a breadboard (detection logic) and tested to verify the same, the results of which were successful.
As the design using LDRs keeps count of the number of persons in the room, it is sufficient that a single sensing module (two sensors) be placed at the entrance to the room (or at each entrance).
This design requires that only one action (exit or entry) be performed at an instant to function properly. As there is a possibility that in actual practice, there may chance a situation where two people my use the entrance simultaneously for which reason the system will fail to identify the action properly.
If a large area (e.g. a hall) is taken into consideration, the system employing LDRs will activate all the lights in the room even though some portions of the room may not be in use. This gives rise to inefficiency. For this reason, LDRs are better used in smaller areas/rooms.
As this design detects motion and has a limited range, it is necessary to place multiple sensors in order to cover the given area as well as all the blind spots. Depending on the size of the room, multiple sensors will be necessary, for which reason it is more preferably used in larger areas (e.g. a hall) where only selected areas need lighting.
PIR sensors detect IR rays emitted by a body. It typically recognizes a temperature of about 340. For this reason, chances of erroneous triggering due to variation in temperature are very high. Environmental conditions are to be considered while positioning the sensors.
These sensors, being PASSIVE in nature, do not consume energy while in INACTIVE mode thereby being more efficient than LDR sensors.
Depending on the size of the room and environmental conditions, a combination of sensors are to be implemented while installing automatic lighting systems in a building.
5.3 Future Scope
The occupancy sensor designed in this project keeps track of motion in the room or the number of persons present in the room and controls the lights accordingly. As a microcontroller is implemented to achieve this, the system can be improved/expanded in the following ways:
Depending on the microcontroller selected and its I/O terminals, a single controller can control the lighting of multiple rooms/areas easily. As an EEPROM supports rewriting, an already existing system can be modified to incorporate the required changes.
The function of a daylight harvester can be incorporated into the design along with an occupancy sensor to improve the performance of the Automatic Lighting System.
5.3.1 Daylight Harvester
A Daylight Harvester uses a photo-dependent device (such as LDR or photodiode) to measure the intensity or amount of naturally available ambient light and vary the intensity of artificial lights to supplement it. The Analog to Digital Converter (ADC) module of the microcontroller can measure analog voltages with respect to a set voltage level. A microcontroller capable of PWM outputs is selected for this purpose. Depending on the voltage measured relatively, the duty cycle of the pulse width modulated output is varied. The output is then sent to a Digital to Analog Converter (DAC) to obtain an analog voltage level which is used to power the light source.
An analog DC voltage can be achieved my passing the PWM output through an appropriate LOW PASS R-C filter as shown below:
Fig 5.1: PWM to analog DC using RC filter.
The frequency response of this filter is as shown below:
Fig 5.2: PWM with varied duty cycle (0% – 90% – 50% – 10%)
It is seen here that the low pass filter response is delayed (due to the capacitor’s properties). For fast switching requirements, a DAC IC is necessary. With respect to an automated lighting system, the ambient light intensity will be measured at specific time intervals for which reason, the response as seen above is sufficient.
Cite This Work
To export a reference to this article please select a referencing style below: