You are on page 1of 17

FPGA based

Home Automation
System using Bluetooth



Join the Technical Community Today!
http://www.pantechsolutions.net



Contents at a Glance

ABSTRACT ....................................................................... 3
BLOCK DIAGRAM ............................................................. 4
Home Section .............................................................................................. 4
Mobile Section ............................................................................................ 4
Introduction .................................................................... 5
Bluetooth home automation mobile software ................. 7
Hardware design and development ................................. 7
Tool required: .................................................................. 8
Source Code .................................................................... 8
Conclusion ..................................................................... 15







Join the Technical Community Today!
http://www.pantechsolutions.net


ABSTRACT

Technology advancements have made possible the
implementation of embedded systems within home appliances.
This has added new capabilities and features, however, most of
the time, the implementations are proprietary and networking is
not always possible. Yet there is an increasing demand for smart
homes, where appliances react automatically to changing
environmental conditions and can be easily controlled through
one common device. This paper presents a possible solution
whereby the user controls devices by employing a central Field
Programmable Gate Array (FPGA) controller to which the devices
and sensors are interfaced. Control is communicated to the FPGA
from a mobile phone through its Bluetooth interface. This results
in a simple, cost effective, and flexible system, making it a good
candidate for future smart home solutions.



Join the Technical Community Today!
http://www.pantechsolutions.net


BLOCK DIAGRAM
Home Section


.








Mobile Section



Android
Mobile Device
Bluetooth
Interface
RS232
UART
Spartan3an
FPGA
5v Relay Stepper Motor
Door Lock
open/close
Fan
light
AC
Heater


Join the Technical Community Today!
http://www.pantechsolutions.net


Introduction

The Bluetooth wireless technology is set to revolutionize the
way people perceive digital devices in our homes and ofce
environment. Now they are no longer just the individual devices;
instead, with the embedded Bluetooth technology, they form a
network in which appliances can communicate with each other.
This wireless technology is especially useful in home environment,
where there exists hardly any infrastructure to interconnect
intelligent appliances. It could be suitably used for home
automation in a cost-effective manner. Operating over
unlicensed, universally available frequency of 2.4 GHz, it can link
digital devices within a range of 10 m (expandable to 100 m, by
increasing the transmitted power) at the speed of 1 Mbps.
Building upon this theme; we propose a home automation system
based on Bluetooth technology. There are certain issues involved
in the design of a home automation system. The system should be

scalable, so that new device can easily be integrated into it. It should
provide a user-friendly interface on the host side, so that the devices can
be setup, monitored and controlled. The interface should also provide
some diagnostic services so those problems with the system, if any, can


Join the Technical Community Today!
http://www.pantechsolutions.net


be tracked down. The overall system should be fast enough to
realize the true power of wireless technology. It should also be
cost effective in order to justify its application in home
automation.
The system developed consists of android mobile phone and
a FPGA based Door Lock open/close system and relay on/off to
control electrical Appliance, that is able to communicate with the
host through the Bluetooth link.


Host and client modules in Bluetooth piconet



Join the Technical Community Today!
http://www.pantechsolutions.net


Bluetooth home automation mobile software

The Bluetooth home automation mobile software module
provides two main services to the users, namely:
1. Device Registration
2. Device Control
Hardware design and development

A Door Lock open/close system and relay on/off to control
electrical Appliance circuitry has been developed to demonstrate
the feasibility and effectiveness of the application. The hardware
interface component of the Bluetooth based home automation
system consists of a FPGA with stepper motor, relay interface and
an RS232 link between the FPGA and the Bluetooth.





Join the Technical Community Today!
http://www.pantechsolutions.net



Tool required:

Software: Xilinx ISE 10.1i or above
Language: VHDL
Hardware: 1.Spartan3an FPGA kit
2.Bluetooth Module
3.JTAG Cable
4.Serial Cable
5.Stepper Motor
6.Relay

Source Code

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;


Join the Technical Community Today!
http://www.pantechsolutions.net


entity uart_stepper is
port ( clk : in std_logic;
din : in std_logic;
relay : out std_logic:='0';
count : out STD_LOGIC_vector(3 downto 0)
);

end uart_stepper;

architecture Behavioral of uart_stepper is

type state is (ready,b0);
signal ps : state := ready;
signal start,stop : std_logic;
signal store : std_logic_vector(7 downto 0) := "10101010";

type state1 is (a0,a1);
signal ps1,ps2 : state1 := a0;
signal s_count:std_logic_vector(3 downto 0);

begin
process(clk)
variable i : integer := 0 ;



Join the Technical Community Today!
http://www.pantechsolutions.net


begin
if clk'event and clk = '1' then
if ps = ready then
start <= din;
end if;
if start = '0' then
ps <= b0;
elsif start = '1' then
ps <= ready;
end if;
------------------------------------------1
if ps = b0 then
i := i + 1;
if i = 2600 then
start <= din;
end if;
if i = 7800 then
store(0) <= din;
end if;
if i = 13000 then
store(1) <= din;
end if;
if i = 18200 then
store(2) <= din;


Join the Technical Community Today!
http://www.pantechsolutions.net


end if;
if i = 23400 then
store(3) <= din;
end if;
if i = 28600 then
store(4) <= din;
end if;
if i = 33800 then
store(5) <= din;
end if;
if i = 39000 then
store(6) <= din;
end if;
if i = 44200 then
store(7) <= din;
end if;
if i = 49400 then
stop <= din;
end if;
if i = 54600 then
i := 0 ;
ps <= ready ;
end if;
end if;


Join the Technical Community Today!
http://www.pantechsolutions.net


end if;
end process;

process(clk,store)
variable j,k,l,m:integer:=0;
begin
if clk'event and clk = '1' then
if store = x"33" then

if(ps1=a0)then
j:=j+1;

if(j=500000)then
s_count<="1000";
end if;

if(j=1000000)then
s_count<="0100";
end if;

if(j=1500000)then
s_count<="0010";
end if;



Join the Technical Community Today!
http://www.pantechsolutions.net


if(j=2000000)then
s_count<="0001";
j:=0;
if k<24 then
k:=k+1;
ps1 <= a0;
elsif k=24 then
k:=0;
ps1 <= a1;
end if;
end if;
end if;

elsif store = x"34" then
if(ps2=a0)then
l:=l+1;

if(l=500000)then
s_count<="0001";
end if;

if(l=1000000)then
s_count<="0010";
end if;


Join the Technical Community Today!
http://www.pantechsolutions.net


if(l=1500000)then
s_count<="0100";
end if;

if(l=2000000)then
s_count<="1000";
l:=0;
if m<24 then
m:=m+1;
ps2 <= a0;
elsif m=24 then
m:=0;
ps2 <= a1;
end if;
end if;
end if;


elsif store = x"31" then
relay <='1';
ps1 <= a0;
ps2 <= a0;
elsif store = x"32" then
relay <='0';


Join the Technical Community Today!
http://www.pantechsolutions.net


ps1 <= a0;
ps2 <= a0;
else
ps1 <= a0;
ps2 <= a0;

end if;

end if;
end process;
count<=s_count;

end Behavioral;

Conclusion

Home Automation is undeniably a resource which can make a
home environment automated. People can control their electrical
devices via these Home Automation devices and set up the
controlling actions in the mobile. We think this product have high
potential for marketing in the future.


Join the Technical Community Today!
http://www.pantechsolutions.net






Pantech solutions creates information packed technical
documents like this one every month. And our website is a rich
and trusted resource used by a vibrant online community of
more than 1,00,000 members from organization of all shapes
and sizes.









Did you enjoy the read?


Join the Technical Community Today!
http://www.pantechsolutions.net


What do we sell?
Our products range from Various Microprocessor
development boards, DSP Boards, FPGA/CPLD boards,
Communication Kits, Power electronics, Basic electronics,
Robotics, Sensors, Electronic components and much more . Our
goal is to make finding the parts and information you need
easier and affordable so you can create awesome projects and
training from Basic to Cutting edge technology.