Vous êtes sur la page 1sur 30

MACHINE VISION

BASED TO CONTROL
APPLIANCES

07-May-15

Machine vision based to control appliances

The University Of Faisalabad

MACHINE VISION BASED TO CONTROL


APPLIANCES
Group Leader: M. Nauman Khan
Group Members:
M. Nauman Khan

BEE-FA13-027

M. Umar Azmat

BEE-FA13-020

M. Kashif Azeem

BEE-FA13-043

Arbab Aslam

BEE-FA12-001

M. Usman Haider

BEE-FA13-112

M. Hamza Kaleem

BEE.FA13-046

Usama Bin Zahid

BEE-FA13-064

M. Tayyab Shafiq

BEE-FA13-105

M. Abuzar Anwar

BEE-FA13-025

Ali Hassan

BEE-FA13-021

Amanullah Cheema

BEE-FA12-096

School of Electrical Engineering, University of Faisalabad.

Page 2

Machine vision based to control appliances

ACKNOWLEDGEMENTS
We bow our head before Allah Almighty, the Omnipotent, the Merciful, the most
Beneficent, the Answerer to the prayers and the sovereign whose blessings and
exaltations flourished our thoughts, enlightened our heart, thrived our ambitions and
enabled us to contribute sincerely to the sacred wealth of knowledge. Our all praise for
the greatest reformer of the world, Hazrat Muhammad (PBUH), whose name enlightens
our heart and who is forever a tower of knowledge and guidance of humanity.
We feel honored to express our profound sense of gratitude to our supervisor Engr.
Awais Ahmed Cheema (Assistant Professor, School of Electrical Engineering,
University of Faisalabad) for his kind supervision, affectionate behavior and marvelous
guidance throughout the research work. His invaluable help of constructive comments
and suggestions throughout the proteus work have contributed to the success of this
research. We owe our deepest gratitude to him for his much concern, sincere advice,
unforgettable guidance, and kind behavior. We are very grateful to him for his moral
support, nice cooperation, encouragement and technical knowledge regarding this topic
which helped us a lot in this research work.
No acknowledgement would ever adequately express our obligation to our Parents for
their indispensable and indivisible love that remained assisted and encouraged us. Their
affection, motivation, sacrifices and endless prayers serve as a tonic for us. Thanks to
Allah for bestowing us with true and loving Friends who encouraged and pacified us
during tough hours of research.
Arbab Aslam.

School of Electrical Engineering, University of Faisalabad.

Page 3

Machine vision based to control appliances

TABLE OF CONTENTS
CHAPTERS

PAGE

ACKNOWLEDGEMENTS ...

TABLE OF CONTENTS ..

ABSTRACT ......

INTRODUCTION ............

METHODOLOGY .......

EXPERIMENTAL WORK ..

Motion Sensor .....

MikroC PIC Programming Tool .....

11

Creating Project In MikroC...

11

Complition .

12

Software...

12

Labscenter Proteus 8.0.....

13

Coding of PIC16F877A Using MikroC ......

19

PIR Sensor Equivalent Circuit Diagram in Proteus ..

22

Temperature Sensor ..

24

IC (pic16F877A)

24

RESULT AND PROGRAMMING-CHARTS..

25

CONNCLUSION ..

29

REFERENCES ..

30

School of Electrical Engineering, University of Faisalabad.

Page 4

Machine vision based to control appliances

ABSTRACTS:
We proposed to design an Auto-motion temperature varying Sensor. This Auto-motion
Sensor is the interconnection of electrical devices in a household together to perform a
function without human intervention. Auto-motion is a device that detects moving
objects, particularly people. A motion detector is often integrated as a component of a
system that automatically performs a task or alerts a user of motion in an area. Motion
detectors form a vital component of security, automated lighting control, home control,
energy efficiency, and other useful systems. In this work, we design and implement a
device that would detect the presences movement. If the person entered the room and
switch on or off the Fan and other equipment like heater, and check the temperature
condition is true or false in a certain temperature which we desire in the room, if a
presences movement is detected.

School of Electrical Engineering, University of Faisalabad.

Page 5

Machine vision based to control appliances

MACHINE VISION BASED TO CONTROL


APPLIANCES
I. INTRODUCTION:
By saving Electrical energy will directly reflected to saving money so it is very necessary
to under stood ghost unit or amount which we are paying without using the appliances
and without the energy namely electricity no nation can survive. In this industrial world it
becomes as oxygen.
The main epitome of the scrutiny is to espy the adoption and reception of energy saving
campaign initiated by PEPCO. [1]
Temperature is the most often-measured environmental quantity. This might be expected
since most physical, electronic, chemical, mechanical, and biological systems are
affected by temperature. Certain chemical reactions, biological processes, and even
electronic circuits perform best within limited temperature ranges and measurement of
temperature is critical in modern electronic devices, especially expensive laptop
computers and other portable devices with densely packed circuits which dissipate
considerable power in the form of heat. Knowledge of system temperature can also be
used to control battery charging as well as prevent damage to expensive microprocessors
[2]

Infrared waves are not visible to the human eye. In the electromagnetic spectrum,
infrared radiation can be found between the visible and microwave regions and the
Human motion detection, in which we are interested in recognizing humans based solely
on the characteristic patterns of motion that they exhibit.
This approach gives a direct way for human detection, such as those that recognize
humans based on shape, color, texture, or surface features [3].

School of Electrical Engineering, University of Faisalabad.

Page 6

Machine vision based to control appliances

The Auto-motion sensor is the interconnection of electrical devices to switching and


occupancy information was then used to identify potential energy savings gained with a
sensor-controlled system [4].

II. METHODOLOGY:

In simplest term, the control is defined as the starting, stopping or regulation of heating,
ventilating, and air conditioning system. Controlling an HVAC system involves three
distinct steps:
1) Measure a variable and collect data
2) Process the data with other information
3) Cause a control action

The above three functions are met through sensor, controller and the controlled device.
HVAC control system, from the simplest room thermostat to the most complicated
computerized control, has four basic elements: sensor, controller, controlled device and
source of energy.
1) Sensor measures actual value of controlled variable such as temperature, humidity
or flow and provides information to the controller.
2) Controller receives input from sensor, processes the input and then produces
intelligent output signal for controlled device.
3) Controlled device acts to modify controlled variable as directed by controller.
4) Source of energy is needed to power the control system. Control systems use
either a pneumatic or electric power supply. [5]

In this paper, the design of an automatic control of AC and Electric Heater using motion
sensor and temperature sensor as the automatic control branches of this project.
First of all, when motion sensor sense the motion of any presence then it will deliver the
current to the temperature sensor. The temperature sensor then sense the temperature of

School of Electrical Engineering, University of Faisalabad.

Page 7

Machine vision based to control appliances

the room in which it is installed and then turn on or off the AC and Electric heater
according to the present temperature sensed.
The method at which our required output is on or off is controlled by the IC
(pic16F877A).
The circuit strategy for this system is shown in figure1.

Figure1: Design Strategy.

III. EXPERIMENTAL WORK:


It is clear from figure1 that this design is consisted of some main branches including
Motion Sensor, Temperature Sensor and most important part of this circuit is Microcontroller that controls the input signal reference to control the output.

Motion sensor:
Nowadays, house security system becomes the best solution to overcome
house intrusion problem when user is not in house. As we know, there are

School of Electrical Engineering, University of Faisalabad.

Page 8

Machine vision based to control appliances

many types of house security system which is too expensive and difficult to use. For that
reason, an effective house security system at low cost is built where user can also
program the security system by their own. This project is focusing on developing a house
security system with an active infrared motion detector which is controlled by
microcontroller Intel 8051. The overall project is divided into two parts. The
first part

is

concern

on

the

hardware

development where all

electronics

component are connected via the circuit design using wrapping technique. An
active

infrared,

the magnetic sensor, and keypad are the input components while

buzzer, indicator, and LCD display are the output components where its all controlled
by controller circuit.
The second part is based on software programming to operate the hardware structure.
Program for security system based on microcontroller Intel 8051 assembly language is
assemble using ASM51 assembler to get the binary file thus, to load into external
memory of the hardware

structure via serial communication.

Sensors measure the controlled medium and provide a controller with information
concerning changing conditions in an accurate and repeatable manner. The common
HVAC variables are temperature, pressure, flow rate and relative humidity. The siting of
sensors is critical to achieve good control. In sensing space conditions, the sensing device
must not be in the path of direct solar radiation or be located on a surface which would
give a false reading such as a poorly insulated external wall. In pipe-work or ductwork,
sensors must be arranged so that the active part of the device is immersed fully in the
fluid and that the position senses the average condition. Sometimes averaging devices are
used to give an average reading of measured variable for example in large spaces having
number of sensors, an averaging signal is important for the controller.
The PIR sensor itself has two slots in it, each slot is made of a special material that is
sensitive to IR. The lens used here is not really doing much and so we see that the two
slots can 'see' out past some distance (basically the sensitivity of the sensor). When the
sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from
the room or walls or outdoors, when a warm body like a human or animal passes by, it
first intercepts one half of the PIR sensor, which causes a positive differential change
between the two halves. When the warm body leaves the sensing area, the reverse
School of Electrical Engineering, University of Faisalabad.

Page 9

Machine vision based to control appliances

happens, whereby the sensor generates a negative differential change. These change
pulses are what is detected.
The motion sensor in this circuitry is used to sense the presence of any living body in its
bound ranged. This motion sensor is also known as the PIR (passive infrared rays)
sensor.
Now install the PIR module hanging from a 3 meter height mast (to cover 10 meter
radius area) and connect its supply and relay terminals to our finished and enclosed
circuit, and output side of relay light indicated the Microcontroller and Temperature
Sensor.

Circuit Diagram:

Figure 2: Circuit Diagram.

School of Electrical Engineering, University of Faisalabad.

Page 10

Machine vision based to control appliances

MikroC PIC Programming Tool:


MikroC is a powerful, feature rich development
tool for PIC microcontrollers. It is designed to provide the customer with the easiest
possible solution

for developing application for embedded system,

without

compromising performance or control.


PIC is the most popular 8-bit chip in the world, used in a wide variety of application, and
C, prized for its efficiency, is the natural choice for developing embedded systems.
MikroC provides a successful match featuring highly advanced IDE,ANCI compliant
compiler, broad set of hardware libraries, comprehensive documentation, and plenty of
ready-to run examples.

Creating Project In MikroC:


A step by step approach
1. Creating new project:

Figure 3: Creating new project.

School of Electrical Engineering, University of Faisalabad.

Page 11

Machine vision based to control appliances

Compilation:
When we have created the project and written the code then following work I
have been done.

Figure 3: Compilation.

Software:
In this project a microcontroller is used named as PIC16F877A
which is programmable and is the main part of our project. This microcontroller cannot
be used without programming, so for this purpose we used MikroC Pro software which is
capable of embedding our desired programming in microcontroller. And the other
Software used in our project is Labscenter Proteus Demonstration 8.0.

School of Electrical Engineering, University of Faisalabad.

Page 12

Machine vision based to control appliances

Labscenter Proteus 8.0:


The Proteus Design Suite is wholly unique in offering the ability to co-simulate both high
and

low level micro-controller code in the context of a mixed-mode SPICE circuit

simulation. With this Virtual System Modeling facility, you can transform your product
design cycle, reaping huge rewards in terms of reduced time to market and lower costs of
development.
If one person designs both the hardware and the software then that person benefits as the
hardware design may be changed just as easily as the software design. In larger
organizations where the two roles are separated, the software designers can begin work as
soon as the schematic is completed; there is no need for them to wait until a physical
prototype exists.
Proteus Virtual System Modeling (VSM) combines mixed mode SPICE circuit simulation,
animated components and microprocessor models to facilitate co-simulation of complete
microcontroller based designs. For the first time ever, it is possible to develop and test such
designs before a physical prototype is constructed. This is possible because you can interact
with the design using on screen indicators such as LED and LCD displays and actuators
such as switches and buttons. Proteus VSM also provides extensive debugging facilities
including breakpoints, single stepping and variable display for both assembly code and
high level language source.

School of Electrical Engineering, University of Faisalabad.

Page 13

Machine vision based to control appliances

Figure 1: Proteus.

Steps for circuit simulation:

1.Overview:
Start the program by click the ISIS Professional icon in Start Menu.

School of Electrical Engineering, University of Faisalabad.

Page 14

Machine vision based to control appliances

Figure 2: Overview.

2. Circuit Construction & Assembly:


Prior to circuit construction, user must first identify the necessary components required in the
circuit. For our Project the required components are:
i.
PIC16F877A
ii.
LED
iii.
Resistor
iv.
Relay
v.
Power Supply Terminals / Grounding.
vi.
Virtual Terminal
vii.
COMPIM

a. Selecting Components in Proteus:


To select any component, we click the button labeled PICK on the left toolbar of
Proteus VSM. The devices can then be searched and selected by giving the appropriate
name in the search box.

School of Electrical Engineering, University of Faisalabad.

Page 15

Machine vision based to control appliances

Figure 3: Selecting Components.

b. Component parameter setting:


After selecting the component from the library, we can define the various parameters of
the devices by right clicking on the device and selecting EDIT PROPERTIES. The
various default device parameters can be changed and new parameters can be defined in
the other properties section.

School of Electrical Engineering, University of Faisalabad.

Page 16

Machine vision based to control appliances

Figure 4: Component parameter setting.

c. PIC16F877A parameter setting:


The PIC16F877A property panel can be similarly obtained by right clicking the PIC and
selecting Edit Component. The PIC parameters like Oscillator frequency, program
configuration word and other properties should be appropriately supplied. The program
code in hex file should be loaded in the program file section.
The programming file in .hex file which is written in mikroC for our desired function is
loaded in the program file section.

School of Electrical Engineering, University of Faisalabad.

Page 17

Machine vision based to control appliances

Figure 5: Microcontroller Properties.

2. Simulation:
After defining all the various parameters in the PIC and the other components and also
loading the hex file in the controller, we can start the simulation by clicking the PLAY
button on the bottom panel of the Proteus VSM.

Figure 9: simulation.

School of Electrical Engineering, University of Faisalabad.

Page 18

Machine vision based to control appliances

Coding of PIC16F877A Using MikroC:


// LCD module connections
sbit LCD_RS at RB0_bit;

// rs connection at rb0

sbit LCD_EN at RB1_bit;

// en connection at rb1

sbit LCD_D4 at RB2_bit;

// d4 connection at rb2

sbit LCD_D5 at RB3_bit;

// d5 connection at rb3

sbit LCD_D6 at RB4_bit;

// d6 connection at rb4

sbit LCD_D7 at RB5_bit;

// d7 connection at rb5

sbit LCD_RS_Direction at TRISB0_bit;

// data direction setting

sbit LCD_EN_Direction at TRISB1_bit;

// data direction setting

sbit LCD_D4_Direction at TRISB2_bit;

// data direction setting

sbit LCD_D5_Direction at TRISB3_bit;

// data direction setting

sbit LCD_D6_Direction at TRISB4_bit;

// data direction setting

sbit LCD_D7_Direction at TRISB5_bit;

// data direction setting

// End LCD module connections


float volt,temp;
//int temp;
unsigned char volt_char[15];
void init()
{
lcd_init() ;
lcd_cmd(_lcd_clear);
lcd_cmd(_lcd_cursor_off);
}
void main()
{
init();
School of Electrical Engineering, University of Faisalabad.

Page 19

Machine vision based to control appliances

lcd_out(1,1,"temperature");
lcd_out(1,13,"o");
lcd_out(2,14,"C");
while(1)
{
volt=adc_read(6);
// floattostr(volt,volt_char);
// lcd_out(2,1,volt_char);
// temp=volt/2;
// floattostr(temp,volt_char);
volt=volt/1024;
volt=volt*5000;
temp=volt/10;

inttostr(temp,volt_char);
lcd_out(2,1,volt_char);
delay_ms(500);
if(temp>=15)
{
PORTD = 0x00;

// Toggle OFF

Delay_ms(50);
TRISC = 0x00;

// Set PORTC as Output

PORTC = 0xFF;

// Toggle ON

// Delay_ms(50);
}
else if(temp<10)
{
portc=0x00;

// Toggle OFF

Delay_ms(50);
TRISD = 0x00;

// Set PORTD as Output

PORTD = 0xFF;

// Toggle ON

School of Electrical Engineering, University of Faisalabad.

Page 20

Machine vision based to control appliances

}
else
{
portc=0x00;
portd=0x00;
}
delay_ms(500);
}}

Figure 10: MikroC Programming.

School of Electrical Engineering, University of Faisalabad.

Page 21

Machine vision based to control appliances

Figure 11:MikroC Programming.

PIR Sensor Equivalent Circuit Diagram in Proteus:

1.

On condition:

When motion detect we assume the Input Supply (V1) is 12v then relay Normally
Closed and output terminal turn on the supply this is behave like a on switch and turn
on lamp this is indicate the supply voltage 5v go to the Micro-controller side or
temperature sensor side when 5v input side the temperature sensor terminal and
microcontroller Vcc terminal then both temperature and microcontroller are on see
fig12.

School of Electrical Engineering, University of Faisalabad.

Page 22

Machine vision based to control appliances

Figure 12: On condition.

2.

Off condition:

When motion didnt detect we assume the Input Supply (V1) is 0v then normally
opened relay and behave like a off switch and supply turn off condition the lamp is in
off state condition this is indicate the supply voltage 0v go to the Micro-controller
side or temperature sensor side when 0v input side the temperature sensor terminal
and microcontroller Vcc terminal then both temperature and microcontroller are turn
off see fig13.

School of Electrical Engineering, University of Faisalabad.

Page 23

Machine vision based to control appliances

Figure 13: Off condition.

Temperature Sensor:
The temperature sensor is used in this circuit to give a complete information of the
temperature to the IC so that the IC then showing direction to current.
In this paper we use motion sensor equivalent AND gate and 5v Vcc supply. When
motion deduct then output high and turn on micro-controller and temperature sensor and
0v volt indicate the motion didnt deduct and circuit behave the off condition.
After motion deduction output voltage goes the temperature sensor (LM35) where LM35
sense the temperature therefore 10 C=1mV.

IC (pic16F877A):
The IC (pic16F877A) is used to control the circuit automatically using IC programming.
When the IC reads temperature above than or equal to 15 degree Celsius then the IC at
once decided that this time the current will have to go towards the AC or fan. But if the

School of Electrical Engineering, University of Faisalabad.

Page 24

Machine vision based to control appliances

temperature is less than 10 degree Celsius the IC turn the path on for current towards the
Electric heater.
The data goes to micro-controller pin num A6 where micro-controller read data analog
signal 10 bit then data goes to comparison and displaying side where comparison
compare and control A.c or Heater and display unit side display the temperature shown in
the fig.

IV. RESULTS AND PROGRAMMING-CHARTS:

Different parameters are taken into account when it is required to analyze such system
design. In this research, different key parameters including temperature difference
between room and selected temperature are set in the microcontroller. When temp>17
then turn on fan shown as the equivalent of A.c shown in Fig 5.

Figure 14: Turn on fan.

School of Electrical Engineering, University of Faisalabad.

Page 25

Machine vision based to control appliances

When temp in-between 17 and 10 thus turn off AC equivalent and heater equivalent
shown in the fig 15.

Figure 15: Turn off Fan and Heater.

When temp>10 then turn on matrix LED shown as the equivalent of Heater shown in Fig
16.

School of Electrical Engineering, University of Faisalabad.

Page 26

Machine vision based to control appliances

Figure 16: Turn on Heater.

Programming N.s chart see in the fig 17.

Figure 17: N.S-chart.


School of Electrical Engineering, University of Faisalabad.

Page 27

Machine vision based to control appliances

Flow chart see in the fig 18.

Figure 18: Flow chart.

School of Electrical Engineering, University of Faisalabad.

Page 28

Machine vision based to control appliances

V. CONCLUSION:
The application of Heating, Ventilating, and Air-Conditioning (HVAC) controls starts
with an understanding of the building and the use of the spaces to be conditioned and
controlled.
This automatic control of AC and Electric heater allows the users to get a complete
relaxation from turning on or off the AC or fan and heater. In this system, Different
battery banks are introduced in this simulation and out of them a suitable choice can be
made depending upon the lifetime, efficiency, capital, replacement and maintenance costs
etc. Different hydropower turbines can be selected according to the requirement of the
users. All kinds of comparisons, loads, production and monthly average spreadsheets are
originated and a sustainable power system is designed for the provided values of loads in
accordance. Even if load demands or specifications including head length and water flow
rate is changed, the system can be redesigned using this simulation package.

School of Electrical Engineering, University of Faisalabad.

Page 29

Machine vision based to control appliances

VI. REFERENCES:
1.

Shahzad Ali, Nashid Anjum, Electricity Crisis in Pakistan: Reception &

Adoption of Energy Saving Campaign Messages by PEPCO,


(http://www.bzu.edu.pk/PJSS/Vol32No12012/Final_PJSS-32-1-14.pdf)

2.

Walt Kester, James Bryant, Walt Jung, TEMPERATURE SENSORS

(http://www.analog.com/media/en/training-seminars/designhandbooks/781977449sscsect7.PDF)

3.

David Moore, A real-world system for human motion detection and tracking

(http://www.vision.caltech.edu/~dmoore/dmoore-final-thesis.pdf)

4.

Rebekah Yozell-Epstein, Economic Energy and User Needs Analysis of

Intelligent Lighting Systems,


(http://best.berkeley.edu/research/smartLighting/support/yozell-epstein_MS.pdf)

5.

http://www.electroschematics.com/5982/motion-sensor-switch-for-alarm-light-or-

water-sprinkler/

Authors Profile:
1.

Awais Ahmed received his Masters degree in Electronics and information

Technology in 2012 from USW, England. He has attained a 5 years research experience
and working as a lecturer in school of electrical engineering, The University of
Faisalabad, Pakistan.

School of Electrical Engineering, University of Faisalabad.

Page 30

Vous aimerez peut-être aussi