Connected Christmas Tree Using Arduino and Temboo

by guillaumemarion in Living > Christmas

1707 Views, 13 Favorites, 0 Comments

Connected Christmas Tree Using Arduino and Temboo

IMG_20150103_164429.jpg
B5ibAgvIgAAMKTm.jpg

I own an ethernet shield for my arduino board for a while and I wanted to do something with it. As there is a hype around the internet of things, i decided to create a connected christmas tree. But the question was : how a Christmas Tree can be connected? At the same time, I consider as important to disconnect from its email box during the time spent with its family. I found a way to solve theses two goals with this instructable!
The number of unread emails in my gmail inbox is got by the ethernet shield using the Temboo library (which helps you to communicate with a lot of APIs). Then, the arduino board draws a Christmas Tree on a 16x32 LED matrix. The number of red LED is equal to the number of unread emails. The more I don't read my emails, the more the Tree will be decorated!

It shouldn't be really hard to adapt this instructable to a real Christmas wreath. If you succeed to do it, I would be glad to see the result!

This is my first Instructable. Your comments are highly welcomed in order to improve it or correct mistakes.

What Did I Used to Do This Instructable?

SapinDuino_eclate_bb.png
HC1632_SE.jpg
HT1632C_back.png

Hardware :

  • 1x arduino board (in my case a Mega ADK but it should works with other boards)
  • 1x ethernet shield + 1 ethernet cable
  • 6x cables
  • 1x Led Matrix HC1632c (On the diagrams the LED matrix is only represented by its connector)

Software :

Wiring

SapinDuino_bb.png

The wiring is probably not the hardest part of this instructable. All you have to do is to plug the ethernet shield on the arduino and then, the LED matrix to the ethernet shield using the wires.
Note that the pins on which you connect the HT1632c Led matrix are not really important as long as it is coherent with the arduino code that you will write in the next step.

Temboo

Temboo.png
Temboo_Shield.png

First, you need to activate the two-steps authentication on your Gmail account in order to let Temboo comunicate with the Gmail API (It is explained here) Then, you need to generate an "application password" (more informations about it)

Then, you can go on www.temboo.com create an account if needed and log in.

Follow the next steps which are shown on the picture :

  1. Select on the left menu : google/gmail/getUnreadMail
  2. Turn on the "IoT mode"
  3. Set up your hardware parameters (cf pic2)
  4. Enter your gmail adress and the associated application password
  5. You can now clic on the "Run" button to test the API.

The "run" button is here to test the API. If you can't get the correct number of unread emails the problem can be related to the username and password you set for your gmail account. Don't go further if you can't get the correct result with the "run" button

Get the Code From Temboo

Temboo_code.png

As it was explained in the previous step, Temboo automatically generates a code for your arduino. So, the first thing you'll need to do is to copy/paste this code in two files :

  1. Open the arduino software
  2. Copy the code located into the "Code" box of Temboo and paste it into a new Arduino project
  3. Create a new tab in Arduino and name it "TembooAccount.h"
  4. Copy the code located in the "Header" box
  5. Save everything
  6. Check the code
  7. If you don't have any errors in your code, you can upload it to the arduino.

Once you have uploaded the code given by Temboo on your arduino, check if it works correctly with the serial monitor. It can helps to detect connectivity problem with your local network or with your ethernet shield. Do not hesitate to copy/paste the error log in google to find if someone had the same problem.

Customize the Code

At this step it is assumed that the default Temboo code is working and that the HT1632c library is correctly installed.

I modified the code given by Temboo to get the number of unread emails in order to light up a corresponding number of LEDs in red.

In the arduino code, the comments beginning by "// -->" are mine and not related to Temboo. It should help you to understand what I modified.

Downloads