Created iot page on Website
Linked my GitHub iot Repo:
$ git clone https://github.com/jgazzara1/iot
Noted that I have already completed all iot Labs in Engineering Design VI found here
This means I will most likely be doing a lot of personal exploring for this class, I am currently taking an interest in smart home systems
I also plan on overlapping a lot of my learning with my Senior Design Project found here, because my project contains a Raspberry Pi
Ordered this Raspberry Pi for experimentation between this class and my Senior Design project: ARGOS
Needed a new Pi because I currently am using my old one from Senior Design VI for smart home purposes, I will elaborate on this later
Currently, I am experimenting with using the Pi to host a local video stream for the Mirage VR 180 Camera using the Egarim software for Senior Design
I got the two devices to successfully connect using this software
No class due to Presidents day
I tried to go on a ski trip, but the power was out on the mountain!
This week I have been exploring ways to send yaw/pitch/roll data from a VR headset to a Raspberry Pi over the internet for my Senior design project
Currently, my main prospect is the OpenVR OSC software found here, with the ability to:
Read an open VR protocol
Host a local server with various gyroscopic data
My biggest set back this week is I need to learn how to open game development software, to allow Python to read the data
I am actively exploring these options
Once the data has been sent to the Raspberry Pi in my project, the Raspberry Pi will then send the data through a USB cable to an Arduino
Currently, I am exploring Python scripts that allow the two devices to communicate
I successfully managed to make the Arduino read 1 bit serial over USB, however any more data requires encoding
This encoding will be necessary as I need to send 2 floating variables (VR headset yaw and pitch) over the USB connection
Still working on USB communication between Raspberry Pi and Arduino
Still working on getting a PC to send yaw/pitch/roll from a VR headset to the Raspberry Pi
Didn't get to make much progress on IOT software this week because I had my Senior Design Alpha prototype this week, see the GIF of the Alpha operating!
Considering options for contributions/final project
If I make significant progress, I am considering using Senior Design project software for my final project here, this allows me to focus my efforts to make the software optimal
Now that motor systems are working for Senior Design I am shifting my focus to getting gyroscopic data from a VR headset
Right now I am attempting several ideas:
LabView Oculus Kit
OpenVR python libraries
Checking assorted available software on GitHub
I am also trying to find a professor at Stevens that can provide advice on how to pull this gyroscope data
Decided to give up on using the VR headset's gyroscope and to utilize an external gyroscope instead
Had a meeting with Professor Lu to determine the optimal way to send Gyroscope data from Arduino to Arduino through the internet, he suggested Mosquito and MQTT
I conducted some research on how I could utilize these frameworks without an Arduino ethernet shield and came across ARDULink
I had several issues getting this Java software to operate on my Mac, one of them being that I cannot write Arduino code separately, I need to be able to use Arduino and PC software simultaneously
Had a breakthrough when I came across this simple Python script for TCP Streaming
I will establish the client next week
# Streaming Server
import socket
import time
import serial
HOST = '192.168.1.44'
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
while True:
conn, addr = s.accept()
print 'Client connection accepted ', addr
while True:
try:
arduino = serial.Serial('/dev/cu.usbmodem14101', 115200, timeout=.1)
while True:
data = arduino.readline()[:-2] #the last bit gets rid of the new-line chars
print 'Server sent:', data
conn.send(data)
time.sleep(1)
except socket.error, msg:
print 'Client connection closed', addr
break
conn.close()
Focused on improving the Python receiving client, shown below
# Streaming Client
import socket
HOST = '192.168.1.44'
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
while True:
data = s.recv(1024)
print (repr(data))
s.close()
Now that the server and client can send and receive information respectively, it will be much easier to focus on full Arduino implementation
I plan to combine this script with Python's Pyserial Library
Successfully created a system that detected the Gyroscope values, sends them through the internet using Python and prints them on a separate PC, see an example below
The final step to get this functioning is using Pyserial to write to an Arduino, I will work on this next week
I have been so focused on Senior Design that I have still not selected a final project for this class
I will be doing a Homebridge Implementation in my own house as an IOT Final Project
Info on Homebridge can be found here
This system is a smart home unification interface using a Raspberry Pi
Took a quick vacation
Completed the Beta for my Senior Design Project
Needed to test how many programs I can run simultaneously to see if Pi can handle the load
Working on checking thr temperature for my Raspberry Pi using the tutorial here
Improved software for Senior Design project
Incorporated Client/Server with Pyserial to read Arduino Serial
Data flows: Arduino Server -> Python Server ---->Internet----> Python Client -> Arduino Client
See full code on my GitHub here
Background
I love to make my home smarter any chance that I get. However, I have really grown tired of how segregated all of the smart home devices are in my house. Every different smart item needs its own smart bridge plugged into the router. I understand that standards have not been established across these companies yet, but I want to solve this problem now. This is where Homebridge comes into the equation. It is known as the smart home for the impatient.
Goal
I will focus on combining several different subsystems into one software solution.
The goal will be to have all these systems operating on the simultaneous controllable interface through the Apple HomeKit System. This could work with any device's smart interface, but I selected Apple because that is the majority of devices in my home.
The hardware to accomplish this very streamlined. I will be using an old Raspberry Pi 3 plugged into my router to host this entire system.
Natively Supported Systems
The Ikea Tradfri system is a preassembled ecosystem of devices that work natively with Apple HomeKit. I purchased the Gateway kit several months ago. It comes with a bridge that you plug into the router using Ethernet. This bridge communicated with devices using Bluetooth and has devices to extend the range throughout the house. This means that all you need is the mobile application for set-up and devices that support the standard. Once complete, all devices show up in the Apple HomeKit GUI.
Implementation
I first follow the instructions on the Homebridge GitHub.
WARNING doing this essentially takes over your Raspberry Pi OS, so you want to be sure before you start this process. Make sure Node.js is installed before attempting this.
To turn any Raspberry Pi into a Homebridge, all it takes is running one simple command:
sudo npm install -g --unsafe-perm homebridge
Then run the program with:
homebridge
This will bring up the basic Homebridge GUI
The Homebridge GUI assists the user with a series of steps setting up the Raspberry Pi as a local server. The user is given a local IP address, which can be used in a web browser to access Homebridge from any computer in the house. The user also is allowed to make Homebridge start upon startup of the Raspberry Pi, which I enabled. I will not show detailed screenshots of my personal interface for my own privacy. Instead, many of the images shown are stock images of the interface.
Plugin Time!
Homebridge integrates with different smart devices and services using user-written plugins that are shared amongst the community. Luckily for me, people have already created the plugins that I need.
The first plugin is the Homebridge Config UI. This drives the web interface and the local server. Users can configure the local port and Ip address in the settings. This is installed by default and requires no modification on my part.
The integral plugin to this system is the Homebridge ADT Pulse Plugin. ADT as a security system is not particularly fond of users making back-end workarounds. As such, all hardware in my house (motion sensors, smoke alarms, cameras, and door detectors are all on a private network in a separate router with a firewall. However, this plugin utilizes the username and password of the web-based ADT plus interface, which already has its own mobile application. This allows users to arm and disarm alarm systems from their phone. I simply wish to have this in my Apple HomeKit Interface instead of the ADT separate application.
Homebridge myQ is another super useful plugin for users with Garage door opener applications. Why would someone want to open an entire app just to press one button to open/shut a garage door? With this I can integrate the garage door into my Apple HomeKit system.
Originally, smart LG TVs also had a separate application for TV controls, and this system required the LGWebOS plugin. However, my TV updated this week to support Apple HomeKit by defualt, making this plugin not necessary. It is worth checking to see if your LG TV has similar features.
Making it Work with Apple HomeKit
Now that all the plugins are established, the system should be all set to work with Apple HomeKit. The Homebridge GitHub has a section dedicated to this too. All it takes is three simple steps:
Tap the Home app on your apple device
In the home tab, tap the (+) plus icon
Tap add accessory, and scan the QR code provided in the Homebridge UI (shown above)
From here all setup is done through the very intuitive Apple UI, which opens up way more interesting possibilities. Users can organize devices by room and household. You can easily set automations that trigger when you enter or exit the house. You can even use Siri to trigger devices using your voice. All of these features are housed in one convenient interface on my Phone, Mac, Apple TV, and Apple Watch. Below are pictures of all my devices on the same interface.
As you can see I have access to all ADT sensors for all doors and windows and I can activate and deactivate my alarm from the same interface. My garage door and TV also show up in the device listings. Homebridge even shows all these devices in its own interface (shown below).
Conclusion
If you want a quick smart home immediately, Homebridge is the way to go. Your mileage may vary with how many devices you have in your house or how much security you like. For me, I use this system constantly and it is always responsive. Even after power outages the system automatically restarts itself. For a user made system, the reliability and robustness is incredibly impressive. If there are any questions involving this process I can answer them in the remaining two weeks of class.
Edit: I continued this project when I moved to a new house! I keep it updated here on my personal project site.
With this project completed, this concludes my undergraduate degree at Stevens
I will be continuing my education part time remotely with my graduate degree in Computer Engineering
I would like to thank Professor Kevin Lu for all of his support over the past few years