Project Documentation
Project Documentation
APPENDIX
(A) REFERENCES
(B) CODE
HOME AUTOMATION USING VERILOG
1.1 INTRODUCTION
In the present time with the increasing technology everyone wants their home
to be a smart home. Not only smart a home must also be secured due to the increase in of
robberies and thefts in our society. There are many more problems existing in the home which
can be resolved by the growing technology very easily. Many of us while going to jobs leave
our elder family members alone. They are very frequently attacked by health problems like
heart attacks which demands them to admit them in a nearby hospital as soon as possible.
We may not when they need our help. To know their present condition we need to monitor
them almost once in every hour which is almost impossible in our daily hectic life schedule.
Installing a monitoring system for our house not only costs more but also we might be
encountered with situations when we would be very busy and may not be able to answer the
notifications given by the monitoring system. So, it is better the home automation system
installed does this job for us as this is also one of the biggest problem which we are going to
face in the future. It should develop a mechanism to provide help during the emergency
situations and then concentrate on the comfort which most of the home automation models
present in the society do not do. They mostly give priority to the comfort rather than security
and help during emergency situations and make other day to day tasks easier. The other
biggest problem which we are facing is the water scarcity in most of the parts of our country
and in near future we might be facing a situation where we won’t have water to drink. In that
situations we have to avoid the wastage of water by preventing the overhead tank overflows.
In many of the houses we observe the overflow of overhead tanks because of not switching
off the power supply to the motor in time. And we might have also forgot to switch on the
motor to the overhead water tank and realise lately that it is empty. These are some of the
most important problems in our home which seems to be very simple but causes a lot of
and make it not only the smart but also the peaceful as well as environment friendly by
preventing the wastage. It should meet our day to day requirements so it is better equipped
with as many facilities as possible to really make it smart from the others. It takes data from
the various sensors like temperature sensor, luminous intensity sensor, fire sensor, motion
sensor and takes necessary actions according to the inputs which it gets. It also gives the
corresponding outputs to control the happening of various action inside the house.
This home automation system controls many inputs at home such as lights
and coolers. The comfort system of this project is limited to the control of just light and cooler.
It ensures the security of home by a password to enter the home by a password to enter the
home and to disarm the security system when the person is not at home and to disarm the
security system when the person is not at home the security system is armed. When the
Security system is disarmed when person enters the home and stays inside. It also provides
help during the emergency situations for the people inside by sending information to the
hospital and the concerned people. And it also prevents the overflow and empty of the
overhead water tank by switching on and off the power supply to the motor which supplies
1.2 LITERATURE
Home automation began with the labour saving machines like washing
machine and vacuum cleaner. All these machines discovered to do their job efficiently and
decrease the human effort. Most of the commercially available home automation systems
requires all the controllable appliances from the same company or which supports that
company type. These devices come with a dedicated controlled device which need to be
purchased separately. These complex systems need to be integrated during the construction
of the building and also it is very difficult to upgrade them once installed. It costs very high
and need a separate specialised system to operate all the home appliances. But in later time
home automation system controlled by a wifi or a bluetooth mobile device were introduced
into the market. This reduces the cost of operation from the previous system and also makes
easy to operate. The first ever home automation introduced was a Bluetooth based one in
2001. It uses wireless technology. It also has many disadvantages like slower response,
complex design and large hardware. And it is replaced by a microcontroller based design in
2002 because it works with high speed. Its disadvantages are large programming and having
multiple integrated circuits. Then an automation model was introduced in 2007 which uses
wireless communication and provides easy accessibility which is called as network monitoring
and has disadvantage of hacking and it does not have large features. In 2011 a high feature
FPGA system was introduces which has programmable gates and high speed response with
secured features. It has disadvantage because memory can be easily erases and
reprogrammable, design specific, it costs very high and much memory is required. With the
rapid speed in increasing technology day by day new technology based systems are coming
into the market and replacing the old ones. By the next year high featured FPGA is replaced
by Advanced automation FPGA which provides access to many features, high speed, multiple
appliances has large applications in vast fields. It even has the disadvantages like high cost,
design specific and it uses volatile SRAM type of memory. The home automation system
implemented in hardware using Field Programmable Gate Array uses sensors for controlling
home appliances. This system uses wireless technology to improve the standards of the living
of the people.
2.1 MODULES
This project has various modules for various tasks to be done and are
This module is the top module in the project which takes all the external inputs
from the user and the sensors and provide intermediate outputs or inputs to the submodules
and provides the outputs to the external world. The user password which is input from the
user is passed to the password module. And the functioning of both the emergency and
comfort modules is done only when they are high which is externally given by the user and is
sent to the respective modules. It also constantly receives input from the fire sensor which is
placed everywhere in the home except in the kitchen which warn us about the short circuit
situations occurs in the home. This is the only module which has the connection from the
external world.
PASSWORD MODULE
It is the one which takes input from the home automation module and is the
only way through which user can enter his home by entering the user password. Only if the
user enters the correct password he can go inside the home otherwise he cannot enter. If the
entered password goes wrong alarm system will be activated. If the person is leaving the
home reset input goes high and the security system of the home is activated. When the
WATERTANK MODULE
Water tank module receives the input from the sonar sensor which is attached
to the top of the overhead water tank. The sonar sensor is used to detect an obstacle at
particular minimum and maximum amount of distance. It sends high input to the motor
switch which supplies power to the motor which supplies water to overhead water tank when
the obstacle is detected at maximum defined distance which means when the tank goes
empty. It makes the power supply to the motor switch low when the obstacle is detected at
minimum predefined distance which means when the tank becomes full. Thus, it prevents the
overflow of overhead water tank and prevents the wastage of water. For this system to work
properly sonar sensor must be attached properly to the overhead water tank.
COMFORT MODULE
It controls the light and cooler in the home. It has one external input comfort
which when goes high cooler will be even when the temperature is more than 33 degrees
even when no motion is detected by the motion sensor. Inputs to this module is taken from
the motion sensor, temperature sensor and luminous intensity sensor. When the motion in
the room is detected by the motion sensor the light is turned on if the luminous intensity
detected in the room is less than 13 lumens. And the cooler is turned on when the
whatever might these sensors sense no external input to the cooler and light is given unless
EMERGENCY MODULE
An external input emergency is given to this module by the user. It is given high
when there is no one to take care of the elder people present at the home. This module sends
a output to gsm module which activates a protocol and sends a call to the concerned family
member and the hospital ambulance when there is no motion detected in the house in the
predefined amount of time. It shows that there might be a chance that the elder people might
have got a health issue. It also activates an alarm until any motion is detected which means
elder person might get help from the people living in the neighbourhood that is why alarm is
activated until any motion is detected indirectly until any person comes for help.
SECURITY MODULE
It is the backbone for all the security system that is being installed in the home.
It has various submodules which controls the state of window, door as per the input getting
from the window and door sensors. As per the inputs from window and door sensor the state
of window and door is being given as the output. When the security system of the home goes
high and if any of the window or door are left open alarm for the respective part is activated.
If motion is detected in the home when security module is high alarm will be activated as
security module goes high only when no one is present in the home.
DOOR MODULE
Door module receives the security input from the security module. It also
receives input from the magnetic sensor attached to the door which tells us the state of the
door whether the door is opened or closed. The same output is displayed showing the state
of the door to the user in his device. When the input from the security module is high and any
of the door is opened the alarm is activated due to having a suspicion that a theft might have
WINDOW MODULE
Window module receives the security input from the security module. It also
receives input from the magnetic sensor attached to the window which tells us the state of
the window whether the window is opened or closed. The same output is displayed showing
the state of the window to the user in his device. When the input from the security module is
high and any of the window is opened the alarm is activated due to having a suspicion that a
FIRE MODULE
Fire module is the sub module in the home automation module. It constantly
receives the input from the fire sensor. If the fire sensor goes high there might be a chance
that the home catches fire in a short time. When it goes high alarm is activated. Otherwise
HOME AUTOMATION
LIGHT SWITCH
COOLER SWITCH
FIRE SENSOR
FIRE ALARM
2.3 BLOCK DIAGRAM
clk sec
in[3:0] door_state
temp[1:0] door_alarm
lum[1:0] window_state
motion_sensor window_alarm
fire_sensor alarm
HOME AUTOMATION
door_sensor alarmm
window_sensor motion_alarm
comfort motor_switch
emergency gsm
sonar_sensor light
reset cooler
fire_alarm
clk :
The clock pulse is also given as the input to the system which changes from low to high for
It is the input given by the temperature sensor to the comfort system in terms of degrees.
lum[1:0] :
It is the input given by the luminous sensor to the comfort system in terms of lumen.
motion_sensor :
It Is a sensor which detects the motion in a room by sending electromagnetic waves and
fire_sensor :
door_sensor :
A magnetic sensor is attached to a door which tells us the state of the door whether opened
or closed.
window_sensor :
A magnetic sensor is attached to a window which tells us the state of the window whether
opened or closed.
comfort :
This input is high when people are sleeping in the house because at that time motion sensor
might not detect motion inside the home and cannot produce comfort to the people staying
inside the house. It switches on the cooler then the temperature inside the room raises
beyond 33 degrees.
emergency :
It is set high by the house owners when they are leaving elder people alone at the house.
sonar_sensor :
It is the sensor attached to the overhead water tank to know whether water tank became
empty or full.
reset : This input is set high by the user when he is leaving the house.
OUTPUTS
sec :
It is the output given by the password module to tell whether the security of the home should
be activated or not.
door_state :
This shows the state of the door whether opened or closed to the user.
door_alarm :
When the security system of the house is high and then if any of the door is opened door
alarm is activated.
window_state :
This shows the state of the window whether closed or opened to the user.
window_alarm :
When the security system of the house is high and then if the window is opened window
alarm is activated.
alarm :
This alarm is activated when the password entered by the user goes wrong.
alarmm :
This alarm is activated when motion is detected inside the house even after the security
module is working.
motion_alarm :
This alarm is activated when no motion is detected for a predefined amount of time in the
motor_switch : Power supply to motor switch is given when maximum distance is detected
by the sonar sensor.
gsm :
High input is send to this module when no motion is detected inside the house within
predefined amount of the time when the emergency input is set high by the user.
light :
Power supply is given to this switch when the luminous intensity sensor detects the
brightness less than 13 lumen.
cooler :
Power supply is given to this switch when the temperature inside the room is detected more
than 33 degrees.
fire_alarm :
This alarm is activated when smoke is detected by the smoke sensor.
A T
F
T F
B
COMFORT
F SEC ALARM
C
T
FIRE MODULE
F
F F
D E F
T
T T
FIRE ALARM
COOLER LIGHT
INITIAL STATE
F
G H
T
T
MOTOR
SWITCH F
I
MOTION
ALARM GSM
SECURITY
T
T
T K WINDO SEC
J DOOR
W STATE
STATE
F F T
or not. If person is not at home security of the system is made high. Otherwise the person
needs to enter the password to enter the house. If the password is correct he can enter the
house otherwise the security system of the home as well as alarm system is activated. When
the person enters home the comfort module of the home is activated as the motion is
detected. It checks whether the temperature is greater then a particular value or not if it is
greater the power supply to the cooler switch is given otherwise it again goes to the starting
of the comfort module. Same with the case of luminous intensity sensor if motion is detected
and intensity detected by the luminous intensity sensor is less than a particular lumens then
the power supply is given to the light switch otherwise it again goes to the starting of the
comfort module. Fire sensor is always activated when the person stays in the home or not if
the fire sensor goes high then the fire alarm is activated. Water tank module is also activated
whether a person stays in the house or not. If the sonar sensor goes high then the tank goes
empty and the power supply is given to the motor switch and when the minimum distance is
detected by the sensor it goes low and power supply is removed to the motor switch. When
the emergency input of the system goes high the sensor checks whether the motion is
detected in a particular time or not if not alarm is activated until motion is detected and signal
is sent to gsm module so that it can activate a protocol to call for ambulance. This module
When the security module is activated which happens when no one is at home or
the password entered by the user goes wrong. If the security system of the house is high it
checks whether the door and window of the house are open or closed. If they are opened
alarm system is activated and the state of the door is displayed to the user. If the security
system of the house is not high then no alarm is activated even if door and window is opened
or not. In this situation it just updates the state of the door to the user. If motion is detected
inside the house when the security system is high alarm is activated. In any one of the cases
ASM TABLE
0 1 X X X X X X X X X X 001 No output
001 X X 0 X X X X X X X X 001 No output
X X 1 0 0 X X X X X X 001 No output
X X 1 0 1 X X X X X X 001 Light
X X 1 1 0 X X X X X X 001 Fan
X X X X X X X 0 1 X X 100 No output
X X X X X X X 1 0 X X 100 No output
X X 1 X X X X X X X X 101 Alarmm
110 X X X X X X X X X 0 X 110 Door state
x=1
y=1
z=(~A) & B
OUTPUT
8:1 MUX2 D FLIP FLOP MODULE
CLK
8:1 MUX3
D FLIP FLOP
CLK
INPUTS TO THE MULTIPLEXER 1 ARE:
0,0,0,0,1,1,1,1
INPUTS TO THE MULTIPLEXER 2 ARE:
0,0,1,1,0,0,1,1
INPUTS TO THE MULTIPLEXER 3 ARE:
(~A)&B , 1,0,1,0,1,0,1
8:1 multiplexer is used because there are three flip flops and the inputs to the
select lines of the flip flops are X,Y,Z. The inputs to flip flop 1, flip flop 2, flip flop 3 are x, y, z
respectively. Same clock signal is fed to all the flip flops simultaneously. As we are
implementing the project using multiplexer based design implementation the outputs of
flipflops are being fed to a 3:8 decoder to get the external outputs of this project.
OUTPUT MODULE:
3:8 DECODER
OUTPUTS FROM THE DECODER ARE:
Sec, No output, No output, No output, No output, No output, Door, Window
The remaining outputs are obtained by the gate operations with the
external inputs. Here inputs directly depend upon the external inputs so the implementation
is by mealy state machine.
The expressions for the remaining outputs are:
alarm= (first output from decoder) & B
light= (second output from decoder) & E
cooler= (second output from decoder) & D
light & cooler= (second output from decoder) & D & E
fire alarm= (third output from decoder) & F
motor switch= (fourth output from decoder) & G
motion alarm= (fifth output from decoder) & H & I
alarmm= (sixth output from decoder) & C
door state & door alarm= (seventh output from decoder) & J
window state & window alarm= (eighth output from decoder) & K
2.6 RTL SCHEMATIC
RTL stands for Register Transfer Level. It is nothing but a design abstraction
which models the synchronous digital circuit in terms of the flow of the digital signals between
hardware registers and logic operations performed on those signals. Register Transfer Level
is used in hardware description languages like Verilog and VHDL to create high-level
wiring can be derived. RTL Schematic of any project shows all the inputs and outputs included
pass simulation is typically performed to verify RTL code and to confirm whether the circuit
which we designed by writing code in behvioral level is functioning as intended or not. A test
bench must be written to perform the simulation of a particular project file. Test bench is
nothing but the sample test cases written manually by the design developer to check whether
we are getting the desired output for the given inputs or not.
The below shows the simulation results of the project home automation using
Verilog. It shows the outputs for the corresponding inputs up to particular clock pulse of time.
3.1 CONCLUSION
The goal of this project to create a controller for all home appliances at cheaper
cost is achieved which provides an automated home security. This is a low cost effective
device and with few more changes it can be made a little more advance making it web
enabled. This method is very easy to adapt and implement and can be easily embedded into
another device. The hardware description language Verilog used to implement the code part
has really helped since it not only combines software and hardware part, it also provides
informative graphs and waveforms which are helpful in understanding the real concept of the
project. The waveforms obtained after simulation are as expected hence we can say that the
can be converted into high level language and can written on a chip creating a physical device.
This can be embedded into a phone or laptop so that it will be easy to operate. And this
implementation can be taken up to gate level so that we can optimise the speed as well as
the power consumption of the device. By taking up to gate level the circuit design of the
project can be optimised. And even this project can be improvised further by adding more
endmodule
);
reg [3:0]arr;
integer i;
initial begin
arr<=4'd12;
alarm=1'b0;
sec=1'b0;
end
always @(posedge clk)
begin
if(reset)
begin
alarm=1'b0;
sec=1'b1;
end
else if(arr==in)
begin
alarm=1'b0;
sec=1'b0;
end
else
begin
alarm=1'b1;
sec=1'b1;
end
end
endmodule
initial begin
alarmm=1'b0;
end
fire a(fire_sensor,clk,fire_alarm);
window b(window_sensor,clk,sec,window_state,window_alarm);
door c(door_sensor,clk,sec,door_state,door_alarm);
always @(posedge clk)
begin
if(sec)
begin
if(motion_sensor)
begin
alarmm=1'b1;
end
else
begin
alarmm=1'b0;
end
end
else
begin
alarmm=1'b0;
end
end
endmodule