Introduction: Connected Christmas Tree Using Arduino and Temboo
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.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What Did I Used to Do This Instructable?
- 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)
- Arduino Software
- HC1632c library for Arduino: You can get it here with some explanation --> HT1632c Library
- Temboo library for Arduino which is already installed with the last update of Arduino. If you have an old version of Arduino, you may have to install Temboo librairy by yourself
- 1x account on the website Temboo.com
1x Gmail account
Step 2: Wiring
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.
Step 3: Temboo
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 :
- Select on the left menu : google/gmail/getUnreadMail
- Turn on the "IoT mode"
- Set up your hardware parameters (cf pic2)
- Enter your gmail adress and the associated application password
- 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
Step 4: Get the Code From Temboo
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 :
- Open the arduino software
- Copy the code located into the "Code" box of Temboo and paste it into a new Arduino project
- Create a new tab in Arduino and name it "TembooAccount.h"
- Copy the code located in the "Header" box
- Save everything
- Check the code
- 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.
Step 5: 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.