Gmail + Arduino + Flowers, part 1

So I’ve been working on my Ubicomp midterm project with Haeyoung, Pritika and Garrett.  We are almost done with the project.  I thought I would post up the code here, because it was kind of difficult to follow/track down, so I thought I would detail it here.

First of all, our project makes flowers light up with an LED attached when you receive an email through Gmail.  It’s supposed to be a soothing notification, for something that may cause stress.  Flowers counteract that.  Anyways, here’s how to set up your project with Arduino and Python to get an LED to light up when you receive an email in Gmail.

The 2 main tutorials I followed were Jamie’s tutorial and TinyEnormous’s post here.  But are well documented, but somethings were finicky, so I thought I would just post a step-by-step for what I did.

1) I’m using an Arduino Duemilanove, Mac 10.6 Snow Leopard, and Textmate

2) Download this zip file: gmail-arduino

3) Open up the zip file.  Open up the ardunio.txt file and paste it into and Arduino sketch.  Save the sketch somewhere.  I placed mine my Documents/Arduino folder.

4) Open up the check-mail.py python file.  This is where things start to get tricky.  I placed this file in the same folder as my Arduino sketch.  I don’t think it matters where you place this.  So up at the top, put in your username for Gmail and your password.  I use Textmate for this business.  Also add your Arduino Serial Port in there.

5) Now download the Feedparser library and Serial Library.  After you download both libraries, you need to install them in Terminal too.  So start up Terminal, and then change the directory to where you downloaded the Feedparser library (cd Downloads/feedparser etc).  Then type in: python setup.py install and it should install Feedparser.  Do the same for the Serial library.

6) Now take the plist that was in the zip file, and move that file to ~/Library/LaunchAgents.  If that directory doesn’t exist, make it.  Make sure you change the directory in-between where it says <string> to point to wherever you placed your Arduino sketch (/Users/Name/Documents/etc).  It’s weird though, the pList doesn’t seem to matter for me.  The integer node supposedly tells the Mac to run every interval set there to refresh and run the python script.  None of this seems to affect anything I have running.  The other tutorials use this though.

7.  Next set up your breadboard and Arduino, if you want to set up a LED at pin 13.  If you’re using Textmate, pop up the check-gmail.py file, and hit Command-R to run the script.  It should start running and your LED should light up when you receive an email, and turn off when you have no more new mail.

Here’s the final product:

Gmail + Arduino from Aaron Druck on Vimeo.

I’m going to hopefully be posting the final project, where we are connecting to different Gmail labels and lighting different corresponding LEDs.  If you look in the python script, there’s another PATH that shows the url for a specific Gmail label, in that case “Bills.”

This entry was posted in Physical Computing and tagged , , , . Bookmark the permalink.

Comments are closed.