taylor santiago - ece 561 - smart home controller

14
Smart Home Controller Taylor Santiago Taylor Santiago ECE 561 HTC 8x Photo Credit: Amazon.com Raspberry Pi Photo Credit: Wikipedia.org TCP Operation Photo Credit: Cisco.com

Upload: tsant928

Post on 08-Jul-2015

221 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Taylor Santiago - ECE 561 - Smart Home Controller

Smart Home ControllerTaylor Santiago

Taylor Santiago ECE 561

HTC 8xPhoto Credit: Amazon.comRaspberry Pi

Photo Credit: Wikipedia.org

TCP OperationPhoto Credit: Cisco.com

Page 2: Taylor Santiago - ECE 561 - Smart Home Controller

Physical Setup

Taylor Santiago ECE 561

This project required the following physical items:

• Raspberry Pi• SD Card to boot Debian Unix• HTC 8x (Windows Phone OS)• Bluetooth Dongle• USB Mouse and Keyboard• AC Powered USB Hub• Breadboard, LEDs, Resistors, and Misc. Wiring• HDMI Compatible Monitor• Ethernet Cable

Page 3: Taylor Santiago - ECE 561 - Smart Home Controller

Bluetooth Handler

Taylor Santiago ECE 561

• The Raspberry Pi is setup as a Bluetooth server• Python script constantly receives messages from the client, the smartphone• Incoming messages are parsed and are then handled by either driving GPIO pins or replying

to the client with metrics

Page 4: Taylor Santiago - ECE 561 - Smart Home Controller

TCP Socket Handler

Taylor Santiago ECE 561

• Raspberry Pi is setup as a client connected to my personal website• The Pi polls the website every second to see if it’s accepting connections• Incoming messages from the server are accepted and handled in a similar manner to the

Bluetooth handler

Page 5: Taylor Santiago - ECE 561 - Smart Home Controller

Metrics Handling

Taylor Santiago ECE 561

• Metrics are collected by threaded functi0ns that monitor the Raspberry Pi pin values• When the monitors witness a change on the pin (light toggled), the light status and usage

time metrics are updated• Light metrics are kept in a python dictionary, with values such as

‘status’, ‘time_off’, ‘time_on’, and ‘total_time’ being tracked

Page 6: Taylor Santiago - ECE 561 - Smart Home Controller

Website Support

Taylor Santiago ECE 561

• The website is written in PHP – http://tws928.com/smarthome.php• Once the website is accessed in a browser, it begins listening for connections• Radio buttons are presented to the user to choose accepted commands to send to the

Raspberry Pi• Information on the lights status and percentage of time used is presented to the user

Page 7: Taylor Santiago - ECE 561 - Smart Home Controller

Windows Phone Application

Taylor Santiago ECE 561

• The windows phone application is written in C# using Visual Studio• The application is leveraged from a Bluetooth template provided by Microsoft• I added the handling of user interactions and encoding and decoding outgoing and incoming

messages, respectively

Page 8: Taylor Santiago - ECE 561 - Smart Home Controller

Project Learnings

Taylor Santiago ECE 561

• Raspberry Pi setup and usage• The importance of handling exceptions – when dealing with socket connecti0ns from

multiple sources, it’s crucial to not let communication errors crash your application• PHP and Bluetooth socket programming• Windows phone programming• Python Threading

Page 9: Taylor Santiago - ECE 561 - Smart Home Controller

Possible Project Extensions

Taylor Santiago ECE 561

• Password encryption• Multiple user support with parental controls• It may be worth investing in a different embedded system, or at least a better USB powered

hub. Bluetooth flakiness was an issue• Add semaphore support – lots of shared resources

Page 10: Taylor Santiago - ECE 561 - Smart Home Controller

Video

Taylor Santiago ECE 561

http://www.youtube.com/watch?v=Ik2gXzdcTewhttp://www.youtube.com/watch?v=ALd-DvJ9pBM

To view these without opening your browser, open this in Slide Show mode

Page 11: Taylor Santiago - ECE 561 - Smart Home Controller

Physical Setup Pictures

Taylor Santiago ECE 561

Raspberry Pi Breadboard connections

Page 12: Taylor Santiago - ECE 561 - Smart Home Controller

Physical Setup Pictures

Taylor Santiago ECE 561

Raspberry Pi, breadboard, and USB Hub Cardboard house with four rooms

Page 13: Taylor Santiago - ECE 561 - Smart Home Controller

Smartphone Application Pictures

Taylor Santiago ECE 561

Start Screen After tapping find paired devices After connecting After hitting ‘View Control Options’

Page 14: Taylor Santiago - ECE 561 - Smart Home Controller

Taylor Santiago ECE 561

Smartphone Application Pictures

User interface for lights control Metrics screen