Introduction: Google Calendar Events to ESP8266

In this tutorial I wil explain how to import Google Calendar event data in Arduino IDE for the ESP8266 board. I will be importing the endtime and starting time of my training from Google Calendar and print them in the Arduino IDE serial monitor.

To achieve this we use Zapier to send the event data to an Adafruit feed. Then we read this feed in Arduino.

Step 1: Create New Feed in Adafruit

- Go to Adafruit.

- Create an account on Adafruit if you don’t already have one.

- On the homepage, go to Feeds > View all

- You're now on the feed page. To create a new feed click Actions > Create new feed

- For our project it will be called “training” Click on Create feed

Give your feed a simple and recognizable name.

- Open the feed we just created. It’s empty for now, but we will send data to it using Zapier.

Step 2: Make a Zap

- Go to Zapier

- Create an account if you don’t already have one.

We’re going to make a connection between Google Calendar and Adafruit. This is called a zap.

- on the homepage, Click on“make a Zap”

Step 3: Connect Google Calendar

Part one of the connection is Google calendar.

- Under Choose App select "Google Calendar"

- Under Choose Trigger Event select Select “Event Start”

This is the trigger that initiates the connection. "Event Start" is best for our purpose but you can choose whatever you want.

- Choose the google calendar account.

Step 4: Customize Google Calendar Event

- Choose the calendar from your account that you want to use.

It’s easiest to choose a writeable calendar, so you can add test appointments whenever you like.

- Choose the time before you want Zapier to trigger

It’s optional to add a Search Term. This will make sure Zapier only triggers on events with a certain name. If you don’t fill in a Search Term Zapier will trigger on every event in the calendar.

- Click "test and continue"

Step 5: Connect Adafruit

Part 2 of the connection is Adafruit.

- Under Choose App, search for "Adafruit IO" and select it.

- Under Choose Action Event select “Create Feed Data”

- Under “Choose account” log in using your Adafruit account.

Step 6: Customize Adafruit Feed Data

Now we’ve entered a section called Customize Feed Data.

- Under Feed Key, select “Use a Custom Value”

- Under “Custom Value for Feed Key” Enter the name of the feed you created in Adafruit.

In our case it was “training”

- Under “Value”, click on the add icon on the right of the text box.

- Select “1. Event begins: “ and “1. Event Ends:”.

Make sure to select them in this order for the sake of this code. Don’t leave a space between both blocks. Be sure not to select the "pretty" version. If you change the way the sketch handles the string feed you can use any formatting.

Step 7: Test Zap

We’ve entered all information and we can test our connection.

- Click on “Test & Continue”. Zapier will trigger a test event.

- Look in your Adafruit feed. You will see a test event by Zapier is added to your feed.

- Don't forget to turn on the zap in the top right corner in Zapier. It won't work if you don't do this.

Step 8: Arduino IDE: Config.h

- Plug your ESP8266 in your computer.

- Download the sketch on Github and open in Arduino IDE.

You're going to need to change some code in config.h

- Fill in your Adafruit Username

- Fill in your AIO Key.

You can find your AIO key in the top right corner in Adafruit.

Step 9: Arduino IDE: Read Adafruit Feed

- Open the main file.

- Add your username as the name of the feed owner.

- Add the name of your feed. In our case it was "training".

- Compile and upload sketch to your board.

- Once the code is uploaded, open the serial monitor.

- After the connection has been made you can see the data about an upcoming event!

Use the test in your Zap from step 7 to get a test event, or create an event in your Google Calendar if you don't see results. Keep in mind that we've set a trigger time in Zapier, so it won't trigger after creating an event, but x minutes before the event starts.

Step 10: Errors?

If the sketch doesn't compile:
- Check your board is plugged in

- Check Arduino IDE is setup for the right board.

- Check Arduino IDE is setup in the right port.

If the serial monitor doesn't look as shown above:

- Check if serial communication is set to 115200 baud (do this in the serial monitor).

- Check if customized the feed right in step 6.

- Check in Adafruit if you have data coming in from Zapier.

- Check if your Zap is turned on.

- Check if you spelled your feed name right in the code.

- Check if you've selected the right feed in Zapier.

If you never get the "adafruit IO Connected" message in the serial monitor:

- Check if you spelled your SSID, password, username and IO key right inconfig.

- Check if the router is on.

First Time Author Contest

Participated in the
First Time Author Contest