Gmail API Triggered Flag

2.0K233

Intro: Gmail API Triggered Flag

"Mail Man" is a simple arduino based gmail notifier. It leverages the gmail api along with arduino serial communication to allow the arduino to control a servo and hence wave a gmail flag when a new message is received.

STEP 1: Items for This Project

You will need the following items for this project:

  1. An Arduino. ( I used an Arduino Uno)
  2. A small micro servo
  3. 3D printed flag.

STEP 2: Flag

3D print the flag using the attached stl file. The servo from adafruit will come with 2 small screws that can be used to lock the flag onto the servo hand.

STEP 3: Code

Python

This project will use a python script to make calls to the gmail api and an arduino scrip that will activate the servo. The python script will recognize whether a new email has been received by comparing the most recently stored email_id (an identifier used by the api to differentiate emails). The script will make this check every three seconds. If a new message is received, there will be a discrepancy between the email_id stored and a message will be sent to the arduino to trigger the servo.

Arduino

The arduino will be listening on at a baud of 9600. If a new message is received, it will rotate the servo.

please refer to this git repo for code - Notification Code

STEP 4: That's It


Once the code is setup as mentioned in the repo, you should be good to go.

Think of creative ways of fastening the servo to your machine. I 3d printed a small hook (it is imperfect) and taped the servo to it. The hook is used to hang the servo on my screen.

Enhancement ideas.

  • Package the arduino and servo in a small box.
  • run a cron job to run the python script
  • try using google apps script.
  • use a raspberry pi instead of an arduino.

3 Comments

It would be better if could stay straight still because if you are out and leave the PC opened you will see it from far that you have received a mail, this project(im not saying it is bad i really like it and well done to you because you think about it and you must know that i vote it for both challenges)but this project is only if you ARE at the computer so you can see it go up and down :) Good job again!!!

Thanks for the suggestions. Will try and make a version with a raspberry pi or phone

This is so cool!! im going to make one too. like today!