Wireless Home Automation

heavyweightuttermostMechanics

Nov 5, 2013 (3 years and 11 months ago)

60 views

Wireless Home
Automation

Douglas Brown

Eric Livergood

Chris Lotysz

Objective


The short term goal of this project was to use a
computer to turn on and off a light, as well as
monitor a door, via wireless communication


The real objective was to create a basic
framework for a home monitoring system. New
devices can easily be added to the system. Only
new hardware for different sensors/controllers
would need to be designed.

Original Design


Base module that communicates to the
computer via serial connection, as well as with
all the external devices


Light control device that reports light status, can
turn a 120 VAC light on and off, as well as to a
dim setting


Door monitor reports open/closed status of the
door


User interface controls the system and gives the
commands/requests to the rest of the system

Original Design


Communication


2.4 GHz Wireless Transceivers (Nordic 24E1)


Basic ACK/NACK Protocol


Frequency Hopping

Original Design

Base and Device General Layout

User Interface


Multithreaded Java Swing GUI


Easy
-
to
-
use


changes can be made with
a single click


Real time updates of wireless devices
statuses as they are collected


Easily expandable code to include future
devices and controls

Control Loop


Device Communication Thread


Check Event Queue for new actions to
perform


Perform actions, as needed


Gather all Light Statuses


Gather all Door Statuses


Serial Communication


To perform any action or request, the
program sends 2 bytes


Byte 1: Address of device


Byte 2: Command/Request


Wait for confirmation from base station


Response will always be 1 byte containing the
status of the device request/command was
made to

Interrupts


Serial Port Interrupt:


When data is sent, a flag is set to true to tell
control loop to begin waiting for response


When data is available on the serial port, a
flag is set to tell control loop to read response


Event Interrupt:


When the user clicks an action, an interrupt
occurs and the user’s action is added to the
event queue

Timeouts


Timeouts are coded into two places in the
system


The base station reports a timeout back to the
computer if it does not hear back within 200 ms from
the device it is communicating with


The control loop will report a timeout if it does not
hear from the base station within 1500 ms


Prevents timeouts from creating major delays in the
system response

Wireless Communication


Base serves as a dummy module to PC


Underlying communication protocol
transparent to PC


Device modules transmit only when
directed to


Wireless Communication

PC to Device

Command

Success+Status OR Fail

Wireless Communication

Device to Device: Instruction

Wireless Communication

Device to Device: Request For Data

Wireless Communication


Instructions:


Light ON: 0x00


Light OFF: 0x01


Get Light Status: 0x02


Get Door Status: 0x10


Dim Light: 0x4X (X indicates the level of dim)



Wireless Communication

packet.address = GetChar();

packet.operation = GetChar();


switch(packet.operation)

{


case NEW_INSTRUCTION:



//Any calculations or base operations



SendInstruction(packet);




case NEW_GET_STATUS:



//Any calculations or base operations




status = SendRequestForData(packet);

}

PutChar(status);

System Response


Steps taken to decrease response time:


Increased resolution of checking for data
availability


Decreased the number of bytes sent between
the devices


Only refreshed user interface screen when
changes have been made


Created separate thread to handle serial
communication


Hardware


Objectives: Wireless communication,
microcontroller, reliable power supply,
interrupter sensor, digital switch control of
120VAC


nRF24E1 programmer board was chosen
to simplify the blending of wireless
communication with microcontrol

Hardware Con’t


Battery power supply and wall delivered
power supply both necessary.


Battery power for remote, sensor based
modules (door)


Wall power for base station and for
modules with available wall power (light)

Base Station


Power Supply and Transceiver


Wall delivered power instead of 9v


Serial communication from transceiver
board to PC

Light Module


Digital Control of Light with multiple dimming
options


Light Module Con’t


The relay chosen determines the resistive
path taken and thus the voltage delivered
to the gate of the Triac.


The Triac turns on allowing current to flow
to the light bulb when the gate voltage is
sufficiently high.


The relays are DC controlled via I/O pins
from the transceiver board.

Door Sensor Module


Uses a photo interrupter to determine the door’s
status then transmits its status via the
transceiver board


Door Module Con’t


9V battery supplied power.


Sensor used the 3V regulated power and
the straight 9V battery power.


When door is closed power consumption
is minimal, however when the door is open
the sensor dissipates much more power

Power Analysis


Door


Transceiver sinks 18mA at 3V or 54mW




Always putting out 24Vs on the relays(or120V)



Off(24VAC On(120VAC)




Relay1: 13.4K

3.0mA

42.3 mW

1.0746 W


Relay2: 13K

3.1mA

44.3 mW

1.1077 W


Relay 3: 12.4K

3.2mA

46.4 mW

1.1613 W



Only one relay on at a time


Additional power loss in the triac itself. Heat created and leaked
through a heat sink



Base


Transceiver only ~ 54mW wall delivered

Power Analysis Con’t


Door


9v Alkaline Battery supplied power


600 mAh per 9v ~ 5400mWh


3v regulated and 9v unregulated (Vcc)


Transciever ~54mW


Sensor:

Diode ~40.5mW Open ~ +40.5mW


Life when door is open: 40hrs


Hardware Testing



The dimming resistances were
determined experimentally by controlling a
triac with a potentiometer


Power circuits were constructed and
tested with a voltage meter. No testing for
consistency was conducted, but repeated
checking of voltage showed the voltage
regulator to be reliable

Testing & Development for PIC



7 Phases

1.
Serial Communication

2.
Timer Setup

3.
Simple Wireless Communication

4.
Complex Wireless Communication

5.
Integration of Serial + Wireless

6.
Protocol Implementation

7.
Testing with PC

Software Testing


Created a PIC Simulation


Two computers, one with user interface, the
other with PIC Simulation


Output to console each step


Output the data being sent, the data received,
how the data was interpreted


Ran program with one or all devices off to
ensure timeouts would be handled
appropriately

Successes


Communication interference less than
expected, frequency hopping unnecessary


A very open
-
ended, easy to use
framework developed for expansion of
project


Challenges


Range


Security


Power consumption


Cost

Ethical Considerations


Introduction of another potential
surveillance system


Potential for unwanted outsider control


Creating a safe system

Acknowledgements

Nordic Semiconductor

Microchip

Professor Scott Carney

Ishaan Gupta

Tim O’Connell

Sparkfun