The Chicago Hackathon was many things to Kashif Malik and I (Gabriel Peal), one of which was tiring. I finally woke up from a long, long sleep (and moved across the country and started a job among a few other things...) so I think it's time to give you all a high level overview of what we made.
Let's just start of with the fact that neither Kashif nor I had ever heard of OSIsoft or the PI System before stepping foot in the building (no offense). We didn't even know we would be required to use a M2M platform at all! I am happy to say that the guys at OSIsoft were incredibly helpful and insanely patient and they took the time necessary to give us a top to bottom crash course within the span of a hackathon and left us with enough time to actually build something with it.
Anyways... This is what we did:
Because we entered the hackathon thinking there were no restrictions, we brought an Arduino and a few sensors just in case we thought of a use for them
We then learned that the PI System is great at storing time series and thought that it would be a perfect way to store sensor data from the Arduino.
However, we learned that one does not simply jump in the PI System and "just start using it"...
So, we decided to use the PI System to record sensor data from an Arduino BUT it had to be simple to use meaning it abstracts all backend integration with the PI System so all the user does is connect the Arduino and start seeing data.
We use the term Arduino generically because the data it sends back to the computer can be ANYTHING! Depending on what hardware is connected to the Arduino and what software it is running, the possibilities are endless. It could report electricity usage in your home, fuel efficiency of your car, indoor/outdoor temperature of your house or a piece of machinery, etc. The possibilities are endless so what we have created is essentially a black box to use the PI System for anything. Pretty cool huh?
Out final product had 2 parts:
1) a simple Arduino -> PI System uploader that reads any Arduino data
2) an attractive and easy to use webapp to display data in real time
the screenshot below is an actual screenshot from our webapp. The top left graph is currently blank because there is no arduino connected but if there were, it would update live! The other 3 are examples of different manipulations of data. In this case, we are monitoring electricity usage so our software generates additional statistics such as electricity usage per day of the week, hour of the day, parts of your house, and so on. <-- there is a bug in your rich text editor. this is not supposed to be bold...
tl;dr This got us first place.
HOW IT WORKS:
We wrote a .NET app in C# to read data off of the COM port from the Arduino and used the PI SDK to upload it to the cloud. We wanted to make even this as simple as possible so the only options it has are a) the COM port (which should default to the right one anyways) b) the PI Server url, and c) the PI Tag. That's it. Super simple.
We then needed a way for people to access and visualize it. Both Kashif and I are familiar with rails and django web frameworks but not ASP.NET. This was a problem because the SDK is designed for .NET only. However, we decided to dig up the seldom used SOAP API (half of the reason we are team Soap -- the other half being that we didnt sleep or shower for 50 hours) and build a python wrapper for it so we could use django. Once we got that working, we had an interface to the PI Server so we built a webapp using Twitter Bootstrap and Flot to come up with a great UI extremely quickly. However, we needed to tell the webapp where to find the data in the PI System so we made a simple form in which you enter the same PI Server url Tag and it does the rest behind the scenes. Once you register the sensor in the form, it remembers it and begins sending data to the page. We used ajax requests to ask for the latest data via json and updated the graphs in real time.
We think that this application of the PI System extends its capabilities and potential outreach in to new markets and demographics in a really attractive package.
Feel free to reply if you have any questions or comments!
Gabriel Peal and Kashif Malik
WHO ARE WE?
Gabriel Peal: A rising senior Electrical Engineering major at Northwestern University. I am from Bethesda, MA and currently working for Google
Kashif Malik: Also a rising senior Electrical Engineering major at Northwestern University. I am from Karachi, Pakistan and am currently working on writing and directing a film.