Introduction: 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


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.


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.

Automation Contest 2017

Participated in the
Automation Contest 2017

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017

First Time Author Contest

Participated in the
First Time Author Contest