“How to Send Email with Arduino” at NY Tech Meetup

Posted on

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.

Swift speaks at NY Tech Meetup

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.

Swift is a developer evangelist at SendGrid who is based out of NYC. He is one of the founders of Hacker League and tweets as @SwiftAlphaOne. Follow him there and check him out at http://theycallmeswift.com.

3 thoughts on ““How to Send Email with Arduino” at NY Tech Meetup

  1. Dear,
    I am trying to use the library "johnny-five" in Opensuse (Linux), but shows the error below.
    Can you tell me what's wrong?

    administrador@linux-pyx1:~/johnny-five> npm install
    npm http GET https://registry.npmjs.org/socket.io
    npm http GET https://registry.npmjs.org/compulsive
    npm http GET https://registry.npmjs.org/descriptor
    npm http 304 https://registry.npmjs.org/socket.io
    npm http 304 https://registry.npmjs.org/compulsive
    npm http 304 https://registry.npmjs.org/descriptor
    administrador@linux-pyx1:~/johnny-five> npm install itself
    npm http GET https://registry.npmjs.org/itself
    npm http 404 https://registry.npmjs.org/itself
    npm ERR! 404 'itself' is not in the npm registry.
    npm ERR! 404 You should bug the author to publish it
    npm ERR! 404
    npm ERR! 404 Note that you can also install from a
    npm ERR! 404 tarball, folder, or http url, or git url.

    npm ERR! System Linux 3.7.10-1.1-desktop
    npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "itself"
    npm ERR! cwd /home/administrador/johnny-five
    npm ERR! node -v v0.8.12
    npm ERR! npm -v 1.1.63
    npm ERR! code E404
    npm ERR! Error: EACCES, open 'npm-debug.log'
    npm ERR! { [Error: EACCES, open 'npm-debug.log']
    npm ERR! stack: 'Error: EACCES, open 'npm-debug.log'',
    npm ERR! errno: 3,
    npm ERR! code: 'EACCES',
    npm ERR! path: 'npm-debug.log' }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! System Linux 3.7.10-1.1-desktop
    npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "itself"
    npm ERR! cwd /home/administrador/johnny-five
    npm ERR! node -v v0.8.12
    npm ERR! npm -v 1.1.63
    npm ERR! path npm-debug.log
    npm ERR! code EACCES
    npm ERR! errno 3
    npm ERR! stack Error: EACCES, open 'npm-debug.log'
    npm ERR!
    npm ERR! Additional logging details can be found in:
    npm ERR! /home/administrador/johnny-five/npm-debug.log
    npm ERR! not ok code 0

    • When you're running `npm install itself`, you're trying to install a package called "itself" (which doesn't exist). Once you run the initial `npm install`, the library and it's dependencies are installed in that directory. You can run all the examples in the `eg/` folder.

  2. Pingback: Speaking to Arduino with Email

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>