Open Smart Hub

Ever since February 22 when I entered the Hackster Hardware Weekend in Seattle, I’ve had a growing passion for the open source side of home automation. What started as a simple idea to automate the closing and opening of windows became something bigger than I ever imagined.

The Hackster.io Hardware Weekend was how the Open Smart Hub was born. I started with a hacked together hub that could run on the Intel Edison and automate a servo to act as the window opening mechanism based on WeatherUnderground API information or light/motion from a Spark.io Core (now named Particle.io). Once the event finished I realized that my implementation couldn’t scale and was horribly confusing to recreate.

I began to research the implementations that were available to the public. What were the open source options? What were the professional products? How did they succeed or fail to solve the problem? My conclusion was that the home automation space was cluttered with all the different companies, organizations, products, and applications. What we as consumers and I as a programmer needed was a simple platform to expand, integrate, and customize my personalized home automation experience. IFTTT is a great alternative but it is impossible to add your own devices, actions, functions, etc. There is no communal collaboration! If you added a device and someone else wanted to use the same sort of device, they would have to recreate it themselves.

That is when I began to reimplement the Open Smart Hub with a modular design. I chose Node.js as my platform because of it’s low barrier to entry for programmers, abundant tutorials, and abundant library of open source modules. The core of the new implementation is the configuration file that declares the available device types (think WeMo switches, Hue light bulbs, Nest, Weather Underground data, etc.) as well as a user’s stored scenarios and devices. I chose an implementation where you could fully own and have the ability to control everything. After all it’s your home!

The implementation is split into two parts, a local hub run on a Raspberry Pi 2 within your home network which handles all the interaction between your devices and an online hub that gives you an accessible UI from anywhere.

Here’s a demo of a basic scenario implementation:

If you would like to check out the details or learn more check out the Hackster.io project: http://www.hackster.io/anthony-ngu/open-source-home-hub

Enabling Node.js WebSockets on Azure Web App

Recently I found myself confused by a websocket issue on an Azure deployment of a Node.js Socket.io app. In order to run WebSockets on an Azure WebApp or Website, you need to turn off IIS WebSockets module which conflicts with the Node.js WebSockets.

To do this, you have to turn on WebSockets in the configure of the app and do one of two things:

Option 1:

Create the following web.config file in your root folder prior to pushing to the Azure website:

Option 2:

FTP into your website’s location using the URL found in the Azure Management Portal and replace the web.config file in \site\wwwroot location with the content above.

Source:

http://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-chat-app-socketio/

Not Just Another Code Monkey

Today my coworker (and mentor) mentioned something to me that really stuck in my mind.

I’ve done this kind of work plenty of times. Let’s work together on it. But you making a name for yourself is more important to me than any amount of visibility I would get by leading it.

In my mind this immediately evoked a scene I’ve experienced many times in MMORPGs (Massive Multiplayer Online Role Playing Games) where the higher level player helps a friend gain experience and finish their quest in order to level them up and get them closer to being on the same playing field. The ultimate goal by doing this is that they can both work together, have fun, and accomplish bigger goals. Needless to say, my mentor has been a great help in nurturing my growth and getting me excited to arrive at work every morning. I think that this mentality is the sign of a great mentor/manager and I aspire to do the same when my time comes.

“Not just another code monkey”

It’s been in the back of my mind since the first day I began to code. Almost anyone can learn to code and pick up basic programming skills from the internet, tutorials, and online courses. The telltale sign of a good programmer/engineer is not just how well they can write code, but also how they think, how they interact with others, how they problem solve, and how they learn.

Today I feel like I’ve been given the chance to showcase my skills and become the person that drives change and features!

Hackster Hardware Weekend (Hackathon)

I had the chance to participate this past weekend in a Hackster.io Hardware Weekend in Seattle and was blown away by the setup. Like most hackathons, they had big sponsors like Intel, Microsoft, Spark, AT&T, etc. However, unlike most of the software hackathons I have been to, they provided some hardware for people to use including Intel Edison boards with Seeed Studio Starter Kits and more. They also provided some cool and useful swag like a portable charger (which I used to power a Spark Core for my demo) and a small portable Leatherman pocket tool that is perfect for my recent maker lifestyle. The energy they provided was just spectacular and even though it was their first time hosting a hackathon, I think it went smoothly.

The food wasn’t just your normal pizza and salad hackathon meals. It also included a legitimate breakfast with bacon, eggs, bagels, cheese, etc. Lunches and dinners were comprised of delicious sandwiches (kind of like Banh Mi), mexican food, and one meal of pizza. On the side they have a whole bunch of candy, popcorn, and more snacks along with the steady supply of coffee, soda, juice, and water.

Unfortunately, like with most hackathons, the crowd of participants thinned out by day 2 with most of the remaining people being interested in learning more or deeply involved in the hacking process.

I came to the event without a clue as to what I was going to build and not really sure if I wanted to join a team, make one, or run it solo. After hearing about some of the prizes for using certain APIs (Weather Underground and WebRTC) I decided to focus my time on the Weather Underground APIs. Even after deciding what I wanted to use, I didn’t really have a clear understanding of what my final product would be and how it could change the world. I just decided to start hacking something together that I thought would be cool to own and ended up going down the path alone.

Stages of my Creation:

  1. Started with the idea to read the forecast for the day and display it to you through an small LCD screen so that I wouldn’t need to pull up an app to view the forecast. Decided to use the Intel Edison, Cylon.js, and the Weather Underground APIs to do this.
  2. Added functionality that would open your windows using a servo if your indoor temperature was past your comfortable zone and the outdoor temperature was colder. I also added functionality to change these settings through buttons and rotary angle sensors on the board.
  3. Added functionality to push the data to the cloud
  4. Realized that I could also connect to a Spark Core and communicate with it via WiFi and the Cloud from the Intel Edison, so I integrated a lighting scenario with a wireless connection.
  5. Created a prototype case for the now deemed “Hub” in Autodesk Fusion 360.
  6. Created a webpage using AngularJS on Azure that would showcase the data my back-end was receiving so that I could view information on the go.

The prototype Open Source Home Automation Hub was born.

Some things I’ve come to realize for my next hackathon:

  • Work in teams! I worked solo this weekend and although I did a lot of work to combine all the components, I definitely could have gone further with the idea and took it to the next level ending up with a professional product rather than a hacked together demo.
  • Set up a team before hand and know the expertise of everyone in the team and how best to leverage them. (This also might mean vet out the people who might have less to contribute if you are going hardcore)
  • Sometime’s it’s more about the presentation, the story, and the idea than the execution during the hackathon (although that might be due to the hardware nature of this hackathon). After all, you only have so much time both to hack and to present your creation.
  • Network! This is really just a great opportunity to meet other people in a related field and find out their skills and platforms of choice. Who knows? You might find a couple new tools that might be useful for your future endeavors.
  • Roll with it. A vision is great, but be able to adapt if things don’t work out quite like you expected.  Sometimes code breaks and it can be stressful but learn from it and debug better.
  • Have fun!

Solving Problems with 3D Printing Models

I recently stumbled upon a bizarre issue. I had this 3D model I had created in Autodesk Fusion 360 and it looked great, albeit strange due to the supports I added around it.

Model

It rendered properly on MakerBot Desktop, and I figured that I could just print it without issue and come up with something similar to my design and then perfect it later. Here’s what I ended up with:

lightbox_actual

Woah where’s the cavity? Why is it filling it in? I took a look at the print preview and how the slicer was splitting up the layers only to find that it had filled in the box!

rendered

I couldn’t figure out why the rendering showed it with a cavity but the printer was receiving instructions to fill it in. I thought that it might be the combination of Autodesk Fusion 360 and Makerbot Desktop software that is the problem, so I called them to ask about it. It turns out that it happens across the board from time to time with different 3D modeling software. Prints don’t necessarily turn out the same way they’re rendered, especially with more complex designs. (That’s how I learned to always check the print preview on a 3D printer. No one wants to spend a couple of hours on a wasted print.)

The Solution:

I heard about a repair tool that might help called Netfabb, so I decided to try it out and see how well it would perform. I can’t speak for the full downloadable tools, but I found out that they have a cloud service (https://netfabb.azurewebsites.net/) which will allow you to upload your STL files, repair them, and then download the fixed version (free as long as it’s for non-commercial use). This fixes some of the issues you might be seeing with your prints. (Remember to double check them through the print preview though)

Middle Button Craziness with Microsoft Mouse

Lately I have been doing a lot of work in Autodesk Fusion 360 and panning/orbiting has been kind of a pain with the use of just my left click button. I knew there had to be a shortcut and found out that the middle button should allow you to pan and orbit, but that functionality wasn’t working for me at all. Instead it would scroll out on a big scale.

After looking into my normal mouse settings, I realized I had no option of customizing the middle mouse button?? That didn’t seem right.. There had to be a way!

Here’s the solution I found:

If you are using a Microsoft mouse, download IntelliPoint 7.0 and you will be able to customize your mouse button settings and change the middle button from flip to middle click.

Mouse

In my particular case it matters how I press down on the scroll wheel. If I press down on it from above, it still counts it as a scroll action, but if I press the back half, it recognizes it as a middle click.

MouseMiddleButton

If you are interested in learning more about the Autodesk Fusion 360 shortcuts, CAD Forum has a good compiled list.