A brief history of GMail retro mailbox.
[from the previous post] While I am taking a little break last week for mid sem break, I decided to do a physical Gmail notifier , as if all notifications from my gtalk , phone and tablet are not enough .
Well , the catch is this will notify me only for the important messages . So I can turn off notifications from other gmail clients notifying me of unwanted mails.
The design is simple ,using gmail's priority inbox feature)I fetch the important mail from gmail rss feed (https://mail.google.com/gmail/feed/atom/important) using python script and send data to arduino using pyserial .
What it does
The incoming important mail will raise the mail flag, display the mail title in LCD (scrolling) , light up notifier LED and play melody.Watch a short demo video:
The followings are photos of mail in priority inbox or lack of that.
![]() |
Yahoo! You've got a mail. |
![]() |
Woohoo! You've no mail |
Tutorial : How to
You will need :
Software list:
Hardware list
- Arduino Uno or duemilanove board
- LCD
- Servo motor
- Piezo speaker
- LED
- 100 Ohm resistor
- variable resistor
- Mini breadboard
- paper and sessior to make your own box
Step 1. Fetch Software
Install software if you do not have them already.
Pyserial is python module for serial communication. Feedparser is module for parsing the emails. Pyserial installation is easy since it is exe file (if you use windows). However, feedparser installation could be tricky if you are a newbie to python like me. You need to add python directory to Windows' "PATH" envionment variables. Then use the command prompt to install feedparser as mentioned in feedparser documentation page. (Hit me up in the comments for any problem).
Connect hardware components as follows.
Step 2: Get Connected
Connect hardware components as follows.
Step 3: Get codes.
Upload Arduino sketch file. You can change melody as you like. You can compose a new one all the notes are in pitches.h. Mine is a simple alarm melody that I like . simple piano score B,G,A,D, , D,A,B,G.
/* * This code reads serial port for email. * If mail is present, it will turn on LED, display on LCD and scroll the display, * raise flag and play defined melody
*copyleft by Aung Thiha *created in April 12 *last modified April 15 *This code is in public domain *www.engineeringthecure.blogspot.com */ #include <LiquidCrystal.h> #include "pitches.h" #include <Servo.h> #define MAX 45 // servo maximum degree. I am making it turn counterclockwise so 0 degree to 45 degreee. It depends on your servo position and configuration #define MIN 0 // servo minium degree LiquidCrystal lcd(12,11,5,4,3,2); int ledPin =13; char ser; String email =""; int servoPin = 9; // notes in the melody: you can write any melody you like // this is a tune I like. so I coverted the piano note int melody[] = {NOTE_B5,NOTE_G4,NOTE_A5,NOTE_D4,0,NOTE_D4,NOTE_A5,NOTE_B5,NOTE_G4,0}; // note durations: duration for a note to play. 4 = quarter note, 8 = eighth note, etc.: // Not important for this tune, but u need to change it if you want to run other other tunes int noteDurations[] = { 4,4,4,4,4,4,4,4,4,4}; Servo flag; void setup(){ Serial.begin(9600); lcd.begin(16,2); pinMode(ledPin,OUTPUT); flag.attach(servoPin); } void loop(){ lcd.clear(); lcd.setCursor(0,0); if (Serial.available()) { lcd.print("connected"); lcd.setCursor(0,1); ser = Serial.read(); //read the serial port //if incoming character is 0, no mail, LED is low if (ser == '0'){ digitalWrite(ledPin,LOW); flag.write(MIN); //lcd.write("You got no mail!"); } //if other characters, servo flag turns, Lcd display and play sound" else if(ser > '0') { flag.write(MAX); lcd.clear(); email += ser; digitalWrite(ledPin,HIGH); getEmail(); //parse email function ,code block is below printEmail(); //print email ,code block is below playSound(); // play melody email =""; // reset email } } delay(1000); } /* *parse the email from incoming characters. *adding each character to email string */ void getEmail(){ while(Serial.available()>0){ char nextChar = Serial.read(); email += nextChar; } } /* * print email and scroll it * */ void printEmail(){ int emailLength = email.length(); lcd.setCursor(0,0); lcd.print(email); delay(500); //scroll it to left until the final char of email is displayed on LCD for (int positionCounter = 0; positionCounter <emailLength-12; positionCounter++) { lcd.scrollDisplayLeft(); delay(500); } lcd.clear(); lcd.print(email); } /*This code play tune from melody array . * literally from public domain code * from arduino Tone tutorial http://arduino.cc/en/Tutorial/Tone */ void playSound(){ // iterate over the notes of the melody: for (int thisNote = 0; thisNote < 10; thisNote++) { // to calculate the note duration, take one second // divided by the note type. //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. int noteDuration = 2000/noteDurations[thisNote]; tone(8, melody[thisNote],noteDuration); // to distinguish the notes, set a minimum time between them. // the note's duration + 30% seems to work well: int pauseBetweenNotes = noteDuration * 1.30; delay(pauseBetweenNotes); // stop the tone playing: noTone(8); } }
Then save the following codes as pitches.h
/************************************************* * Public Constants *************************************************/ #define NOTE_B0 31 #define NOTE_C1 33 #define NOTE_CS1 35 #define NOTE_D1 37 #define NOTE_DS1 39 #define NOTE_E1 41 #define NOTE_F1 44 #define NOTE_FS1 46 #define NOTE_G1 49 #define NOTE_GS1 52 #define NOTE_A1 55 #define NOTE_AS1 58 #define NOTE_B1 62 #define NOTE_C2 65 #define NOTE_CS2 69 #define NOTE_D2 73 #define NOTE_DS2 78 #define NOTE_E2 82 #define NOTE_F2 87 #define NOTE_FS2 93 #define NOTE_G2 98 #define NOTE_GS2 104 #define NOTE_A2 110 #define NOTE_AS2 117 #define NOTE_B2 123 #define NOTE_C3 131 #define NOTE_CS3 139 #define NOTE_D3 147 #define NOTE_DS3 156 #define NOTE_E3 165 #define NOTE_F3 175 #define NOTE_FS3 185 #define NOTE_G3 196 #define NOTE_GS3 208 #define NOTE_A3 220 #define NOTE_AS3 233 #define NOTE_B3 247 #define NOTE_C4 262 #define NOTE_CS4 277 #define NOTE_D4 294 #define NOTE_DS4 311 #define NOTE_E4 330 #define NOTE_F4 349 #define NOTE_FS4 370 #define NOTE_G4 392 #define NOTE_GS4 415 #define NOTE_A4 440 #define NOTE_AS4 466 #define NOTE_B4 494 #define NOTE_C5 523 #define NOTE_CS5 554 #define NOTE_D5 587 #define NOTE_DS5 622 #define NOTE_E5 659 #define NOTE_F5 698 #define NOTE_FS5 740 #define NOTE_G5 784 #define NOTE_GS5 831 #define NOTE_A5 880 #define NOTE_AS5 932 #define NOTE_B5 988 #define NOTE_C6 1047 #define NOTE_CS6 1109 #define NOTE_D6 1175 #define NOTE_DS6 1245 #define NOTE_E6 1319 #define NOTE_F6 1397 #define NOTE_FS6 1480 #define NOTE_G6 1568 #define NOTE_GS6 1661 #define NOTE_A6 1760 #define NOTE_AS6 1865 #define NOTE_B6 1976 #define NOTE_C7 2093 #define NOTE_CS7 2217 #define NOTE_D7 2349 #define NOTE_DS7 2489 #define NOTE_E7 2637 #define NOTE_F7 2794 #define NOTE_FS7 2960 #define NOTE_G7 3136 #define NOTE_GS7 3322 #define NOTE_A7 3520 #define NOTE_AS7 3729 #define NOTE_B7 3951 #define NOTE_C8 4186 #define NOTE_CS8 4435 #define NOTE_D8 4699 #define NOTE_DS8 4978Then get python script. Open new Window >> paste codes >> saved it under any name
with .py extension. Put in your email, password, change serial port that is same as port on
arduino.I pointed the path to "important" label to get priority mails. You can change that
to specific label just by pointing to your label instead of important. You can set your own
filters and label as explained in the link.Reminder about python: index is very important in
python. Copy exactly as follow.
import serial, sys, feedparser,time
#Settings - Change these to match your account details
USERNAME="youremail@gmail.com"
PASSWORD="yourpassword"
PROTO="https://"
SERVER="mail.google.com"
PATH="/gmail/feed/atom/important"
mySerial= serial.Serial('COM5',9600) #change port to your setting.
while True:
gmail = feedparser.parse(PROTO + USERNAME + ":" + PASSWORD + "@" + SERVER + PATH)
unread = len(gmail.entries)
#"print ("Unread:{0}".format(unread)) #uncomment if you want it to dispaly on your desktop
if unread ==0:
mySerial.write(0)
time.sleep(10)
#print("no mail")
elif unread>0:
gmail_latest = gmail.entries[0]
title = gmail_latest.title
author = gmail_latest.author
#print (title)
#print (author)
mySerial.write("[{0}] {1} ".format(unread,title))
time.sleep(20)
mySerial.flushOutput()
Step 4. Test it
Run python script by using F5.
You can always disable some function to suit your need. e.g You might not want sound or display the message at certain time. Then you just need to disable that part of code on arduino. I wrote it in code block exactly to do just that.
If something is wrong , check the connection.
Step 5. Put genie in the box :)
Create the box as creative as you can. I create a cube just because I love the cube design. (not because of Steve Jobs btw.)
Yahoo! You've no mail :)
You have got a mail :(
References.
There are links that give me inspiration and some codes :)
1)http://j4mie.org/blog/how-to-make-a-physical-gmail-notifier/ I got feedparser python code
2)http://blog.tinyenormous.com/2008/12/08/arduino-lcd-gmail-subject/ I got LCD title display idea. but link for download is not working . so I need to write mine.
3) Arduino.cc for all the resources
Thanks for sharing, nice post! Post really provice useful information!
ReplyDeleteGiaonhan247 chuyên dịch vụ vận chuyển hàng đi mỹ cũng như dịch vụ ship hàng mỹ từ dịch vụ nhận mua hộ hàng mỹ từ website nổi tiếng Mỹ là mua hàng amazon về VN uy tín, giá rẻ.
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! 2011 Aged/Old Gmail
ReplyDeleteJust admiring your work and wondering how you managed this blog so well. It’s so remarkable that I can't afford to not go through this valuable information whenever I surf the internet! Buy Old Gmail Accounts
ReplyDeleteI wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. hotmail entrar
ReplyDeleteYahoo mail is an web based email service. Yahoo mail service can be accessed through different devices including computer, tablets, smart phones, and more. Users with a valid Yahoo account can sign into Yahoo com to access the features of Yahoo mail. A smile web browser can be used to sign into Yahoo.com. Users can also download Yahoo app to their mobile phone and login to their account. yahoo mail sign in
ReplyDeletebuy smart carts online. organic smart cart. are the high potency distillate free from any solvents. If this product was accurate with its claim.
ReplyDeletehiring movers in California
ReplyDeleteSo, you have decided to take a step ahead and make the very difficult decision of your life that is to relocate or plan a move. This will be the most stressful time you will ever have if you haven’t planned it properly. If you’re planning to move your house or business to an entirely new state or place then you must be cautious about how you will take the things and most importantly, how will you carry them? Right, if yes then choosing the right moving company is what you have to do.
Latest News Dental Success Blo
ReplyDeleteTownie News Wire. Events. Upcoming Events Townie Webinars. More. Free e-Books Townie Poll Townie Perks Student Membership · Download .Most Active Blogs. Skip Navigation ... Dentaltown Learning Online. By Howard ... 11/6/2018 · Dental Success Blog ... The Best Practices Show with Kirk Behrendt.
Superslot
ReplyDeleteซุปเปอร์สล็อต เราคือผู้ให้บริการสล็อตออนไลน์มีตัวเกมสล็อตให้เลือกเล่นจำนวนมากบนมือถืออันดับ 1 ทั้งฟรีเครดิต 50 ,100 , 150 , 200 ที่สามารถ
Superslot
ReplyDeleteซุปเปอร์สล็อต เราคือผู้ให้บริการสล็อตออนไลน์มีตัวเกมสล็อตให้เลือกเล่นจำนวนมากบนมือถืออันดับ 1 ทั้งฟรีเครดิต 50 ,100 , 150 , 200 ที่สามารถ
raw feeding, dog Are you a cat or dog owner looking to maximize nourishment for your furry family members? As a pet parent, you naturally strive to provide your pets with the best lifestyle options available
ReplyDeletedog health
ReplyDeleteAre you a cat or dog owner looking to maximize nourishment for your furry family members? As a pet parent, you naturally strive to provide your pets with the best lifestyle options available.
Reviews Yard
ReplyDeleteAt Reviews Yard Blog, we are committed to creating unique and customized content for our users that is useful for detailed information. We focus on applied information and a range of topics that can impact users in different technology areas.
reviewsyard.org
ReplyDeleteAt Reviews Yard Blog, we are committed to creating unique and customized content for our users that is useful for detailed information. We focus on applied information and a range of topics that can impact users in different technology areas.
english tutoring toronto Build your English foundational skills - including reading, writing and critical analysis - in our private English tutoring program
ReplyDeletegogoanime
ReplyDeleteGogoAnime - Watch anime online in high quality for free. Watch anime subbed, anime dubbed online free. Update daily, fast streaming, no ads, no registration ...
Autoankauf Auf der Suche nach einem seriösen Autoankäufer in NRW sind Sie bei uns genau richtig. Wir garantieren Ihnen eine sichere und seriöse Abwicklung rund um den Autoankauf in NRW.
ReplyDeleteinstalateri Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
ReplyDeletenonton bokep online Bokep Indo, Bokep Barat, Bokep Asia, Bokep Gay, Bokep Semi.
ReplyDeleteThank you for oder my Gigs. Please share the details guide in the project
ReplyDeleteshaw internet plans
animekiss The best place to watch dub and sub anime online and absolitely for free - KissAnime. With over 10000 different animes - KissAnime is the best source for anime ...
ReplyDeletenzeta Thisare a private website offering our users online application services which include assistance with their application for Electronic Travel Authorization for travel to India.
ReplyDeleteglobalspoint Donec eleifend tortor a nibh dictum pellentesque. Donec congue turpis at commodo euismod.
ReplyDeleteseo
ReplyDeleteseo
ReplyDeleteseo
seo
seo
seo
seo
seo
seo
ReplyDeleteseo
seo
ReplyDeleteseo
ReplyDeletegoogle
ReplyDeleteseo
ReplyDeleteglobalspoint
ReplyDeleteglobalspoint
ReplyDelete