My IoT Weekend - Part 1
Join the DZone community and get the full member experience.Join For Free
What better way to spend Super Pi Day than with 100+ technology geeks at a Hackathon… and that’s just how I started out this past weekend. Intel is hosting an IoT Roadshow at a number of cities across the world, and they were in Somerville this weekend at Greentown Labs for the Boston edition. It was a full house with many – me included – drawn by the free Edison board and Grove-Starter Kit offered to the first 100 attendees in line.
I arrived at just past 8 a.m. and was about 50th in line… a line that didn’t start moving until they opened the space at 9. The photo below was taken about 1 p.m., at which time everyone had boards out, and table space was at a premium.
I’ve noted before a major irony of the wireless (and now IoT) age is that you need more room and more wires to get everything up and running or charged. The Edison board, for instance, needs two USB cables and a power cord when you’re flashing the firmware.
This event was a hackathon, with cash prizes of up to $1500 being offered, but I knew I wouldn’t have the entire weekend to dedicate. Nor did I have any really inspirational ideas, and none of the few pitches I heard was overwhelmingly compelling to me. For my first foray into this hardware hacking, I was kind of itching to go it alone anyway, and luckily I had a duo of experienced Arduino makers next to me to get me over the few bumps in the road I encountered.
Setting up the board was a great deal simpler than I expected, and Intel has assembled a pretty good set of tutorials and references on their Google docs site to follow. For Windows users, it turns out there’s a new installer that actually makes it even easier to flash the board, set up the drivers on your laptop, etc. – a fact that wasn’t clear until I was 75% through the manual process.
That said, the 90 minutes it took for me to work through the manual process gave me a much better understanding of how it all works together, from flashing the board, to using PuTTY and SSH to connect, to setting up ethernet over USB, to connecting the board to the XDK development environment (which, by the way is pretty slick, and has progressed nicely since I used it over a year ago for cross-platform mobile development demos).
XDK comes with a number of template applications for the board, so I started with the on-board LED Blink app,
To get from code to execution, it’s a simple matter of building and uploading the project to the board, which XDK makes pretty easy via its UI (below).
The end result of the app isn’t exactly photoworthy, so I’m sparing the bandwidth. Suffice it to say, ahem, the light bulb finally went on (and off… and on… and off).
Using the Temperature Sensor and LCD
The Grove starter kit comes with about a dozen sensors, so I thought I’d kick things up a notch by connecting the (analog) temperature sensor and displaying the current temperature on the LCD (I2C) sensor.
Not much code needed here:
to produce :
Adding Internet to my Things
My next step was to use one of the freely available web APIs out there to get the current temperature outside, compare it to the temperature inside, and then display the difference on the LCD. There are host of APIs and API curators out there (Mashery, Programmable Web, Apigee, etc.), but the free one that caught my eye was WeatherUnderground. You make a simple REST call and you get back some JSON with a bevvy of information about the current conditions at your location (specified via city name, id or lat-long). Yeah, you do need to sign up for a free account, but that’s pretty much par for the course these days.
The code to make a GET call in Node.js is pretty simple if you use the Request package… or so I thought! My Node skills are admittedly rusty, but when the “Hello World” example wasn’t working, I knew it wasn’t me, and in fact there seemed to be a network issue that affected some -but not all – of the attendees. Every request being made from my board was getting redirected to what appears would have been a splash screen looking for network credentials, so while my HTTP requests were returning a success code, they weren’t really hitting the intended service.
After about an hour of back and forth with the awesome Intel guys on site, reflashing the board, and waving dead chickens, I decided to call it a day and hope for better connectivity at home.
Published at DZone with permission of Jim O' Neil, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.