Introduction: Intel IoT Edison Google Calendar Reminder
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
- Intel® Edison Arduino Board
- Grove Starter Kit Plus V2.0
- Having successfully installed the Arduino IDE on your computer, updated to the latest Yocto Image and a working terminal connection to the board. For a detailed how-to, you can check my other instructable https://www.instructables.com/id/Touch-me-Edison-b...
- The Grove RGB LCD should be connected to one of the I2C ports of the Grove shield. The Grove Buzzer should be connected to port D6 of the Grove shield (the photos shown here were made before I connected the buzzer!)
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:
- you create a new project here:
- With the new project created, you create a new client ID (by pressing the respective blue button). On the window that appears, you select the last option, namely "installed application" (or something similar, google insisted on not showing me the menus in english) You then proceed to fill-in a form with your new project name etc (don't put much effort in this, it's not important for our purposes) After that, in "installed application type" select "other" and create the client ID
- You should now see the client-id, the client-key and some URIs. Ignore those, and press the button underneath: "Download JSON". Store the downloaded JSON file as client_secrets.json Remember where you put it, because later we will copy that to our Edison!
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-certificatehttps://google-api-python-client.googlecode.com/fi...
root@edison:/tmp#tar xzf google-api-python-client-1.2.tar.gz
root@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:
- Ensure that an event is currently active at your Google Calendar
- Press Ctrl+C to interrupt the script
- in the terminal, type # cat /tmp/arduino.txt
- You should see your active event details, something like:
root@edison:~/google_calendar# cat /tmp/arduino.txt Brunch with Holly Tiffany's OK
- Remember to restart the edison_google_calendar.py script!
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!