Design of Energy Saving Lighting System in University Classroom Based on Wireless Sensor Network

In order to reach the objective of intelligence and energy saving for university classroom lighting, energy saving lighting control system in university classroom based on wireless sensor network is designed, including design of sensor node and sink, as well as corresponding development of control program and upper-computer software. The system sets single-chip Ameg16 as control center, realizes communication between nodes via nRF24L01 wireless transceiver module, and realizes communication between sink and upper computer via w5100 wireless internet module. It perceives illumination intensity via photoconductor, detects the human body position via infrared pyroelectric sensor, and places the sensor node on the lamp, so the light can be controlled according to position of human body and current illumination intensity, which can realize energy saving to a large extent on condition that lighting requirement is satisfied. The sys-tem has low cost, and there is no need to change the original lighting circuit. The light can be turned off by hand, and when multi-media are used for the class, light can keep off even it is dim. In addition, this system has the function of automatic fault report, which is convenient for property maintenance.


Introduction
It is a common phenomenon that electricity is wasted in traditional lighting system of university classroom.According to regulations of national standard, power density of classroom lighting is about 10 W/m 2 .Suppose the average area of the classroom is 100 m 2 , then the lighting load is about 1 kW.If the normal service time is 15 hours every day, then power consumption of every classroom every day is 1 kW×15 h＝15 kWh.There are 270 days when students are at school, so the annual power consumption is about 4050kWh.If the classroom is counted as 100 m 2 , then the school has 200 classrooms, so the power consumption for lighting is about 810,000.00 kWh.If energy saving rate is calculated as 30%, then 243,000.00 kWh can be saved every year, that is to say, 150,000.00～200,000.00Yuan of electricity fee will be saved, and the above estimate does not include line loss and damaged part of lamps for long service [1].In terms of Shandong University, according to statistics, electricity fee in 2005 is 10,470,000.00Yuan, and it has been increasing annually [2].In which power consumption of lighting accounts for 40% of total electric quantity [3], and waste caused by delayed turning off or unnecessary turning on accounts for 70% of power consumption of lighting.Directed at such wasting phenomena, many lighting systems have appeared in the market, in which switch of the light can be controlled automatically according to the lighting requirement, so as to avoid the above energy waste, save expenditure and at the same time save labor power.Some systems will identify the indoor light intensity and number of people to control number of turn-on lamps [4,5]; some others control the light according to the region [3,6].All of these cannot reach the optimum effect of energy saving, and they require the original lighting system to change greatly.
In order to make up for the shortcomings of present technology, system designed by this paper automatically controls switch of the single lamp according to human body position and current illumination intensity, which saves energy to a large extent on condition that lighting requirements are satisfied.

Working Principles of the System
On condition that the original lighting system of the classroom is not changed, install the sensor node on every lamp, and adjust the perception range of the sensor into the largest lamp distance of 2 (often distances between lamps are not equal, so the largest distance will be selected) according to the actual requirements, thus sensor nodes will be placed in the classroom for redundancy.Every sensor node perceives human signal and current illumination intensity, which directly controls the light.There is communication between sensor node and sink, so sensor and lamp state in the classroom can be reflected to sink.There is one sink in every classroom, which is connected into internet (LAN) via screen wire.All information gathers into the computer that acts as a server via internet for information integration, gathering and disposal as well as providing necessary Web service.The director can lodge in Web server via any networking PC or even mobile phone to inquire or control state of all nodes in the classroom.The system structure is shown in Figure 1.
The sensor is arranged according to the lamp position.Height of the classroom is 3.4 m, perception angle of infrared pyroelectric sensor is 120 degree, and adjust resistance and lens to make radius of sensor coverage range be the largest lamp distance of 2 .In general situation, one person can be detected by 1 or 2 sensors, such as the white and grey part in Figure 2, and in special situations, one person can be detected by 3 or 4 sensors, such as the bend and dark part in Figure 2. Therefore, 4 lamps can be turned on at most.Control of turning on and off the light by automatic detection in the classroom: under the condition of insufficient light, when people walk in or past the classroom, the light will not be turned on.Only when people stay or sit in a position, will 1 lamp above be turned on, and in special situations, will 4 lamps be turned on at most.When people are seated, as long as there is tiny movement within 5 minutes, the light will keep on.When people leave, 5 minutes later, the lamp at corresponding position will be turned off.Under the condition of sufficient light, the light will not be turned on.In addition, the system can automatically detect damaged lamp node and sensor node, and report to upper computer, asking for maintenance.
Control of turning off the light by hand in the classroom: when multi-media are used for classes in the classroom, the light may be insufficient, and when there are people in the classroom, the light will be turned on automatically, but actually, there is no need to turn on the light.Therefore, switch of the original lighting system can be used to turn off the light by hand.
Overall working of the system: firstly, turn on the original circuit switch to make the circuit unimpeded for automatic control by the system.When people enter into the perception range of the sensor, the sensor will detect current light value.If the light is insufficient, lamp controlled by the sensor node will be turned on, (after order of turning on the light is given, the light value will be detected again, and if the light is still insufficient, order of turning on the light will be given again.If the light is still insufficient after 3 times, then the node is judged to be damaged).When people leave the perception range, there is a delay time for the light to be turned off.In terms of information that state of the sensor node storage lamp changes, when sink checks this sensor node, the current state will be sent to sink (if sink does not receive the reply, the sensor node will be judged to be damaged).Sink will make judgment after summarization, then pass the updated information to the upper computer.Accordingly, the upper computer can also actively issue inquiry or control orders which will be passed to sensor node via sink, to get corresponding information or control turning on and off the light.Under special conditions, such as multi-media are used, the light can be turned off by hand via original switch of the circuit.

System Hardware Design
This system realizes two kinds of nodes: sensor node and sink.

Sensor Node
The sensor node consists of the following components: infrared pyroelectric sensor, photoresistance, wireless transceivers, center processing chip, 5v power converter and relay.The hardware design circuit is shown in Figure 3.
with the 3.3v power.This module employs 2.4 GHz with the distance about more than 10 meters.It can be programmed to set the location, only when receiving the location of this single-chip, can the data be output (interrupt indication is provided).U1 is the central processing component unit.Both the sensor node and sink employs ATMEGA16L-8PU AVR single-chip.Eight-binary AVR microprocessors using the same single-chip can avoid the complexities in the coordination to develop various chips, reduce the system cost and the difficulties in maintenance.And the pro-grammers are familiar with Amega16, which is easy for development.
P4 is the infrared pyroelectric sensor module BISS0001 with three pins, among which the 1st pin connects with the high level, the 2nd pin connects with the single-chip PA0 as the output of the collected data, and the 3rd pin connects with the low level.Its operation principle is that when anyone enters its detection zone, high level will be outputted, while anyone leaves its detection zone, low level will be outputted automatically.
P2 is the wireless module nRF24L01, which employs SPI serial communication to communicate with mega16.This module has 8 pins, among which the 2nd pin connects with the single-chip MISO as the SPI output pin, the 3rd pin connects with single-chip MOSI as the SPI input pin, the 4th pin connects with the single-chip SCK as the SPI clock signal pin, the 5th pin connects CSN as the SPI enable pin, the sixth pin connects with the singlechip SCK as the mode selection pin, the 7th pin connects

Sink
Sink consists of the following components: wireless transceivers, central processing chip mega16 and Ethernet communication module.The hardware design circuit is shown in Figure 4.  P6 is SW5100 module with 10 pins, among which the 1st pin connects with the single-chip MISO as the SW5100 module SPI output pin, the 2nd pin connects with the single-chip MOSI as the SW5100 module input pin, the 3rd pin connects with the single-chip SCS as the low-efficient chip selecting signal, the 4th pin connects with the single-chip SCLK as the SPI clock signal pin.W5100 Ethernet communication module realizes the connection with the internet and sinks through the cable.Since there are network ports in the classrooms, this module can be selected to reduce the changes in the original lighting system.

Sensor Node
The followings are the functions of the sensor node.
1) The values of the infrared pyroelectric sensor and photo resistance are collected periodically to maintain the delay_3s_open_lam and delay_max_5min_close_lamp. The condition of the switch can be judged through the two values to turn on or off the light.
2) When the commands for turning on or off the lights are given, the illumination values would be collected again to judge if the nodes are damaged.
3) According to the commands from the sink, the lights will be controlled or messages will be sent to sink.
The control process for the sensor node is shown in Figure 5. Illumination intensity and the positions of the personnel are regarded as the basis for the system control.The sensor nodes in the classroom are coded uniformly.Each sensor node will detect the values of the infrared pyroelectric sensor and photo resistance to maintain the two delay values, namely delay_3s_open_lamp and delay_ max_5min_close_lamp.The sensor node will determine the status of the switch from the two values to control the switch.If the sensor node receives the commands from sink, it will judge the command type, and the control command will control the switch according to the command, while the query command will return to the current status.
Among which, three problems should be solved when employing the infrared pyroelectric sensor to detect the position of human.
1) The perception scope of the sensor is too large, and the radius of the sensor which has not been treated is 4 m (following the above designed height for the classroom).It cannot be used to confirm the specific location, but the perception radius can be decreased to the largest lamp distance of 2 through adjusting the resistance value of the module and optical lens.
2) According to the perception principle of the infrared pyroelectric sensor, the testing basis for the human signal is the relative movement, namely, if the human keeps motionless, even in the perception scope, the sensor cannot perceive, which is quite inapplicable in the classroom.The students in the classroom cannot stay still at any time.During the control procedure design process, delay_max_5min_close_lamp is introduced to avoid the misjudgment because of the stillness.If no signals for human are detected, it will turn down five minutes later.If the delay exhausts but there is still existence of human, the delay will be updated.Then when there is a tiny movement in the five minutes, it can be detected.
3) If nothing has been done and there is one passing by, a light will turn off after being turned on, which is unnecessary.The twinkle of lights will be harmful to the human body.Delay_3s_open_lamp has been introduced, namely in 3 s continuous test, there are signals for human, it can be confirmed that someone has stopped at somewhere instead of passing by.

Sink
The followings are the major functions of the sink: 1) Take turns to check the sensor node, achieve the switch status of the sensor node, photo resistance vale, and infrared pyroelectric sensor value, update the status information of the sensor for the maintenance on sink.After a cycle, if there are changes in the status of the light, it will send messages to the upper-computer.If the query demand from the upper-computer is received, information about the status of the light and current sensor node will be sent to the upper-computer.
2) If the control command has been received from the upper-computer, it will be sent to the corresponding sensor.
Sink will take turns to check each sensor node regularly, which will avoid the collision with the sensor node for active uploading.There are three major objectives for taking turns to check: 1) Send message to the sensor node to check if there are any changes in the status of the lights.
2) To see if the sensor node is broken (if there is no respond, the sensor node has been broken).
3) If commands for controlling the switch are received from the upper-computer, then turning to check this node, control command should be sent to the sensor node.After receiving the command, the sensor node will send messages for turning on or off the switch to the sink.
The sink would maintain the information for the sensor node and status of the light through taking turns to check, and changes will be updated after the check.If there is any change in the status of the switch of the light (including whether it's broken), then messages will be sent to the upper-computer, which would calculate the lighting time according to the information.Meanwhile the upper-machine can also check the state values of each sensor node through these messages.The control process chart is shown in Figure 6.
Function design for upper-computer PC serving as the upper-computer, realize the following major functions: 1) Show the serial number of the sensor nodes and sinks in the classroom.
2) Check the current status of the lights and sensor nodes in the classroom.
3) Control the switch of the lights in the classroom.4) Keep a record for the historical information of the switch and calculate the electricity consumption.
Realization interface is shown in Figure 7.

System Testing
System testing follows the following procedure: 1) Firstly design and realize the sensor node and sink, and achieve success within the stated communication scope.
2) Allocate the sensor node on each light in an experimental classroom, transform the circuit to make the sensor node control the switch, the transmission of the test data and test for success of the incident.
3) Arrange the sinks in a place in which all the sensor nodes can be covered within the communication distance of the wireless module, the sensor nodes and sinks can work.
4) Test the communications between the sink and the upper-computer.
5) Test the control over the switch of the light, and test if the upper-computer can control the switch of the light by sending commands.
6) Overall test of the system: a person walks a distance and sits at somewhere.In the test result, the roadside lights passed do not turn on, while the one above the place where the person sits turns on.When he leaves, the light will turn down automatically.The result of the upper-computers is shown in Figure 8.
Suppose that the average acreage of the classroom is 100m2 and there are 15 lights.According to this calculation method, in most cases, when one enters the classroom, he would turn on one or two lights, maybe in special conditions he would turn on 4 lights.If several students sit closely in the classroom, the number of the lights would not increase.Under such condition, the  illumination scope of the two lights is about 15 m 2 .According to the national standards, the illumination power density of the classroom is about 10 W/ m 2 , then the illumination load power about (100 m 2 -15 m 2 )×10 W/ m 2 = 850W can be saved.If the normal service time is 15 hours every day (it is the worst situation, generally we can turn off the lights in the daytime), then about 0.85 kW×15 h＝12.75 kWh power consumption can be saved for each classroom in one day.The students will be at school for 270 days in each year, and then the annual saved power is about 3442 kWh.If the school has 200 classrooms, so the predicated annual saved power is about 690000 kWh.

Conclusions
Compared with the traditional energy saving control system for the lights in the classroom, allocating sensor nodes on the corresponding lights can help get the general position of the human body, and then turn on the corre-sponding lights to save the energy substantially on the premise of satisfying illumination demand.Besides, this design based on wireless sensor network can not only decrease the changes in the original lighting system, but also get prepared for the expansion of the intelligent classroom.By adopting B-S structure, the upper-computer can check the current status of the classroom online freely.It can also know if there are broken lights or sensor node in the classroom at any time, which would bring convenience for the maintenance work.In today's avocation of energy saving, such low-cost and convenient energy saving system would certainly be widely used.

Figure 3 .
Figure 3. Hardware connection chart for sensor node.

Figure 4 .
Figure 4. Hardware connection chart for sink.

Figure 5 .
Figure 5.Control process chart for the sensor node.

Figure 6 .
Figure 6.Control process chart for the sink.

Figure 7 .
Figure 7. Display Interface for the power consumption in each classroom.

Figure 8 .
Figure 8. Real time display of the information of the classroom.