Last week I had the distinct honor of being able to demo as the “Hack of the Month” at the New York Tech Meetup (NYTM). I didn’t know I was going to be demoing before I showed up and I got insanely lucky that I happened to have all the supplies I needed with me, but I managed to pull together a pretty good demo of some of the hardware hacks that I’ve been working on for the past few months.
The video of the event is split into bookmarks, with my Arduino and laptop hack presentation just past halfway.
Arduino is a little open source micro controller that makes it super simple to interact with different hardware components like buttons, LEDs, sensors. They’re really great because they make it easy to prototype and tinker with hardware, which has been expensive and time consuming in the past.
I got into Arduinos back in September. I took a class with Rick Waldron, the author of an awesome library called Johnny-Five. The library makes it easy to interact with Arduinos using Node.js (which is my programming platform of choice right now). Johnny-Five is really cool because it lets developers interact with hardware using their favorite language instead of having to learn the Arduino standards C or C++. This is especially awesome because it lets us use the libraries and frameworks we already know and love. For example, here’s a simple node.js app that uses Johnny-Five to send an email (powered by SendGrid) when you press a button:
I spent several months tinkering with this Arduino / Johnny-Five setup and ended up incorporating it into my SendGrid demo. I also taught intro to Arduino workshops at DotJS and Heroku Waza. At the workshops, I helped attendees get up and running with an Arduino and talking to it over serial and even showed them how to setup the press-a-button email demo. At both conferences, it was the most popular workshop.
Recently I was asked to do a similar workshop over at PyCon. I happily accepted, expecting there to be a Python package that made it easy to interact with Arduinos. I quickly realized that no such package existed, so I took it upon myself to write one that I could use at the workshop. It’s called BreakfastSerial and you can find the source on github. Just like Johnny-Five, BreakfastSerial makes it easy to interact with an Arduino using serial, but this time in Python.
For example, here’s the code for a lightswitch (which is what I demoed at the NYTM):
As you can see, it’s only 5 lines of code and even a novice programmer would be able to understand what is going on. My goal is to use BreakfastSerial to help developers get into hardware by lowering the barrier of entry even farther. The best way to do that is to continue adding new sensors and components to the library. When developers come across an accelerometer or a tri-color LED, they need to be able to just fire up a python REPL and use it. We’re adding new things to BreakfastSerial regularly, so keep your eyes on the github repo and come help us add new components.