Wireless Light Control

My first project was allowing an iOS app to talk to Phillips HUE lights using a WiFi connection. My project was based on David’s project and involved working with Node.js and Modulus. While my project was similar to David’s I decided to do everything on my PC, while David had done his project using a BeagleBoard and Mac. Most of the information on how to create the project has been covered in David’s GitHub and blog post, so I will focus more on the parts that I found most difficult.

The first part of the project was installing Node. Since I was using Windows, I decided to just download the installer online. It turned out, however, that the installer had a slight bug where it set up Node so that it was always looking for npm in C:\Users\(Username)\AppData\Roaming\npm. As it was not installed there, Node kept crashing for me when trying to run anything. To solve this problem, I eventually just created the corresponding folder in that location and then everything started working fine.

To next test if my code could actually create a server before uploading it to Modulus, I decided to run it on my computer. To do this, I had to first install all the missing dependencies, luckily running npm install in the corresponding folder automatically installs all the dependencies. After checking that the server ran on my computer, I proceeded to then upload it to Modulus.

For my code to run on Modulus, I had to first create a project, which was relatively straightforward. I then had to upload my files into my project. I decided to upload them myself instead of using the command line tool. For this to work, I had to delete all of the dependencies that had been installed in the previous step then zip the folder and upload it. Once the code had been uploaded, I just needed to set up the local server on my computer.

To connect my computer, the Phillips lights, and the iOS app, I used the same AirPort that David had used. To connect to the AirPort, I downloaded the AirPort utility for windows that allowed me to talk to the AirPort. I ended up spending a lot of time trying to debug the AirPort, until I found out that it hadn’t actually been connected to the Ethernet. Another thing that required a lot of time was realizing that I had to be connected on the network created by the AirPort to be able to connect with everything else. Once I had realized both of these, it was just a matter of modifying the code so that it would point to the IP address created by the AirPort and my Modulus project instead of David’s. After this step, I had a mostly working project.

A couple steps that had to be done at the very end were that I had to create users manually and change ownership of the bulbs from David to me. The latter though was a result of me using the same equipment as David. Overall the project was a cool first experience working with Node.js, Modulus, and IOT and I’m looking forward to my next project, which will be working with Rollbase and AngularJS as well.

Advertisements

One thought on “Wireless Light Control

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s