Taylor Santiago - ECE 561 - Smart Home Controller
-
Upload
tsant928 -
Category
Technology
-
view
221 -
download
0
Transcript of Taylor Santiago - ECE 561 - Smart Home Controller
![Page 1: Taylor Santiago - ECE 561 - Smart Home Controller](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/1.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/2.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/3.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/4.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/5.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/6.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/7.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/8.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/9.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/10.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/11.jpg)
Physical Setup Pictures
Taylor Santiago ECE 561
Raspberry Pi Breadboard connections
![Page 12: Taylor Santiago - ECE 561 - Smart Home Controller](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/12.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/13.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042817/559cf66f1a28ab75438b47b9/html5/thumbnails/14.jpg)
Taylor Santiago ECE 561
Smartphone Application Pictures
User interface for lights control Metrics screen