The aim of this project is automatically checking emails and showing the presence of new messages with different LED colors corresponding to different Gmail labels (or any IMAP folders). The final product is a USB powered, WiFi connected, 3d printed small box with beautifully colored LEDs. You can place it anywhere there is a WiFi signal, and check your mailbox with a glance!Updates:New Python script works with any IMAP mail server (with folders)!
Run it on Raspberry Pi or any always-online machine. It uses secure authentication and low bandwidth "IDLE" mode. Look for the code below.
Also, recent support of IFTTT for Particle will make this project even easier! Check this here: https://docs.particle.io/
Here is an example of architecture, using a Raspberry Pi to check your email and send notifications to the Spark Core living inside the E-mail watch. The Raspberry Pi can be replaced by any "always on" system.
And here is a list of what you will need:Hardware components
Assembling the hardware parts is fast and easy. Thanks to the breadboard no soldering is required and you are always free to modify or upgrade the design by adding LEDs, sensors, etc. The microUSB cable is provided with the Particle board.
See the Hardware section for full list.
Assembly steps (see figure below):
- Insert the Spark board on the breadboard (observe alignment)
- Insert the RGB LED (4 pins in 4 columns)
- Insert the yellow LED (positive leg in D0)
- Connect RGB LED legs to pins A4, A5, A6 and GROUND with the 3 resistors and wire
- Connect yellow LED legs to pin D0 and GROUND with the resistor (LED leg in my case) and wire
- Cover the breadboard with the 3d printed case, make sure that the LEDs fit well into the holes
1: the Particle firmware (Arduino compatible) to physically control the LEDs. Just copy and paste the code provided below, in the Particle web IDE. Then compile and flash, no changes are required.
2a: the new Python script (recommended), connecting to any IMAP mail server and listening for any changes to update your E-mail Watch.
- or -
2b: a bash script (for an "always on" Linux PC or Raspberry Pi) to check email and send signals to the Particle Core/Photon. Run the script below on your machine (I recommend to launch it at startup).
You will need to insert your Particle device and (G)mail account parameters in the Python (or bash) script. Please note that we prefer to avoid keeping the Gmail account and password in clear, in the same file, thus we will provide an encoded password to the script and decode it at run-time. In this way your (G)mail password is not stored in clear at all and the decoding password is not stored in the same file as the encoded (G)mail password.
Check the Software section for full details.
In this example we have 4 different Gmail labels (Bank, Personal, Social, Notification) and 1 special category (Star). Each label corresponds to a different color of the RGB LED (blue, green, purple, cyan). The special category is indicated by the star-shaped, yellow LED. In addition, the RGB led becomes red in case of problems with your Gmail account (wrong password, network issues, etc.) and becomes yellow in case no information is received from the bash script for some time (watchdog).
The embedded blue LED (right side of the box) indicates the Particle cloud connection (single blink=connected) and the script correct activity (double blink=script active).
The pulsing (hidden under the cloud symbol) multicolor LED meaning is described on Particle tutorial page: https://docs.particle.io/
Finally a short clip showing the real behavior:
- wifi connection (green blink)
- cloud connection (cyan blink/pulse)
- initial LED test (all LEDs on)
- cloud connected (solid blue LED under the microUSB plug)
- waiting for updates (solid yellow LED)
- new messages (green=personal, blue=bank, purple=social)
- new starred message (yellow star LED)
The top left LED intensity increases proportionally with the number of new messages (for each category).
That's it! (Comments are very welcome)
Let me know if you would like to build your own E-mail watch, I will give you further support!