Controlling Hardware Over the Internet With M2X
Guest Post by Shawn Hymel, SparkFun Engineer
I know that some of you preparing for the upcoming AT&T Hackathon – Code for Car & Home already have ideas rolling around in your brains. Others will play it by ear when they get to the event. Either way, now is a good time to start looking at what will be available during the hackathon – what kinds of tools and libraries can you bring (or will be given to you!) to make your project go smoothly and hopefully walk away with some sweet prizes.
A good number of sponsors at the hackathon will be handing out hardware kits and offering technical support. With the focus on Internet of Things (IoT), most of these hardware kits include some kind of wireless device (Wi-Fi, Bluetooth, Cellular). In particular, SparkFun Electronics is offering a kit that includes a TI CC3000 Wi-Fi shield among other sensors and controllers.
Out of the box, the CC3000 (along with an Arduino or other microcontroller) lets you connect to a Wi-Fi access point in order to send and receive TCP packets. Good news! AT&T’s M2X service works over TCP. That means with some basic hardware, you can collect sensor data and push it to M2X for logging. The data in M2X can also be displayed in a pretty line graph, which is useful for viewing data over time (such as the temperature in my office).
With a little bit of software trickery, we can control hardware from M2X. This involves writing values to the M2X data stream and having our CC3000-equipped Arduino poll the stream. The Arduino performs an action based on the data it finds, which can be anything from lighting an LED to controlling your washing machine.
To get you started with the CC3000 Wi-Fi shield and AT&T M2X, SparkFun has put together a series of tutorials and examples. Head to SparkFun’s Learn site to see how to connect your hardware project to M2X.