Gmail and RSS Notifiers using the Arduino
I’ve been really interested in doing J4mie’s Physical Gmail Notifier ever since it came out in February. I only recently dropped into the project and got to learn a lot about python, plists, and arduino auto-reset functionality. I’m going to share what I’ve learned because I think there are lots of other people out there struggling to make it work. This page doesn’t really offer much that J4mie didn’t already say – it just says it in a different way.
I’ll post the code below – one issue with the way J4mie posted his was that it appended line numbers to everything and messed with formatting. Python is _really_ picky about formatting! All of the files are zipped HERE. It consists of three documents –
1) one python script that logs into your gmail rss feed and checks your total number of new messages. It then sends either an ‘m’ or an ‘n’ to the serial port.
2) one arduino sketch that tells the arduino to turn on or off a light based on the serial input
3) one .plist file that tells your mac (sorry pcs!) to run the python script every 60 seconds. If you run windows or linux then I’m sure there is something you can do to schedule this. You could also just set it to loop until quit. (to quit a script in terminal hit control-c)
Section 1- Python. You will need to change the python script so that it has your email and password, as well as your serial port info. This assumes you are checking a gmail account. It also works if you are using gmail as your email host for a private domain. The serial port info you can grab from the arduino program or by typing “ls /dev/tty.*” into the terminal. Save that file and put it somewhere on your computer. I picked my Documents folder. You will also need to download and install feedparser. This is what helps python parse the rss feed into useable chunks.
Section two – Arduino. Now go ahead and open the arduino sketch included in the zip file, paste it into your arduino window, and upload it to your arduino. You don’t need to change anything on this.
Section three – .plist. Next you should open the plist file and change it so that it points to the python script you changed earlier. If you want to change the frequency that it checks your mail at, that is the “integer” tag towards the end of the file. It is measured in seconds. The plist file should go in your user folder under Library/LaunchAgents. If the folder isn’t there then go ahead and make it.
Until you restart the plist won’t do anything, so the simplest thing to do is to restart. If not then you can manually run the python script. To do that type “python ” into terminal and drag in the python file. Hit return to run it. Once it has run, you can hit the up arrow to recall the last command typed, and return to run it again.
For more Detail: Gmail and RSS Notifiers using the Arduino
Leave a Comment
You must be logged in to post a comment.