Did you ever fail to notice that Google Calendar utterly important event? Not anymore with the Intel IoT Edison Google Calendar reminder!
In this instructable we'll configure step by step an Intel® Edison Arduino Board, so that it notifies you about upcoming events from your Google Calendar, by displaying the event summary and location on the Grove RGB LCD screen and even buzzing you a bit with the Grove Buzzer!
Actually, you could use the code presented here to schedule your Edison to do stuff based on your Google calendar. Eg turn the lights on/off, water the plants etc And you can change its schedule from everywhere, anytime, through Google Calendar!
I am thankful to Instructables and Intel for providing me the hardware used in this project (I was one of the 250 lucky ones!)
Step 1: What you'll need
Step 2: Google Calendar API
In order to access our google calendar data, we will make use of the Google Calendar API, in its current, third, iteration (v3). A prerequisite for using the API is having a Google Account (elementary, Watson), having created a project in the Google Developers Consoled and enabled the API.
You can find a guide on how to do all this here:
Step 3: Installing the Google API python client
This is a bit complicated: Our backend, that communicates with Google is written in Python. So, we have to install the Google API python client. And to do that, we first have to install the Python setuptools, that allow us to (quoting setuptools homepage) "easily download, build, install, upgrade, and uninstall Python packages".
The setuptools homepage can be found at
From a terminal connection to your edison, type:root@edison:~# wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | python - --user
This will install setuptools at /home/root/.local
We will now install the Google API python client from https://code.google.com/p/google-api-python-clien... by using setuptools' easy_install:root@edison:~# cd /tmp root@edison:/tmp# wget --no-check-certificate https://google-api-python-client.googlecode.com/fi... root@edison:/tmp# tar xzf google-api-python-client-1.2.tar.gzroot@edison:/tmp# cd ./google-api-python-client-1.2root@edison:/tmp/google-api-python-client-1.2# /home/root/.local/bin/easy_install --upgrade google-api-python-client
After that, and provided that everything went well and you didn't get any error messages, Google API python client should be installed in your Edison.
It's time to put our code to use!
Step 4: The Python part
Create a directory inside your /home/root directory, where you'll store the python code and your json API credentials. Copy the provided edison_google_calendar.py script to this directory (I named mine google_calendar, so I placed the files to /home/root/google_calendar) and also copy the client_secrets.json to the same directory.
If you don't know how to copy files, I suggest to install FileZilla ( https://filezilla-project.org/ ) and copy the files by establishing an SFTP connection to your Edison.
We can now run the script from the terminal:root@edison:~/google_calendar# python edison_google_calendar.py --noauth_local_webserver
The first time you run the script, google will ask for your authorization, by providing you a link. Copy this link to a browser in your PC, approve the access and copy the provided code to your terminal. The python script will continue accessing Google Calendar happily ever after!
You'll start seeing something like that in your terminal:Enter verification code: 4/6d1spJ8Bc5l555555555555L-c_LptGlO444444.0pqVaRXSayETyjz_MlCJoi0333333 Authentication successful. 2015-01-08T23:09:32Z ++++++++++++++++++++++++++ 2015-01-08T23:09:43Z ++++++++++++++++++++++++++ 2015-01-08T23:09:55Z ++++++++++++++++++++++++++ 2015-01-08T23:10:07Z ++++++++++++++++++++++++++
This means the python script is already running successfully. If you still feel unsure, do the following:
Step 5: The Arduino part
It's now time to upload our Arduino Edison part.
Create a folder in your sketchbook named edison_google_calendar and copy the two attached files to that folder:
text_reader.c contains the function readFile(), which reads the file /tmp/arduino.txt and returns its contents. If no file has been created yet, it returns null.
edison_google_calendar.ino is the main arduino sketch, responsible for showing the event on the Grove RGB LCD screen and buzzing the buzzer everytime a new event comes up. If you have no current appointment, it shuts down completely the RGB LCD screen to save energy:)
After copying the files to the edison_google_calendar folder, open the Arduino Edison IDE and open the edison_google_calendar.ino sketch. Check that it compiles and upload it to your Edison.
A green screen with the message "Hello Google Calendar!!!" will greet you. The Intel Edison Google Calendar reminder is up and running! Have fun by creating and deleting events at the your Google Calendar page. Your Edison will buzz with joy every time a new event becomes active!