

The whole idea is based on Toms original design of a LED mail notifier, but I refined things a bit (specifically the py script part) to better suit my needs (also big thanks go out to Pete from nermal.org for his assistance/ideas regarding python coding!).. The device listens to instructions sent over the (emulated) serial port of my usb/serial converter by two python scripts. Those scripts regularly check my gmail account for new incoming mail (done by the first script which is called every ten minutes as a CRON scheduler job) and - this is where the other script comes into play - continuously listen to dbus system alerts concerning new instant message arrival, which are issued by Pidgin (my favorite instant messenger) as soon as a new instant message is being received (thanks to a Pidgin dbus notifying plugin). This can also be done with Thunderbird (email client), provided the necessary thunderbird dbus plugin is installed.
But first lets have a look at the hardware:
wiring schematic of the PICaxe circuit
The hardware part is simple (see schematic above). It consists of only six resistors, one common cathode RGB LED, a picaxe08m microcontroller (and some 9-pin female serial port connector) . The picaxe listens on Input 3 to bytes sent by the python script(s), and encodes Outputs 0, 1 and 2 according

this is scaled up to 200 percent already!
The python script that gathers email information is using the python "feedparser" library to fetch an RSS/atom feed of my gmail account's inbox two times in succession, each five minutes. If the number of mails in my "inbox" mail folder has increased (meaning new mail has arrived) the LED slowly flashes in red for, lets say, seven times when I have seven new emails. As soon ( a few minutes later actually) as I have read all my emails, the atom feed is updated with the new overall mail number "zero", and the LED doesn't light up anymore. The script is launched regularly every ten minutes by cron scheduler, so overall it observes my email inbox folder nonstop every five minutes. I reckon this is a bit often, but as long as it doesn't hurt...
The other script listens nonstop on the dbus for incoming alerts from Pidgin Instant Messenger, and decides whether the incoming message is from
a) a known person ("buddy")
b) a certain domain (for example all messages from employees of one company)
c) unknown person
Then the corresponding byte sequence is sent to the picaxe (who is using the last three bits of each byte to decide which pin to put high or low). For each of the three types of message the python script sends out the right bytes with the proper delay, so the LED is flashed accordingly: in case A it flashes fast and green for a few seconds, for B it flashes fast, red and not long (only a short burst) and for C it blinks three times very slowly in blue.
Both scripts also give some info output on the console, but can perfectly run in the background too since they don't need user interaction.. Only problem for windows users, the pidgin/dbus thingie doesn't work outside linux since there exists no dbus extensions for win32 (not yet, but a windows port of dBus is in development!). The email notifier does work with WinXP though.

fuzzy picture of the secret prototype :)
UPDATE
You can download the needed python scripts and PICaxe basic code here
http://www.mediafire.com/file/qyykwnxj4mk/notifier_gmail.py
http://www.mediafire.com/file/5q0y5mzzmhd/notifier_pidgin.py
http://www.mediafire.com/file/qzmznxjgjln/twinkle.bas
Heres a small script to test your circuit (cycles through all colors one time)
http://www.mediafire.com/file/qdjdlycjgmz/LEDtest.py
Also here's the PCB layout
http://www.mediafire.com/file/mf5iyytohyo/twinklePCB.bmp
The scripts are written for python 2.6/linux and need to be customized a bit,
for example you need to change the buddy ICQ number entries to match your
buddy list, and adjust the /dev/ttyUSBxxx to your serial port's name...
Also you may need to install python-serial and python-time from the
ubuntu repositories, then it should work.
UPDATE2
This all is "deprecated" as they say in linuxland. In other words it should be considered "public alpha" release and has been superseded by my all-new and shiny dBird notifier script collection as detailed in the article ABOVE. (just wanted to mention it here too)
cheers