- Open Access
- Total Downloads : 1134
- Authors : N. Sribhagat Varma, Ganesh Taduri, N. Bhagirath Sai
- Paper ID : IJERTV2IS90763
- Volume & Issue : Volume 02, Issue 09 (September 2013)
- Published (First Online): 26-09-2013
- ISSN (Online) : 2278-0181
- Publisher Name : IJERT
- License: This work is licensed under a Creative Commons Attribution 4.0 International License
Automatic Electrical Appliances Control Based on Image Processing
N. Sribhagat Varma*, Ganesh Taduri *, N. Bhagirath Sai *
Abstract: Electricity has become the fundamental requirement of human life. Our businesses, day to day life, communication, etc. all of it depends on electricity. But in towards world of fast depleting natural resources like coal, we need to find effective ways to conserve electricity or else we shall see a major shortage in the future. The problem at hand is that in public buildings like offices, colleges, schools, etc. often people leave the lights and fans on when they leave the rooms. We intend to design a power management system which will sense if the room is vacant and accordingly turn the lights off.
Index Terms Image Processing, Power Management System, Automatic Power Management.
-
INTRODUCTION
The need to conserve electricity has grown at a dizzy pace stemming from the need to save the fast depleting natural resources required to generate electricity. Electricity is a basic requirement for any business to flourish and to keep the cost on electricity at a minimum any wastage has to be avoided. Often people are careless and sometimes just plain lazy to switch off the lights and fans while leaving a room especially in classrooms. To avoid this sheer loss of money and resources, automated power management system looks to detect whether the room is empty and accordingly switch off the lights and fans.
-
EXISTING WORK
Automatic Electrical Appliances Control Panel Based on Infrared and Wi-Fi: A Framework for Electrical Energy Conservation
The idea of this research work is to gather all kinds of sensor readings possible in a home and forward them hop-by-hop to an embedded system to which we refer as the home automation controller. Each time a new or configured event is detected, the controller runs over a list of already configured script statements which is triggered by the user. When there is a match between the received event and the matching part of a statement, one or more actions are performed which are detected by the sensor nodes, accessed & processed by the microcontroller and then implemented by a switching panel via the use of wireless (Wi-Fi) technology.
The strength and contribution of this work lies in the combination of a large number of sensors (e.g. infrared counter & a light dependent resistor) readings which allows deriving higher level semantics as compared to reacting on single sensor readings only.
Viola Jones paper on Robust Real-Time Object Detection This paper describes a visual object detection framework that is capable of processing images extremely rapidly while achieving high detection rates. There are three key contributions. The first is the introduction of a new image
representation called the Integral Image which allows the features used by our detector to be computed very quickly. The second is a learning algorithm, based on AdaBoost, which selects a small number of critical visual features and yields extremely efficient classifiers. The third contribution is a method for combining classifiers in a cascade which allows background regions of the image to be quickly discarded while spending more computation on promising object-like regions. A set of experiments in the domain of face detection are presented. The system yields face detection performance comparable to the best previous systems. It is implemented on a conventional desktop, face detection proceeds at 15 frames per second.
-
PROBLEM SPECIFICATION
Each room has dedicated switches for controlling the fans and lights in that particular room. Often people using the room vacate it without bothering to turn off the lights and switches. As a result whenever the room is vacant someone has to visit each room and manually switch off the lights and fans. However this is impractical due to the following reasons:
-
Difficult to manually keep track off which class is empty.
-
Dedicated man power for this purpose is not feasible. Thus the following results
-
Power wastage
-
Higher bills
-
Painstaking process to switch off lights and fans every time class is empty.
-
-
-
SOLUTION ARCHITECUTRE
The proposed solution requires the room to be fitted with a camera. This camera captures live feed of the room and gives it to the computer to process it. The face detection module then detects human presence.
Figure 1: Solution Architecture
If no such presence is detected then via the parallel port DB-25 present in the computer a signal is sent to the relay which then sends a signal to switch off the power supply.
-
IMPLEMENTATION
This section describes an implementation of the system for face detection and tracking algorithm, which would enable us to detect objects in frames, forwarded from a web camera. This section also discusses some of the issues we met along the path and decisions made to overcome them. For implementation we used Visual C++ as a wrapper for OpenCV [3]. The library provides trained classifiers for frontal face and right profile. One way to obtain an ability to detec other poses, would be to train additional classifiers, as it was proposed by Viola and Jones [6]. Though technically it is clear how to do that, it would require significant amount of resources. We would need large database of positively and negatively labeled images and probably weeks to train a classifier for that dataset.
We propose an automated system for power management to solve the problem of electricity wastage when people leave rooms without switching off the fans and lights. This system will mainly comprise of three modules.
-
The first part is the machine learning part which trains the system to detect human presence from real time feed from the camera.
-
The second part is the control logic part which processes the feed and sends a signal to the parallel port.
-
The third and final part which is responsible for switching off the electricity supply on receiving the signal from the parallel port pin.
We will now explain each in detail.
Machine Learning Module
The machine learning module consisted of following five steps basically with the objective of training the haar classifier to detect faces. All this is accomplished in OpenCV platform which provides a platform for haar classifiers.
Step 1: Creating the description file of positive samples and storing it in a folder positive image set
Step 2: Creating the description file of negative samples and storing it in a folder.
This is basically to tell the system what is not to be detected. Hence this includes a set of negative samples which has no face. Usually this image set is two-three times the size of the positive set.
Step 3: Packing the positive samples into a .vec description file.
All the positive parameters marked from the positive sample is now packed into a .vec description file by using a command.
Opencv -createsamples -info.txt -vec vecfile.vec -w 30 -h 32
Step 4: Training the haar classifier
Now using the above .vec file and the negative sample description file, we execute the haar training algorithm. This takes a long time.
The command is
Opencv -haartraining -data haar -vec vecfile.vec -bg negative.txt -nstages 30 -mem 2000 -mode all -w 30 -h 32
After executing this command, it will create a directory named haar and put all the training data in it.
Step 5:Convert the data in the haar directory to an xml file Finally all we want is an xml file and hence we execute the following command to convert the data in the haar directory to an xml file.
convert_cascade size=30X32 data haarcascade_frontalface_alt.xml
Control Logic
This module involves the face detection code which makes use of the training data from the previous model in the form of an xml file.
Also this code will run with a timer such that if the timer gets over and still no face is detected it will trigger the next module.
Output Circuit
The control logic module passes a trigger to the output circuit via the parallel port.
The parallel port DB-25
Figure 2: Parallel port
The Parallel Port is the easiest way to control devices outside the PC, like LEDs, lights and even home appliances. In fact the idea behind parallel port is really simple. It is an 8-bit parallel interface, so we have eight bits available there. Simple put, since each data bit can be set as either 0 (turned off) or 1 (turned on), we can directly turn on or off up to eight devices.
Parallel Port has mainly 3 modes of operation :- SPP – Standard Parallel Port
EPP – Enhanced Parallel Port ECP – Extended Capabilities Port
So, we have in total 25 pins.
8 Data Pins
4 Control Pins 5 Status Pins 8 Ground Pins
Data Pins
Data pins are used to send 8-bits of data. Pins 2 to 9 are data pins or we can call them as an 8-bit data bus (D0 D7). This data bus carries 8-bit data at any instant of time as shown below.
The type of data it carries is in digital form, i.e. either 0 or 1.
0 means OFF or 0 volts.
1 means ON or 5 volts.
So we will be sending a signal through a data pin and cause changes to the circuit.
The Circuit
Figure 3: Circuit diagram
The circuit consists of two main parts – ULN2803 IC and a 5 pin Relay. Working of both of them is explained below:-
Working of Relay
A relay is an electrically operated switch. It allows one circuit to switch a second circuit which is completely separated from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit. There is no electrical connection inside the relay between the two circuits, the link is magnetic and mechanical.
Figure 4: Working of relay
In the above figure, when controlling switch is closed, current flows through the coil and thus, magnetic field is produced. The resulting magnetic field attracts an armature that is mechanically linked to a set of contacts. The movement makes a connection with a fixed contact and circuit gets completed. When the current to the coil is switched off, the armature is returned by a force approximately half as strong as the magnetic force to its relaxed position and the connection is broken.
The relay's switch connections are usually labeled COM, N/C and N/O:
-
COM = Common, always connect to this, it is the moving part of the switch.
-
N/C = Normally Closed, COM is connected to this when the relay coil is off.
-
N/O = Normally Open, COM is connected to this when the relay coil is on.
-
Connect to COM and N/O if you want the switched circuit to be on when the relay coil is on.
-
Connect to COM and N/C if you want the switched circuit to be on when the relay coil is off.
Working of ULN2803 IC
IC ULN2803 consists of octal high voltage, high current darlington transistor arrays. The eight NPN Darlington connected transistors in this family of arrays are ideally suited for interfacing between low logic level digital circuitry (such as TTL, CMOS or PMOS/NMOS) and the higher current/voltage requirements of lamps, relays, printer hammers or other similar loads for a broad range of computer, industrial, and consumer applications.
Figure 5: ULN 2803
The ULN 2803 IC consists of eight NPN Darlington connected transistors (often called a Darlington pair). Darlington pair consists of two bipolar transistors such that the current amplified by the first is amplified further by the second to get a high current gain or hFE.
Now 2 cases arise:-
Case 1: When IN is 0 volts.Q1 and Q2 both will not conduct as there is no base current provided to them. Thus, nothing will appear at the output (OUT).
Case 2: When IN is 5 volts.
Input current will increase and both transistors Q1 and Q2 will begin to conduct. Now, input current of Q2 is combination of input current and emitter current of Q1, so Q2 will conduct more than Q1 resulting in higher current gain which is very much required to meet the higher current requirements of devices like motors, relays etc. Output current flows through Q2 providing a path (sink) to ground for the external circuit that the output is applied to. Thus, when a 5V input is applied to any of the input pins (1 to 8), output voltage at corresponding output pin (11 to 18) drops down to zero providing GND for the external circuit. Thus, the external circuit gets grounded at one end while it is provided +Vcc at its other end. So, the circuit gets completed and starts operating.
Circuit Working
Working of this circuit is very simple. When data at pin 2 is '1', i.e., when 5V is coming out of pin 2 then, pin 1 of ULN2803 IC receives 5V input and thus its pin 18 provides GND to one end of relay coil. The other end of relay coil is given +Vcc (12V), so the coil gets energized and the COM gets connected to the N/O contact and the AC mains circuit gets completed and the bulb glows.
Now, bulb will glow as long as data at pin 2 is high. When data at pin 2 becomes low, then the GND provided by pin 18 of ULN2803 IC vanishes and coil gets de-energized and thus
COM is connected back to N/C contact. Thus, external AC mains circuit is broken and bulb stops glowing.
-
-
RESULTS AND ANALYSIS
Figure 6: Detecting Multiple Faces
Test Case
Steps to execute the test case
Expected Result
Actual Result
Test Result
Detect
a
Start the system
A rectangle is
A rectangle is
Met
valid face
Ask a person to
formed around
formed around
stand in front of
a face to show
a face to show
the camera
that it is being
that it is being
detected
detected
Detect
Start the system
Rectangle
Rectangles are
Met
multiple
Ask
multiple
should be
formed around
faces
at
people to occupy
formed around
all the faces
various
room at varying
all the faces.
angles
distances
Detect no
Start the system
No rectangles
No
rectangles
Met
faces
Empty the room
should be
are formed
when
of people
formed
room
is
empty
Test Case
Steps to execute the test case
Expected Result
Actual Result
Test Result
Detect
a
Start the system
A rectangle is
A rectangle is
Met
valid face
Ask a person to
formed around
formed around
stand in front of
a face to show
a face to show
the camera
that it is being
that it is being
detected
detected
Detect
Start the system
Rectangle
Rectangles are
Met
multiple
Ask
multiple
should be
formed around
faces
at
people to occupy
formed around
all the faces
various
room at varying
all the faces.
angles
distances
Detect no
Start the system
No rectangles
No
rectangles
Met
faces
Empty the room
should be
are formed
when
of people
formed
room
is
empty
Face Detection Module
Test Case
Steps to execute the test case
Expected Result
Actual Result
Test Result
Check if all
Take one wire out of
Multi-
Multi-
Met
pins
of
the
all the 25.
meter
meter
DB-25 cable
Hold one probe of the
should
shows
is working
multi-meter
to
one
show
deflection
end of the wire and
deflection
in value
one towards the apt
in value
pin
Check if the
Send a signal via any
The
bulb
The
bulb
Met
port pins are
of the lines D0-D7
should
switches
working
Try to switch a bulb
switch
on or off
on/off
on/off
Test Case
Steps to execute the test case
Expected Result
Actual Result
Test Result
Check if all
Take one wire out of
Multi-
Multi-
Met
pins
of
the
all the 25.
meter
meter
DB-25 cable
Hold one probe of the
should
shows
is working
multi-meter
to
one
show
deflection
end of the wire and
deflection
in value
one towards the apt
in value
pin
Check if the
Send a signal via any
The
bulb
The
bulb
Met
port pins are
of the lines D0-D7
should
switches
working
Try to switch a bulb
switch
on or off
on/off
on/off
Table 1: Testing the Face Detection Module Circuit
Table 2: Testing the Circuit
System Testing
Test Case
Steps to execute the test case
Expected Result
Actual Result
Test Result
Check if lights switch off when room is empty
Empty the room Run the system
Lights should switch off
Lights switch off
Met
Check if lights remain on when room occupied
Ask people to occupy room Run the system
The lights should remain on
The lights remain on.
Met
Table 3: Testing the System
-
CONCLUSION
The need to automate the whole process of power management is very much there and this need is only going to escalate in the future with rising prices and scarcity of resources. Automated power management system is an effort in this direction and a small attempt to solve one of the biggest problems of mankind. With respect to our objective and scope, we have implemented and tested our system to the best possible.
We thus conclude that automated power management system provides a practical and feasible approach to the problem of power management
REFERENCES
-
http://makematics.com/research/viola-jones/
-
http://ramsrigoutham.com/2012/09/16/viola-jones-face- detection-and-camshift-tracking-explained/
-
openCV.willowgarage.com/documentation/cpp/index.html
-
Automatic Electrical Appliances Control Panel Based on Infrared and Wi-Fi: A Framework for Electrical Energy, International Journal of Scientific & Engineering Research Volume 2, Issue 7, July-2011 ISSN 2229-5518
-
Theo Ephraim, Tristan Himmelman, and Kaleem Siddiqi. Real-time viola-jones face detection in a web browser. In Proceedings of the 2009 Canadian Conference on Computer and Robot Vision, CRV '09, pages 321{328, Washington, DC, USA, 2009. IEEE Computer Society.
-
M Jones and P Viola. Fast multi-view face detection. Mitsubishi Electric Research Lab TR2000396, (July), 2003.
-
J. Kovac, P. Peer, and F. Solina. Human skin color clustering for face detection. In EUROCON 2003, volume 2, pages 144{148, 2003.
-
Paul Viola and Michael Jones. Robust real-time face detection. International Journal of Computer Vision, 57:137{154, 2004.
-
ShanshanWang and Amr Abdel-Dayem. Improved viola- jones face detec- tor. In Proceedings of the 1st Taibah University International Conference on Computing and Information Technology, ICCIT '12, pages 321{328, 2012.
AUTHORS
First Author N. Sribhagat Varma, Student of B.E. IV/IV ComputerScience Engineering, Chaitanya Bharathi Institute of Technology, Gandipet, Hyderbad, Andhra Pradesh, India, PIN:500075
Second Author Ganesh Taduri, Student of B.E. IV/IV ComputerScience Engineering, Chaitanya Bharathi Institute of Technology, Gandipet, Hyderabad, Andhra Pradesh, India, PIN: 500075
Third Author N. Bhagirath Sai , Student of B.E. IV/IV Information Technology, 3 Veerasamy Street, West Mambalam, Chennai 600 033.