Internet of Things coding workshop


The Event

On Thursday afternoon I attended a free Internet of Things Coding Workshop put on by AT&T and Texas Instruments at AT&T’s M2M/CD Foundry in Plano, TX. While this type of programming isn’t really relevant to what I do in my day job I am interested in the topic so I asked by boss if it was okay if I attend and he was fine with it. The hosts were kind enough to provide us with a free lunch and I think there were about 50 attendees. This was the 3rd session they had done and it sounds like the others were even busier. They had a 4th session that evening on the topic as well.

I sat down and ate my lunch and then started taking a look at the materials provided. They gave us a Texas Instruments MSP-432 LaunchPad development kit and a TI SimpleLink Wi-Fi CC3100 Module BoosterPack to plug into it. There was also a USB Key stick which contained drivers for the hardware and an IDE called Energia. The drivers were available for both Windows and Mac, so I was using my MacBook Pro that work provides me for the class. The driver installation was easy on the Mac, but the Energia required me to load a legacy Java 6 environment. TI should really update that to just run off of the latest Java 8 VM on the Mac, that would be my only real complaint about the setup. The USB drive also had the lab book in PDF form (we received a paper copy as well). Additionally the presentations done in the session were available on the drive.

The toys:

The Texas Instrument Hardware provided in the class

After I finished installing the software I started on Lab 1. The first thing we had to do was create an AT&T M2X account. M2X seems to be AT&T’s IoT service. It is what they are selling hence the reason for sponsoring the event. It seems to be a great service to collect time series sensor data and do things with that data. One of the things that I most liked about the service is everything is a REST call and they have great documentation for what you can do with it. For the first lab we just created a virtual device on M2X and hit the endpoint with different rest calls to simulate data coming in. We set a stream on the device that was tracking speed in miles per hour and you would send different speeds into it via HTTP POST and get real time updates on a graph. It was a nice introduction for how to work with M2X.

The second Lab had us using our TI LaunchPad hardware with the M2X service. The goal here was to create a M2X stream for push button data. We were going to simulate a sensor on a refrigerator door that would keep track of how long the door was open. The first thing we did add a new stream which tracked seconds. Then they gave us the skeleton of a LaunchPad app for our board. We had to edit the Wifi Settings in the Code as well as add our device ID, stream name and our API-Key on M2X. Then we added the main logic loop to the program. We would track the button reads and the state about whether it was pushed or not. Then we would subtrack the time it was released from the time it was poshed and use the m2XClient to send the stream value. In the Energia you are doing C programming, but the great thing about it is they ahve abstracted away the hardware, so you are just calling a digitalRead function on a push button in this case and it pulls in the value for you as an it. So you aren’t dealing with the low level networking to get the data out, nor are you dealing with the hardware as they are wrapping it all for you in a library. In the Energia environment you are selecting which board you are targeting and then they go ahead and compile it for the hardware that you have. This really takes the pain out of doing hardware level programming and I feel like creates and environment that makes it very accessible to anyone with a moderate amount of programming experience. In fact there was one father son group in the class, and I do feel like this would be accessible to children that had done some computer programming. Once we finished that we uploaded our code to the board and ran it. I was unable to get the serial line monitoring of my board working on the mac, but the code was working as I would press and hold the button and would get real time graphs of how long the button was held for.

My computer and board setup:

My Hardware Setup

On to Lab 3. For lab 3 we learned about triggers in M2X. Basically you can watch your data stream and when certain events happen it will fire a trigger for that event. The first part of it we just hit a URL on Request Bin. After you saw the trigger work we then tried out the If This Then That service better known as IFTTT. AT&T has a tutorial on using that service with M2X over here. We used it to send an SMS when our trigger condition was met with our previous trigger. The great thing about the triggers in general is, they are just a callback URL so you can do almost anything with it.

Lab 4 was using AT&T’s Flow Designer to wire services together. Flow is basically a graphical way in your web browser to wire different services together by dragging components onto a canvas and wiring them up. Your input can be something like a rest endpoint or a RabbitMQ message, or any number of options. You can then transform and apply different operations to the data that comes in and send it out somewhere else. In the first example we wired a message that had a unix timestamp. We then transformed the date by using some javascript operations on the payload to print out a nicely formatted date time string. One of the interesting things about the Flows is this is AT&T’s Platform as a Service (PaaS) offering. So they will spin up a docker container with your service that you can test out on the spot. Flow Designer also lets import and export Flows as json objects which is a nice way people can share different flows for services. It is also built around a github model, so you can build public flows or fork other users flows. So there is an opportunity for people to design complex services here and share them.

Lab 5 was basically tying everything together. So we went back to M2X and wired that trigger into a Flow from Flow Designer. The end result was that we pushed the button on our TI board, which sent a message to M2X and then triggered a flow in Flow Designer which then operations on that data coming in.

All in all this was a great coding workshop. Ideally I wish there was at least another lab doing something more advanced with our TI Arduino boards as for me that was probably the most interesting part. It is interesting to see AT&T position themselves as the network for IoT and I think they will do well in the space with their offering. They have some very developer friendly services to start messing around with their stuff. Their M2X data store reminds me of what you can do with Cassandra and time series data, but in this case they take care of all of the work of building and designing that data store and give you great real time data out of the box. The other nice offering AT&T had was if you developed some IoT app and needed connectivity they gave us an offer where they would give us 3 small form factor sims that each has 10 mb of data on it for free for 3 months so they are serious about wanting to be the network behind your service. I finished lab 5 at 3pm when the rest of the class was still in lab 3 and was about to head out when the guy from TI got up and gave their hardware presentation. It was very interesting and they have tons of stuff we can plug into our boards for all sorts of capabilities priced from $10-$30 per module. They also have this little Beagle Bone Board that completes with a Raspberry Pi. It looks like Arduino, Beagle Bones are also an open source hardware thing you can find here. I had considered playing around with a Raspberry Pi for a while, but I haven’t gotten around to getting one, so it was interesting to hear about a competing similar type board. At the end of the presentation they did a drawing, and boy am I glad I didn’t head back to work right at 3pm, as I won the raffle. I had the choice of getting either a LCD panel for my Ti Board, or a Sensor Pack or the Beagle Bone board. I decided I wanted something else to plug into the LaunchPad so I was torn between the LCD and the Sensors. I probably should have taken the Sensors just to do more with the board, but I took the LCD as I liked the idea of being able to get some feedback without the serial line. The screen is the 430BOOST-SHARP96 screen. After winning that and with the other hardware it was an amazing 3 hours and 15 minute workshop for me and if you see something like that in your area I strongly recommend attending, it is a blast. For more information on the types of things people can do with this type of stuff check out this TED Talk: