Or: how to turn this..
![]()
into this..

I was given a lovely glowing cube by the generous people at Linden Labs as a freebie at a job fair yesterday, and I decided that it was far too attractive to simply sit there on a shelf, pulsating forlornly until its batteries went flat. How about making it useful, while maintaining its visual appeal?

The following guide is deliberately fairly high-level, because the exact details will vary depending on your operating system and particular hardware setup. I did this with my Mac, but hopefully there’ll be enough information here for you make it work on your system, perhaps with a little Googling.
If you don’t happen to have a glowing cube lying around, you can modify this to work with almost any output device you could think of, from a simple LED, or a buzzer, to something far more clever like moving a servo (Gmail Notifier Robot, anyone?)
The basic system has three components:
- the software that runs on your computer,
- the electronics hardware that sits between the computer and the output device,
- and the software that runs on that hardware.
Every so often, the computer checks for new emails in your Gmail account, and then tells the electronics board whether any have arrived. If they have, the board turns on the output device (the cube). Simple.
Hardware
The hardware itself is the popular Arduino board, the tinkerer’s dream device. I’m actually using a Boarduino, but any variant should work (subject to a small but important detail, see below). This might be particularly interesting with a Bluetooth Arduino..
The Arduino talks with your computer over a serial connection, which runs over the normal USB cable you use to communicate with your Arduino.
Here’s the first important note: the latest Arduino Diecimila has an “auto-reset” feature which allows you to upload programs to the board without manually pressing the Reset button every time. This works by resetting the board whenever it receives any data over the serial port. Because we are going to be sending serial data to the board regularly, this is not what we want. Fortunately, this feature can be disabled on my Boarduino by simply removing a capacitor (C6), but it may be trickier on the official Arduino. Any suggestions for how to get round this in software would be gladly received (leave a comment!). One way is to simply keep the serial port open all the time (perhaps using the Serial Proxy, link at the bottom of this page). This solution isn’t much use for me, as I’ll be unplugging the USB connection regularly and don’t want to have to disable anything first. However this may be fine if your computer is a desktop and you can leave the Arduino plugged in all the time. If you go this route, you’ll have to use a different script running on the computer, and make sure it runs continually rather than repeatedly. I’ll leave this to you!
I connected up the cube using a PC fan extension cable from Maplin – simply because the connector on the end fits perfectly on the pins of my Boarduino. Use your own method to connect your output device.

I chopped off the “plug” end of the cable and soldered it onto the battery connectors on the cube, drilling a hole in the battery cover to allow the wires to pass through:


Connected up to the Boarduino for testing:

Software
This project requires two bits of software: one running on the Arduino to receive serial data and toggle the output accordingly, and one running on the computer to check for new emails and send data out over the serial port. To re-iterate, these code listings should only be used as a guide. They work for me, but I don’t guarantee they’ll work for you, and I accept no responsibility for breaking things. If you don’t understand what this code is doing, you probably shouldn’t be running it.
The Arduino software is fairly trivial. It just loops round, watching for bytes coming in over the serial port, and sets a variable called “mail” to be true if the data is an ‘M‘, and false if it’s an ‘N‘ (of course these characters are arbitrary). It then updates the value of the output pin to be equal to this mail variable. You can hack this and expand it or modify it however you like – perhaps you could make an LED blink when you have new email instead of just turn on?
int outPin = 12; // Output connected to digital pin 12int mail = LOW; // Is there new mail?int val; // Value read from the serial portvoid setup(){pinMode(outPin, OUTPUT); // sets the digital pin as outputSerial.begin(9600);Serial.flush();}void loop(){// Read from serial portif (Serial.available()){val = Serial.read();Serial.println(val);if (val == 'M') mail = HIGH;else if (val == 'N') mail = LOW;}// Set the status of the output pindigitalWrite(outPin, mail);}
Upload this to your Arduino, and then connect your output device to pin 12.
The software for the computer takes the form of a Python script, and is slightly trickier. First, it tries to open the serial port for communication with your Arduino. If it can’t do this (say, if your USB cable is unplugged), it quits immediately. If the serial port opens successfully, the script has to talk to Google’s servers to determine if you have any new email waiting for you. It does this by authenticating with your Gmail username and password, and then requesting the Atom feed for your inbox (this part of the script is based on code from here). It then parses out the line containing the number of unread messages (the XML tag is called ). If the unread message count is zero, it sends an ‘N‘ over the serial connection. If it’s greater than zero, it sends an ‘M‘.
This requires the pySerial library!
import urllib2, re, serial, sys#Settings - Change these to match your account details
USERNAME="username@gmail.com"
PASSWORD="yourpassword"PROTO="https://"
SERVER="mail.google.com"
PATH="/gmail/feed/atom"SERIALPORT = "/dev/tty.usbserial" # Change this to your serial port!# Set up serial porttry:ser = serial.Serial(SERIALPORT, 9600)except serial.SerialException:sys.exit()# Get Gmail Atom feedpassman = urllib2.HTTPPasswordMgrWithDefaultRealm()passman.add_password(None, SERVER, USERNAME, PASSWORD)authhandler = urllib2.HTTPBasicAuthHandler(passman)opener = urllib2.build_opener(authhandler)urllib2.install_opener(opener)page = urllib2.urlopen(PROTO + SERVER + PATH)# Find the mail count linefor line in page:count = line.find("fullcount")if count > 0: break# Extract the mail count as an integernewmails = int(re.search('\d+', line).group())# Output data to serial portif newmails > 0: ser.write('M')else: ser.write('N')# Close serial portser.close()
UPDATE: See below for a nicer version of this script.
Now, this script needs to be run regularly (say, once a minute) so that when you get a new email, your notifier will light up promptly. On Mac OS X, the launchd service handles, among other things, launching programs at set intervals (on other Unix systems liked Linux, you may need to use cron. On Windows, I have no idea – but I’d imagine it’s possible somehow).
Put this code in a .plist file (mine’s called org.j4mie.check-gmail.plist – I have no idea if you have to follow the weird naming format, but it works for me) and save it in ~/Library/LaunchAgents (create this folder if it doesn’t exist). Don’t forget to change the second ProgramArguments string to the location of your Python script.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.j4mie.check-gmail</string>
<key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array><string>/usr/bin/python</string>
<string>/Users/yourusername/path/to/check-gmail.py</string>
</array>
<key>StartInterval</key>
<integer>60</integer>
</dict>
</plist>
UPDATE: As Jonas Stenberg pointed out in the comments, you may need to alter the /usr/bin/python string in this plist file to point to the location of the Python interpreter on your machine, for example /usr/local/bin/python2.5.
To load this plist file into launchd, type launchctl load ~/Library/LaunchAgents/org.j4mie.check-gmail.plist at the terminal (or reboot your computer).
And, with any luck, that should be it! Once a minute, your Python script will execute, checking for any new emails in your inbox. If any have arrived, your cube (or other output device) should spring into life!

UPDATE: Here’s a much nicer version of the Python script, using the Universal Feed Parser module from www.feedparser.org
import serial, sys, feedparser#Settings - Change these to match your account details
USERNAME="username@gmail.com"
PASSWORD="yourpassword"PROTO="https://"
SERVER="mail.google.com"
PATH="/gmail/feed/atom"SERIALPORT = "/dev/tty.usbserial-FTDK0P3M" # Change this to your serial port!# Set up serial porttry:ser = serial.Serial(SERIALPORT, 9600)except serial.SerialException:sys.exit()newmails = int(feedparser.parse(PROTO + USERNAME + ":" + PASSWORD + "@" + SERVER + PATH)["feed"]["fullcount"])# Output data to serial portif newmails > 0: ser.write('M')else: ser.write('N')# Close serial portser.close()


I really like your idea
[...] enough information here for you make it work on your system, perhaps with a little Googling. Click here for full article Share this post: email it! | bookmark it! | digg it! | reddit! Published Feb 15 2008, 12:05 [...]
Jamie, this is really cool and I want one. If you have any spare cubes and Arduino boards lying around send them my way
And to anyone who doesn’t have one of these cubes on hand, let me suggest that Ikea has a lot of lamps that are ripe for modification.
I turned one of these: http://www.ikea.com/us/en/catalog/products/10029220
into this:
http://flickr.com/photos/recursive/2253405271/
(That’s just a dimmable colorful lamp. I have another, and I might turn that one into some sort of network-controlled RGB lamp.)
The Hacktory here in Philly is working on putting together a kit like this for Ikea lamps (like Michael mentioned). I’m aiming to have the class run this summer or fall.
Great minds thing alike!
Ikea is my best source for project boxes ever, by the way.
[...] How to make a Physical Gmail Notifier – Link [...]
[...] How to make a Physical Gmail Notifier at j4mie dot org [...]
[...] GMail son pequeñas aplicaciones que muestran un mensaje cada vez que recibimos un correo nuevo. Esta guía nos enseña cómo hacer un notificador en la vida real, que enciende una luz cada vez que tenemos [...]
I made a similar thing
http://www.s-m-l.org/dev/ezusb-frosty.html
[...] Gmail são pequenas aplicações que mostram uma mensagem cada vez que recebemos um novo e-mail. Este tutorial nos ensina como fazer um notificador real, que acende uma luz cada vez que temos um e-mail novo na [...]
This is awsome. I’m going to make one 2!
That’s weird – the 2nd life cube you have looks identical to one I bought in Barcelona.
I did a similar hack to yours using it, except that I disconnected the 3 LEDs from the little epoxy chip running them and hooked them up individually to PWMs (on a different controller board, but maybe the Arduino can handle it too?).
Then I had different states for the cube:
* off
* blinking red/green – new IM
* orange, new mail
* violet – “I’m busy, don’t bother me” to keep people away from my desk
[...] lying around, an Arduino board and some software. Hit the link for a full set of instructions. [j4mie via [...]
I’m not 100% sure, but I think that in your arduino code, the first line of void setup () should be
pinMode(outPin, OUTPUT);
not
pinMode(ledPin, OUTPUT);
Thanks a lot for this post! I’ve been looking for something exactly like this!
Thanks tinyenormous, you’re absolutely right, well spotted! I changed the variable names when I posted the code here, and I must’ve missed that.
Thanks to all for the comments!
Awesome ideea. Thanks for sharing. This is good to know.
Fun stuff.
I am using the Arduino Diecimila and to get around the ‘auto reset’ problem, I just looped the python code. Probably not the most elegant method, but it works.
hmmm.. it seems to me that it would be easier to control the cube directly from the pc… the arduino seems redundant as you can just raise the pins on your parallelport…
– just a thought..
[...] megvizsgálni, hogy hétfőn mit kell beszereznem az új gmail notifieremhez [...]
looks cool, i made a similar picaxe circuit, pics and schematic here: http://successlessness.blogspot.com/2007/07/ambient-email-notifier.html
Awesome idea man. I want to try all this, just that I am not sure if I would be able to away with technicalities.
[...] jag nd vlja att frska mig p att bygga ngot eget s hittade jag via gizmodo en intressant guide som kanske skulle hjlpa tminstone lite p traven. Med tanke att jag frst igr fr frsta gngen [...]
[...] Physical GMAIL Notifier 17 02 2008 How to make a physical GMAIL notifier! [...]
[...] recently came across a little project which would turn on an LED box when there was mail your gmail account. I thought it was quite [...]
[...] lying around, an Arduino board, and some software. Hit the link for a full set of instructions. [j4mie via [...]
[...] How to make a Physical Gmail Notifier at j4mie dot org Gmailが届くと光るキューブの作り方 (tags: gadgets Gmail hack hardware) [...]
[...] be able to quickly write your first “Hello World” and then get hacking. Just look what one enterprising person did with some Linden Lab schwag from the recent Wired Sussex Jobs [...]
[...] bis aus einer Waschmaschine ein Rechner geworden ist oder aus einem leuchtenden Plastikwürfel ein physischer Gmail-Notifier. Die ganzen Genies, deren Heimat das Make Magazine ist oder [...]
[...] Find out how to make this incredible gadget here. [...]
If you are already running Google Notifier, you can write an appleScript plugin, so it will send the trigger bits out the serial port. One less process polling Gmail.
David: the problem with that approach is that you can only configure Gmail Notifier to trigger an Applescript when a new mail arrives, but not when there are no new mails waiting. So the cube would light up when when you get a new email, but it would have no way to know that you’ve read it (and you want the cube to turn off).
Home Engineering: Physical Gmail Notifier…
How to make a Physical Gmail Notifier
Every so often, the computer checks for new emails in your Gmail account, and then tells the electronics board whether any have arrived. If they have, the board turns on the output device (the cube). Simple.
The h…
[...] How to make a Physical Gmail Notifier – Very interesting. A step by step instruction on how to setup a cube to glow when new emails are received. [...]
[...] every so often on your own computer. I’m doing this using launchd in Mac OS X. See my Physical Gmail Notifier post for instructions of how to do [...]
[...] How to make a Physical Gmail Notifier [...]
[...] a cool hack on how to make a physical gmail notifier. You could probably use any other type of LED RGB device too. I was given a lovely glowing cube [...]
Ok that works. Now, does anyone have control over the light color? I’d like to have it turn RED if there is a voicemail.
Thx
Max
[...] are as cool, and actually quite useful as this one. Jamie Matthews on his blog shows us all how to turn an external device into a Gmail notification lamp. The article is fairly detailed, but I think if you put in some time and effort you should do [...]
[...] How to make a Physical Gmail Notifier at j4mie dot org [...]
[...] my near-hysterical delight, then, when I found this little guy, the literal convergence of my two nerdiest, guiltiest pleasures, over at [...]
[...] http://www.j4mie.org/2008/02/15/how-to-make-a-physical-gmail-notifier/ [...]
[...] How to make a Physical Gmail Notifier at j4mie dot org Nice hack. (tags: gmail electronics hardware hack projects) [...]
Marvellous Jamie!
[...] j4mie.org) Tags: diy, gmail [...]
Im old but it reminds me of “bit” in the movie Tron. The little blinker thing that told him stuff? I really liked that. Kindof a techy version of tinkerbell.
It also reminded me of some of my own security hacks. To notify me in case of really nasty activity on my servers and other servers Im being paid to keep an eye on. this lamp would work in well with that system.
Create an email address for someone like May B. Bhad
Have the most important warnings sent to that address.
Create a .forward which sends the email to the sms address for your cell phone AND to another email address OFF system since the sms will only be part of the message. Having the message go to another address off system will insure that you keep a full copy of the warning email and have it in a place that is not reachable by a possible attacker or able to be destroyed by the system problem it is reporting.
Examples of the types of things which should be sent to may@example.com would be root kit notifications of course, and notifications of a runaway log (df shows a use of over 98%?), maybe each time someone becomes root, if the load average shoots up over a certain level? Anything you consider as something which immeadiately needs your attention.
Another email you might create is M.Urgency@example.com which has instructions to process emails in a specific manner. That way, if you are away from home and get an SMS from May B. Bhad which shows a serious problem you can just forward it to M.Urgency to shut the system down until you can get home. What you have M.Urgency do on getting an email is up to you. Backup, or restore, or kick up an ssh daemon on an unusual port number, or reboot to single user mode, or even just do a complete shutdown. Or have it actually process a message to decide which of all of them its being told. Such as having it read the Subj: for the words backup, restore, backdoor, reboot, shutdown.
In other posts I have also discussed having the same options available by other means. Such as watching the weblog for a request to process a CGI request. The CGI itself does not even have to exist since you are only watching for it to be requested such as seeing any site trying to access http://www.example.com/WarningWarningDangerDanger. I would not setting up either the email or the cgi to accept passed parameters. Simply make them absolutes and not have them try to pass anything to root. Simply setup a watch routine that says “if you see this then do this”.
The advantage of such low-tech things is that attackers might search and shutdown fancier (and well known) watchdog programs. But they will often leave common user accounts alone, and leave web daemon running. These actions are not recommended to replace serious security programs but to simply augment them.
The funniest thing I got from this was on a server I was paid to admin. I saw a notification that someone had become root. The email included a full netstat (from a hidden clean version) and I saw someone poking around ON THE CONSOLE. I was able to surprise the machines owner by telling him “I see you have someone else checking the system. Should I shut it down? Or am I being replaced?”. The fact that I saw it, that I could stop it, and that the other guy couldnt figure out how either thing was done allowed me to keep the job.”
Gandalf Parker
–
Having locks on the gate doesnt mean that you dont need a watchdog in the yard.
awesome idea and i love it
cheers
So if I am not tech savvy enough to understand this how would I go about buying one?
I’d love to have one notify me of gmail and IM
.
[...] How to make a Physical Gmail Notifier at j4mie dot org [...]
fuck, this is great, thanks
[...] How to make a Physical Gmail Notifier at j4mie dot org (tags: programming projects hardware hacks diy electronics arduino) [...]
To get it to not reset on opening the serial port, try to get your system to not unassert the DTR line.
DTR low drags the /RESET line down after the capacitor C4 (in the boardino USB schematic) discharges. Not allowing DTR to fall (possibly through manually manipulating the FDTI chip’s driver in the USB version) will prevent the reset due to serial actions.
Cool project and a good write up, nice work.
The Arduino boards are just great and so easy to get going with.
Some time ago I made a build indicator for Cruise Control using a USB SnowMan but the hardware wasn’t ideal and difficult to get hold of, I’m planning to update it soon to use the Arduino also.
If your readers have problems getting their hands on the cube they might like to try the SnowMan like I used, it’s a standard off the self USB SnowMan (without the sound), remove the base and pull out the old LED then put in a standard 5mm LED (I used a TriColor LED) – don’t forget the appropriate resistors, then hook-up similar to how you’ve done it – or even just chop the cable going to the USB connector and use the built in multi-color LED. Hey presto a SnowMan GMail indicator!
[...] How to make a Physical Gmail Notifier at j4mie dot org (tags: gmail electronics diy hardware arduino hack reddit) This entry was written by delicious and posted on 5/22/2008 at 11:33 pm and filed under Home. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL. « links for 2008-05-22 [...]
[...] How to make a Physical Gmail Notifier – Fun project that uses a glowing cube to make a GMail notifier. [...]
[...] I found an very interesting project on a blog it will let you to make a Notifier in form of a lamp which will glow up whenever a mail reaches in your GMAIL box I guess with some change in programming you can make same for other mails which supports POP3 or IMAP All the details can be found >> Here [...]
Hi, this is very cool. I have an arduino and have been wanting some web -> physical thing for ages.
So I got everything going, figured out why my serial port wasn’t working (some weird character in my tty.usbserial text) and the only stumbling block now is that my version of python doesn’t seem to have ssl installed, so won’t do https requests properly.
I’ve been installing python lib after python lib in an attempt to access https and I can’t get it working! I’m sure others have this problem, but I haven’t found a solution.
Any ideas!?!?!??!
Cheers, Ben.
Macbook – os x 10.4 – python 2.4
That seems strange, Ben. I’m using 10.5 and Python 2.5.1 so I can’t reproduce your problem. Perhaps you could try installing the Universal Feed Parser module from:
http://www.feedparser.org/
and then use this new “short version” of the Python code:
import serial, sys, feedparser
#Settings
USERNAME=”username@gmail.com”
PASSWORD=”yourpassword”
PROTO=”https://”
SERVER=”mail.google.com”
PATH=”/gmail/feed/atom”
SERIALPORT = “/dev/tty.usbserial-FTDK0P3M”
# Set up serial port
try:
ser = serial.Serial(SERIALPORT, 9600)
except serial.SerialException:
sys.exit()
newmails = int(feedparser.parse(PROTO + USERNAME + “:” + PASSWORD + “@” + SERVER + PATH)["feed"]["fullcount"])
# Output data to serial port
if newmails > 0: ser.write(’M')
else: ser.write(’N')
# Close serial port
ser.close()
EDIT: Oops, WordPress seems to have lost the indentation, but you should be able to work it out.
Hi, what a great idea! When I saw this I wanted to try it for myself. Everything works for me when I run it from the terminal. But when using launchd I get this error:
ImportError: No module named serial.
I’m thinking it has got something to do with Mac OSX 10.5 build-in Python interpreter, but I have no idea how to fix this…
Any help would be great! Thanks!
Allan
Hi Allan,
You need to install the PySerial library from here:
http://pyserial.sourceforge.net/
Good luck!
Thanks for your reply! I did that, and it works fine, but only from the terminal! Somehow the module isn’t being recognized when I use launchd to run the script…
Anyway, I’ll keep trying to figure it out!
Thanks! Allan
i’ve done the “server side” software with visual basic. if someone’s interested you can mail me at teto9001 [ @ ] gmail.com
Hi Jamie, i’ve done a (windows only) Visual Basic version, and modded the Arduino software. It blinks N times, where N is the new mail count. If you have 5 new mails, it blinks 5 times (fading) and pauses for 2 seconds. Check it out here:
http://0xteto.com/jhome/physical-gmail-notifier-v2
Thank’s for your work! Arduino r00lz!
[...] GMail Notifier The work by Jamie Matthews inspired me to create the similar GMail [...]
[...] Glowing Cube Gmail notifier [...]
[...] any device to turn on, illuminate, spin, fly, whatever you want when you receive an email. In this tutorial, the author used an LED Cube with an embedded RBG color cycle. If you don�t happen to have a [...]
[...] Does yours pop-up in the bottom right of your screen (just at that annoying moment where you need to get to the thing that’s hidden by it!?!?). If so take a look at J4mie’s GMail Notifier Lamp. [...]
[...] pour Gmail. Attention, si vous franchissez le pas, vous ne pourrez bientôt plus vous en passer. [j4mie via [...]
Hi Jamie,
Is it possible to use the PY script with apple mail, so that when apple mail gets a new email it executes the light on ardiuno?
Hi Mathew,
It’s possible to get Mail to execute Applescripts when new mail arrives. See here:
http://www.tuaw.com/2008/04/07/applescript-control-your-mac-with-an-e-mail/
I’m sure it’d be possible to write an Applescript to somehow communicate with the serial port – perhaps via an intermediary Python script?
Good luck!
Very nice and unique idea. I never thought that gmail notifier would be transformed into something this elegant.
[...] for a way to modify the Gmail Notifier code to suit my needs, and my search has brought me over to Jamie Matthew’s site wherein he really re-engineered the Gmail notifier. Instead of the usual desktop application [...]
Hi Jamie,
Great project. Do you think it is possible to apply this to a specific GMAIL “label”? And perhaps apply each label to a specific LED color?
[...] How to make a physical Gmail notifier, how effing cool I’m trying this out when I get some free time, and figure out how to get the cube thingy [...]
Hi Jamie! I was struggling until I found out about the auto-reset functionality messing with the sketch. In case anyone else is interested I posted how to remove that ‘feature’ from the Bare Bones Boards. I’ve got a link up Thanks for the great idea and the how-to!
Hey Jamie!
I study interaction design at Malmö University in Sweden, and one of my tutors/teachers is the man behind Arduino – so I have lots of electronics lying around at home. Well, I thought I’d give this a shot.
I have installed everything correctly as it seems (running mac). When I open IDLE and run the code posted above (with the right serial port) and post it in the Python Shell I get no errors. Still my arduino wont recieve any char/int/byte w/e.
Also have the plist file created and using an Arduino NG with no auto-reset button.
Any clues?
Might as well post some code.
Label
org.jonasstenberg.check-gmail
OnDemand
ProgramArguments
/usr/bin/python
/Users/jonasstenberg/Documents/checkGamil/check-gmail.py
StartInterval
60
import serial, sys, feedparser
#Settings
USERNAME=”mymail@gmail.com”
PASSWORD=”dont_wanna_show_this”
PROTO=”https://”
SERVER=”mail.google.com”
PATH=”/gmail/feed/atom”
SERIALPORT = “/dev/tty.usbserial-A4000PV2″
# Set up serial port
try:
ser = serial.Serial(SERIALPORT, 9600)
except serial.SerialException:
sys.exit()
newmails = int(feedparser.parse(PROTO + USERNAME + “:” + PASSWORD + “@” + SERVER + PATH)["feed"]["fullcount"])
# Output data to serial port
if newmails > 0: ser.write(’M')
else: ser.write(’N')
# Close serial port
ser.close()
Might as well post some code.
import serial, sys, feedparser
#Settings
USERNAME=”mymail@gmail.com”
PASSWORD=”dont_wanna_show_this”
PROTO=”https://”
SERVER=”mail.google.com”
PATH=”/gmail/feed/atom”
SERIALPORT = “/dev/tty.usbserial-A4000PV2″
# Set up serial port
try:
ser = serial.Serial(SERIALPORT, 9600)
except serial.SerialException:
sys.exit()
newmails = int(feedparser.parse(PROTO + USERNAME + “:” + PASSWORD + “@” + SERVER + PATH)["feed"]["fullcount"])
# Output data to serial port
if newmails > 0: ser.write(’M')
else: ser.write(’N')
# Close serial port
ser.close()
Okay, I’ve managed to compile a program out of the py file, but it just wont update ever 60 seconds like it says it should in the plist file.
It’s located under ~/Library/LaunchAgents/org.jonas.gmail-check.plist and I’ve loaded it with launchctl load ~/Library/LaunchAgents/org.jonas.check-gmail.plist
And it says it’s loaded.
Weird? Yes. Clues?
So.. the Python script is talking to the Arduino successfully now, yes? And it’s just a problem with launchd?
Hmm.. I’m not an expert with launchd, I just ended up playing with it until it worked.
You could try using Lingon to edit your launchd config: http://tuppis.com/lingon/
Let me know how it goes!
Hey again, and thanks for the reply.
Sorry for the completely disoriented question yesterday, I was kinda tired, if that’s en excuse.
Lingon says it’s nothing wrong with the plist file, so that’s not the problem.
When I compile an .app from the .py file and run it I can read ‘M’ or ‘N’ at the monitor in the Arduino-program, but when the py-file runs through the plist-file nothing happends.
I have the same code as yesterday in the .py file.
Thanks in beforehand!
I’m not compiling a .app from the .py – I didn’t even know you could do that! I just run the script directly with the Python interpreter, as per the .plist file in the original post. Perhaps that could be the issue?
Hmm.. Python interpreter? You mean the .py file that you call on in the .plist?
1. The code works when I open it up in Python IDLE and choose Run -> Run Module.
2. You can compile the .py file by right-clicking and choose Open Widh -> BuildApplet.
3. My .plist file looks like this and is located in username/Library/LaunchAgents/.
4. The code in the check-gmail.py looks like this:
import serial, sys, feedparser
#Settings
USERNAME=”myemail@gmail.com”
PASSWORD=”password”
PROTO=”https://”
SERVER=”mail.google.com”
PATH=”/gmail/feed/atom”
SERIALPORT = “/dev/tty.usbserial-A4000PV2″
# Set up serial port
try:
ser = serial.Serial(SERIALPORT, 9600)
except serial.SerialException:
sys.exit()
newmails = int(feedparser.parse(PROTO + USERNAME + “:” + PASSWORD + “@” + SERVER + PATH)["feed"]["fullcount"])
# Output data to serial port
if newmails > 0: ser.write(’M')
else: ser.write(’N')
# Close serial port
ser.close()
Hey, thanks for taking the time, appreciate it alot, I want this working!
By Python interpreter, I mean the command-line
pythonprogram, which is called in my .plist file like this:I don’t use IDLE so I’m not sure how that works unfortunately.
Your .plist file and your Python script both look right.. I’m not sure what else to suggest really
What kind of Arduino are you using? Have you checked it’s not being reset every time you send serial data to it? (see Important Note in the Hardware section of the post above).
Yey, I finally got it working after 20h of googling!
The solution.. *dam dam dam* is… /usr/local/bin/python2.5 instead of /usr/bin/python.
Well, some bug between Leopard and Python 2.5.1 it seems.
Thanks alot for this! I’ll probably connect some lightning or motor to the arduino for the Output.
I’ll let you know when I’m done.
Glad you solved it! I’ll update the post with a note that the Python location may need to be changed.
Hi Jamie!
Two more things – when I set it up it was sending the characters as ‘109′ and ‘110′ I just changed the arduino code so it was expecting one of those two.
The second thing – thanks! I got it up, running and documented at my site – my version of J4mie’s arduino gmail notifier Thanks for doing all of the hard work (and documenting it!), and I look forward to toying around with your new midi creation!
[...] 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 [...]
[...] bell tower (or orchestra) controlled by a computer is beyond awesome. The second project is from here It is a gmail notifier based on python and arduino. I’m gonna try to massage it so it works with my [...]
[...] The python code is quite similar to the code from my last project – the arduino gmail checker (thanks J4mie) This time I added a warning to tell you when it doesn’t have the right serial port attached, I [...]
You need to make these gmail notifiers for the desktop, I would seriously buy one from you.
-Joe
Hi jamie, it has been a while since my last comment, I got annoyed with it all and left it, but I thought I’d post in here how I got it working in the end if anyone was interested.
Installing python2.5 seemed to cure the https requests not working.
Running the command “ls /dev/tty.* | pbcopy” in terminal sorted the weird character in the usb serial name. It copies all of what “ls /dev/tty.*” returns straight to the clipboard, weird character and all, so you can paste it straight into your script. Running “ls /dev/tty.*” then highlighting and copying the result out of the terminal window doesn’t seem to work.
Thanks!
[...] much more technically astute than me designed this cube – that lights up when you get a new email in your gmail account. It’s pretty clever. But [...]
[...] of email, here is a tutorial on how to make a physical gmail notifier out of an LED cube. No. 12 on the Top 40 Arduino Projects of the Web, hosted by Hack N Mod. [...]
[...] going to abandon them for now. Instead, I’m taking one of Adam’s ideas as well as the Physical Gmail Notifier project and adapting it to something I can call my [...]
[...] going to abandon them for now. Instead, I’m taking one of Adam’s ideas as well as the Physical Gmail Notifier project and adapting it to something I can call my [...]
[...] How To Make a Physical Gmail Notifier – 创建一个新的小工具,可以告诉你是否有新邮件到达Gmail收件箱. 随机/相关文章: baidu百度sitemap [...]
[...] Links WordPress.com WordPress.org Glowing Cube Hack March 4, 2009, 10:05 pm Filed under: Arduino, Electronics, Prototyping One of the promotional things that Linden Lab gives away is a small colour changing, glowing cube. Last year, we attended a job fair were we gave several away. One of the people who received one decided to hack his cube and made a Gmail notifier. [...]
[...] How To Make a Physical Gmail Notifier – Create a new gadget that will tell you if new mail has arrived in the Gmail inbox. [...]
Hey everyone, I’m in need of a genius to help me complete this project. I cant believe how cool of a project this is, but being a COMPLETE noob, i have no clue where i went wrong. I followed everything to the best of my ability but im stuck!
I have the arduino all hooked up and programmed, the .plist in place and the python file edited to my information. unfortunately ive never used python before and i have no idea how to run or install everything. Ive tried everything i can think of and googling anything just confuses me more. I have no idea what feedparser is or how to install it. PLEASE HELP! ASAP
[...] projecto é fazer um paper toy que avisa sempre que temos um nova mensagem na conta do gmail. O código original é escrito em phyton e executado em linux, para o arduino com porta série (rs232). Além disso, é [...]
[...] was not coded by me, but by the original project that inspired me to make this by Jamie Matthews. Click me and scroll down to the python code that he has posted. I’ve made a few slight modifications [...]
[...] how to make a physical gmail notifier [2]. Arduino. [3]. [...]
I wonder if it’s possible to adapt the project to make a standalone device… It could get internet connection through wi-fi and have batteries charged through USB.
Then it would be even more useful!
Great project! Have one problem that maybe someone can help with. Its the same as the one mentioned by Allan Knoop above. Basically this works fine when i run it manually through terminal, but when i run the plist with launchd i get a ‘ImportError: No module named serial’ error. I dont understand how this is as the script runs fine when done manually, so it must be something to do with launchd. i’m running tiger osx 10.4.11. Has anyone else experience this problem? Its a bit head melting!!
Can’t figure this out :s
Sounds like it *might* be something to do with your python path setting, It looks like it can find your serial module when you run from the command line, but can’t find it when you run from your plist. I’m not really sure why this could be happening, but it could be something to do with you running a different version of Python than the one that comes with Mac OS X, or perhaps the Serial library wasn’t installed properly.
[...] Arduino is not only a difficult word to spell, but also an open-source micro controller with a large community around it. Several days ago I received an Arduno Duemilanove. Several days of complete social isolation and an RSI later, I have created a “Notifier” by mushing together my Arduino with an LED toy/lamp thingy and some inspiration from the Arduino Xmas bell and the Physical Gmail Notifier . [...]
[...] If, like me you’ve ever wanted to sit and obsess over blinking LED’s be told whenever you have new mail or when your website gets a hit in a friendly LED format, then this project is for you. As you may have seen from my previous post, I mashed up a little LED glow light thing with my arduino. A few lines of code and a bit of head scratching later and I was sitting pretty with a light up mail/hit notifier. The project is based on two other arduino projects I found online and all code used in this “How to” is based upon the code from the arduino xmas bell and the arduino gmail notifier. [...]
[...] How To Make a Physical Gmail Notifier – Create a new gadget that will tell you if new mail has arrived in the Gmail inbox. AKPC_IDS += “1117,”;Popularity: unranked [?] Technology [...]
Seems to work ONLY if I leave the serial port open. As soon as I close the app (hyperterminal/python) the board either re-sets or otherwise stops lighting up. My board is a RBBB from moderndevices and requires a physical button-push reset to program (has no C6 capacitor). Anyone have suggestions?! Thanks!
[...] is the original inspiration for the [...]
[...] is the original inspiration for the [...]
So I have been attempting to make this project work so that I can graduate. BUT I can get terminal to say that the plist file is loaded but the ardiuno board just sits there. All the py files, and plist files are written the same as is the arduino software. I have the arduino duemilanove board which has a auto reset button located on it. Would that have any effect or is the board new enough to where it bypasses that?
but main issue is that the board won’t light unless the you set the int mail = HIGH at the beginning of the arduino code (and it just stays lit). plz HELP
Alright so I got feed parser to work, becuase I got it to write no mail, and some mail when I have mail or not. Everythings good with the arduino because I made the intial state of the mail variable to HIGH and the light turns on… I must be having trouble reading the ser.write(’m') command from the gmail-check.py program… any suggestions?