Sunday 30 December 2012

Morse Code Gmail Notifier

After the fun-and-games with Morse and the Raspberry Pi yesterday, I decided to turn my hand to something a little more subtle - something which couldn't have been done more easily on a PIC!

Following on from the inspiration provided by Michael at MitchTech, who described a Physical Email Notifier using the RPi, latterly picked up by the good folks at Adafruit, I mixed in some Morse ...

My code uses Michael's technique to parse an Atom feed from a Gmail account every minute and then announces the name of the senders of all unread mails by Morse Code on GPIO 11 of the RPi.

You saw earlier how this can flash an LED or key a transmitter. You could use the same open-collector interface to switch a buzzer / sounder to let you hear the Morse.

The code uses a neat feature of Python (and other languages too, for all I know) to make the mapping between alphanumeric characters and their Morse representation: "Dictionaries". These were a new discovery for me yesterday - makes learning new programming languages actually worthwhile!

I generate a string of 0's and 1's for each Morse character; 0 for a dit and 1 for a dah. The rest is pretty self-explanatory.

You'll need to edit the code to insert your username and password - I don't want you reading my emails! 

The code tries to announce only the first name of the sender (by searching for the first space in the "author" field). If there isn't such a space, it will just encode the entire author string as Morse - even including the new "ac" bigraph for "@".

As well as trying to get "GISTS" running on this post, I also uploaded both the Gmail Notifier and the iambic keyer Python code to a site for your easy downloading convenience...

The Gmail notifier is available here 
The iambic keyer is available here 

Enjoy!

 ...-.- de m0xpd

2 comments:

  1. And your dictionary omits the letter C because...? Sorry, I kan't help konkluding this is done for some klever reason, and my kuriosity is driving me krazy...

    ReplyDelete
  2. Hi Ranger 9. No excuse - I just goofed! It has been corrected now - thanks for your interest.

    ReplyDelete