Last Friday I spent the day at the AWS Popup Loft San Francisco. Just like when I was there two weeks ago, it was for an all day, hands on bootcamp. However, this most recent visit was much more exciting since we were learning about the Internet Of Things, the MediaTek LinkIt One and how to use AWS to process all the data. I left filled with good times, glorious ideas of IoT, and some goodies. A friend called it “Adult summer camp”, I call it “So awesome, why haven’t you gone yet?”
The AWS IoT Hack Series uses one of three different pieces of hardware, either the
Intel Edison, the Particle Core, or the MediaTek LinkIt One. Our session was sponsored by MediaTek, so the LinkIt one was our device of choice. This was combined with parts from the Seeedstudio Grove Starter Kit, because it isn’t an IoT party unless you can sensor things.
The basic concept of the class was to learn how to build the hardware. Program the LinkIt One to monitor the sensors then send the data over Wifi. Then it’d be received via Amazon SNS, Amazon DynamoDB, or Amazon Kinesis (based on configuration). The data was then processed with Amazon Lambda. Lastly, the data was displayed, in real time, on a website built in S3. The “finished” hardware is what you see on the left, and really darn simple. Just plug in all the components and you’re off to the races. We were only using the touch sensor and 3D accelerometer for data generation; nothing sexy but it’s a great proof of concept.
So programming the LinkIt One is the next step in the long road to IoT. The unit is Arduino compatible so we used the Arduino IDE with the addition of the LinkIt One SDK, to enable support of the extra features (e.g. Wifi). Fortunately for the class (since I think a lot of people didn’t know C++/Arduino programming that well), the code for the “Connected Maraca” (as they called it) was already written for us. It was very simple (detect motion, submit to AWS) with most of the work going into the code that actually interacts with the AWS APIs. However, there were some constants that needed hardcoding which we didn’t have yet as they’d come from the AWS setup. So for fun I ran a test with the LinkIt One GPS (pictured), super easy!
In AWS we were setting up and using: SNS, DynamoDB, Kinesis, IAM, Cognito, S3, and Lambda. Normally setting up this many services would be a class in and of itself (possibly several classes, for the AWS uninitiated). Fortunately, AWS has one more cool technology that we got to use to great effect: CloudFormations. They gave us a CloudFormation script that did just about everything related to the AWS setup for us. It could have done everything, but the instructor purposefully left out a few steps from CloudFormation so we’d get to be more hands-on with the setup (which was a great idea).
AWS Kinesis doing its thing
One of those manual steps was getting AWS Lambda online. It was really interesting since Lambda is fairly new, but EXTREMELY powerful. The entire concept of Lambda is that you (in many cases) don’t even need to spin up servers any more, NodeJS (in the form of Lambda) can handle some of the data processing/ingestion for you. The rest of the data intake is handled by Kinesis, which I also hadn’t used before and was eager to take a peak at. Between these two technologies, our IoT data was processed and sucked directly into DynamoDB without a single EC2 server instance being spun up.
Boo ya! Top of the leaderboard!
Once the AWS environment was online, CloudFormation spit out a wonderful “fill in the blank” for our LinkIt One code. A few minutes after that, the code was compiled and pushed onto hardware. Most importantly/excitingly… it worked! I could shake the
“Connected Maraca” and see the leaderboard report that data in less than a second. The fact that I’d never seriously played with the IoT or most of these AWS technologies at the beginning of the day mad this exceptionally exciting. Sure the data wasn’t that terribly interesting (just a 3D Accelerometer being shaken), but the concepts were solidly planted. With our infrastructure we could easily make a few code changes to suck in and report any sort of data. Even better, because data ingestion was handled by Kinesis, we could theoretically have hundreds of these devices reporting in within minutes and no changes required other than scaling up the Kinesis shard count.
I finished first in the class, so I had lots of time to kill. I managed to get my hands on an LED bar and servo, so I began to integrate them into my “Connected Maraca” project. It was a piece of cake once I found the libraries for the Grove starter kit for LinkIt ONE. I had a lot of options for improving the IoT connectivity (GPS recording anyone?), rather than just hacking on new hardware. However a number of my classmates ran into trouble and needed help. There was both AWS IoT proctors and MediaTek proctors, but I like teaching so I offered to help out where I could.
Amazon and MediaTek were kind enough to let us take home the dev kits, along with a $25 credit to AWS (which is enough to pay for two months of our IoT CloudFormation). It was extremely generous, especially for a class we paid nothing for, and made an awesome day even better. If you ever have a chance for a similar class, I’d highly recommend it. I finished off my Friday with my head swirling with possible IoT ideas (and a solid idea for a startup) AND, more importantly, the knowledge of how to actually execute on these ideas.