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. 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!
Recent support of IFTTT for Spark will make this project even easier! Check this here: https://www.spark.io/ifttt
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:
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 Spark 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 Spark firmware (Arduino compatible) to physically control the LEDs. Just copy and paste the code provided below, in the Spark web IDE. Then compile and flash, no changes are required.
2: a bash script (an "always on" Linux PC or Raspberry Pi) to check email and send signals to the Spark Core. Run the script below on your machine (I recommend to launch it at startup).
You will need to insert your Spark device and Gmail account parameters in the 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 Gmail password is not stored in clear at all and the decoding password is not stored in the same file of the encoded Gmail 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 Spark 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 the Spark starting page: http://docs.spark.io/#step-3-connect-your-core-to-the-cloud
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)
UPDATE: I'm designing a new, slightly refined version of the case and I'm also planning to sell the fully assembled device.
You can find it here (assembled in Italy):http://www.snmodels.com/snshop/altri-prodotti/e-mail-watch
So let me know if you would like to build your own E-mail watch, I will give you further support!