Home Automation System Design Using Verilog Hardware Descriptive Language
Home Automation System Design Using Verilog Hardware Descriptive Language
living.
The basic home automation system will try to meet hosts
demand and make the home as safe and comfortable as
possible [1]. Various products are available in the market
which is often very costly. Sometimes you need to preplan
about a home automation before making a home. Also there
are some product those are discrete. This problem can be
solved through a single program that checks security than
comfort. Therefore home automation system can control all the
desired things in one go. This will let the owner relax perfectly
and will not have to panic around checking doors and windows
often.
Our home automation system works in two phases. When
the owner comes home from outside he disarm the system
using password then he enter the home and arm the system
again so that the entire home automation is activated. When
the users are not present at home only the security system is
activated. The entire system is dependent upon multiple
sensors which act as input to the program.
A. Problem
The target of the project is to provide the maximum security
and comfort to home users at the cheapest price.
B. Objective
The prime objective of the project is designing a home
automation system that is capable of providing high security
and always maintaining desired temperature, luminosity and
controlling according to human presence.
The academic goal of this project is to develop specific skills
in designing, programming, testing and debugging.
C. Project Scope
Our system was designed to control the door, window,
garage door, fire alarm, luminosity, and temperature. It is not
designed to control any other device.
Komol Arafat. Gani, is the final year student studying Electrical and
Electronics Engineering, North South University, Block-B, Bashundhara,
Baridhara, Dhaka 1229, Bangladesh (e-mail:[email protected]).
Farzana. Yasmin is the final year student studying Electrical and
Electronics Engineering, Department of Electrical, Electronics and Computer
Science , North South University, Block-B, Bashundhara, Baridhara, Dhaka
1229, Bangladesh (e-mail: [email protected]).
A B M Najmul Karim is a graduate student from Department of Electrical
Engineering and Computer Science, North South University, Dhaka,
Bangladesh (e-mail: [email protected]).
Iqbalur Rahman Rokon is a Faculty member in North South University,
Dhaka, Bangladesh. Former Sr. Engineer, VLSI Chip Research and
Development (R&D), Emulex Corporation, California, USA. (Phone: +8801726246189 ; e-mail: [email protected] ).
D. Assumption
Due to the limitation of the time constraints and also due to
the hardware inaccessibility and expense, it was assumed that
readily available sensors are used on all the devices. The scope
of the project is only controlling the device internally.
II. APPROACH
Initially the priority is set, and then the design is taken into
consideration. By keeping a virtual house as role model the
35
2nd International Conference on Recent Trends in Computer and Information Engineering (ICRTCIE'2013) Dec. 20-21, 2013 Bali (Indonesia)
B. Hierarchy
36
2nd International Conference on Recent Trends in Computer and Information Engineering (ICRTCIE'2013) Dec. 20-21, 2013 Bali (Indonesia)
C. State Diagram
//////////////////////////////////////////////////////////////////
start
module Home_automation(
clock,reset,door,garage,window,fire, in,
clk,motion_sen,temp_sen,
lume_sen,light,heater,cooler,light_high,light_low,dooralarm,g
aragealarm,windowalarm,firealarm,window_state,garage_state
,door_state,fire_state,flag,alarm);
input [7:0]in;wire [7:0]in;reg [7:0]arr [0:3];reg [7:0]arr1
[0:3];
input clock,reset,door,garage, window, fire,clk;
output windowalarm,dooralarm,
garagealarm,firealarm,flag,alarm,light,heater,cooler,light_high,
light_low;
input motion_sen;input [7:0] temp_sen, lume_sen;wire [7:0]
temp_sen, lume_sen;
wire light,heater,cooler,light_high,light_low,clk;
output wire [2:0] garage_state,door_state,
window_state,fire_state;
wire
dooralarm,garagealarm,firealarm,windowalarm,flag,alarm,cloc
k,reset;
top_security T1 ( clock, reset,door,garage,window,fire, in,
clk,dooralarm,garagealarm,windowalarm,firealarm,window_st
ate,garage_state,door_state,fire_state,flag,alarm);
comfort C1
(clk,reset,motion_sen,temp_sen,lume_sen,light,heater,cooler,li
ght_high,light_low);
endmodule
Top_security:
module top_security( clock, reset,door,garage,window,fire, in,
clk,dooralarm,garagealarm,windowalarm,firealarm,window_st
ate,garage_state,door_state,fire_state,flag,alarm);
input [7:0]in;wire [7:0]in;input clock, reset,clk,door,garage,
window, fire;
output windowalarm,dooralarm,
garagealarm,firealarm,flag,alarm;output wire [2:0]
garage_state,door_state,window_state,fire_state;
wire
dooralarm,garagealarm,firealarm,windowalarm,flag,alarm,clk;
password ppa
(.clock(clock),.reset(reset),.in(in),.flag(flag),.alarm(alarm));
security S1
(.flag(flag),.clock(clock),.reset(reset),.door(door),.window(win
dow),.garage(garage),.fire(fire),.window_state(window_state),.
windowalarm(windowalarm),.garage_state(garage_state),.gara
gealarm(garagealarm),.door_state(door_state),.dooralarm(door
alarm),.fire_state(fire_state),.firealarm(firealarm));
endmodule
Password_check:
module password(clock, reset, in,flag,alarm);
input [7:0]in; input clock, reset;output reg flag,alarm;reg
[7:0] arr[3:0];reg [7:0] arr1[3:0];
integer i;
initial begin flag=1'b0;end
initial begin
for(i=0; i<8; i=i+8)
begin arr[i]=i+8;end
temp_sen< 00001111
/ heater=1
temp_heat
light_dim
lum_sen>00001111/
l_low=1
temp_sen>00011110/
Cooler =1
light_brig
ht
temp_coo
l
lum_sen<00001010/
l_high=1
2nd International Conference on Recent Trends in Computer and Information Engineering (ICRTCIE'2013) Dec. 20-21, 2013 Bali (Indonesia)
endmodule
Fire
module fire(flag,clock, reset, fire, fire_state,
firealarm);
input clock, reset,flag, fire; output [2:0] fire_state;
output firealarm; wire firealarm;reg [2:0] fire_state;
assign firealarm = (fire_state == 1) ?(flag?0:1): 0; // if
burglary state, signal a burglary
always @(posedge clock)
fire_state <= fire ? 1 : 0; // go to burglary state if fire
is on
endmodule
Door
module door(flag,clock, reset,
door,door_state,dooralarm);
input flag,clock, reset, door; output [2:0] door_state;
output dooralarm;wire dooralarm;
reg [2:0] door_state;
assign dooralarm = (door_state == 1) ? (flag?0:1) : 0;
// if burglary state, signal a burglary
always @(posedge clock)
door_state <= door ? 1 : 0; // go to burglary state if
fire is on
endmodule
Window
module window(flag,clock, reset, window,
window_state, windowalarm);
input clock, reset,flag,window; output [2:0]
window_state;
output windowalarm; wire windowalarm;reg [2:0]
window_state;
assign windowalarm = (window_state == 1) ?
(flag?0:1): 0; // if burglary state, signal a burglary
always @(posedge clock)
window_state <= window ? 1 : 0; // go to burglary
state if window is on
endmodule
Garage
module garage(flag,clock, reset, garage, garage_state,
garagealarm);
input clock, reset,flag, garage; output [2:0]
garage_state;
output garagealarm; wire garagealarm;
reg [2:0] garage_state;
assign garagealarm = (garage_state == 1) ?
(flag?0:1): 0; // if burglary state, signal a burglary
always @(posedge clock)
garage_state <= garage ? 1 : 0; // go to burglary state
if garage is on
endmodule
Comfort
`define start 4'd0
`define temp_heat 4'd1
`define temp_cool 4'd2
`define light_bright 4'd3
`define light_dim 4'd4
module
38
2nd International Conference on Recent Trends in Computer and Information Engineering (ICRTCIE'2013) Dec. 20-21, 2013 Bali (Indonesia)
comfort(clk,reset,motion_sen,temp_sen,lume_sen,ligh
t,heater,cooler,light_high,light_low);
input clk,reset,motion_sen;input [7:0]
temp_sen,lume_sen;
output reg heater,cooler,light_high,light_low,light;
reg [3:0] current_state;reg [3:0] next_state;wire clk;
initial begin
current_state=`start; next_state= `start;
heater='b0; cooler='b0;
light_high='b0; light_low='b0; light='b0;
end
always @(posedge clk)
current_state=next_state;
always @(current_state)
begin
case(current_state)
`start: begin
heater='b0; cooler='b0; light_high='b0;
light_low='b0;light='b0;
end
`temp_heat: begin if(motion_sen==1)
begin heater ='b1;
cooler=b0;light='b1;end
else
heater ='b0;end
`temp_cool:begin if(motion_sen==1)
begin cooler ='b1;heater
='b0;light='b1;end
else cooler ='b0;end
`light_bright:begin if(motion_sen==1)
begin light_high ='b1;
light_low='b0;light='b1;end
else light_high ='b0;end
`light_dim:begin if(motion_sen==1)
begin light_low ='b1; light_high='b0;end
else light_low ='b0; end
endcase
end
always
@(current_state,temp_sen,lume_sen,reset)
begin
if(reset=='b1)
next_state=`start;
else
case(current_state)
`start: begin
if(temp_sen> 'b00011110)
next_state=`temp_cool;
else if(temp_sen< 'b00001111)
next_state=`temp_heat;
else if(lume_sen > 'b00001111)
next_state=`light_dim;
else if (lume_sen < 'b00001010)
next_state=`light_bright;
end
`temp_cool: begin
if(temp_sen< 'b00001111)
next_state=`temp_heat;
2nd International Conference on Recent Trends in Computer and Information Engineering (ICRTCIE'2013) Dec. 20-21, 2013 Bali (Indonesia)
V. CONCLUSION
Verilog allows use of RTL description that provides
designer advantages while debugging, as the RTL description
can be readily edited by the designer and implemented again
with small cost of time [9].
The wave form is obtained as desired. Therefore we can
conclude that the project was successfully done and is ready
for implementation.
ACKNOWLEDGMENT
The work offered in this paper was carried out at the
Department of EECS at North South University, Dhaka,
Bangladesh. The thesis is regarded as a part of obtaining B.S.
Degree in Electrical and Electronic Engineering at the
University.
First of all, we acknowledge the praise to the Almighty
Allah, Who gave strength and permitted us to accomplish the
work. We would like to thank our respective faculty advisor
Mr. IqbalurRahmanRokon for his essential guidance, precious
advice. We would also like to express our gratitude to Syed
Iqbal Javed for his endless support during the growth of this
thesis work. Finally, we would like to show our appreciation to
our family and beloved parents for their inestimable support
during these years of our study.
REFERENCES
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
40