Automating Household Devices With Google Calendar

[Shane] is building a new house and wants some, “subtle home automation” as he calls it. His first project is hooking up a small heater to the Internet, and judging from his demo video everything is going swimmingly.

[Shane]’s project is built around an mbed microcontroller that connects to the Internet via an Ethernet connection. The mbed has a temperature controller and a solid state relay to turn the heater on an off; simple enough, but we really like how easily [Shane] connected his project to Google Calendar.

After looking over the Google API, [Shane] was understandably overwhelmed. He figured out that by syncing the mbed’s clock to network time and sending a GET request for one minute in the future, the mbed would always know what was scheduled with a minimal delay.

Now, all [Shane] does to turn on his heater is schedule a time and temperature in Google Calendar. He can do this from across the globe or country and makes for a really slick part of a home automation system.

14 thoughts on “Automating Household Devices With Google Calendar

  1. I would love to see the code he used for this, I use gcal that runs a cronjob to control my sprinkler system, I’d like to get it all running off of a microcontroller at some point, but I’m logging everything to a database and doing other things like checking temperature/forecast to see if it’s going to rain tomorrow as well. So I guess I’ll put that on the backburner.

    1. Hey Jamen,

      I’ll post the code on the the blog in the next day or so, just need to tidy it up.

      Re: your sprinkler idea, I’ve already got an mbed doing this. It checks the forecasts and the local rainfall (from a neighbour’s web connected weather station up the road) and determines how long to run the sprinklers for. I was going to write that one up and submit it next week. Race ya! ;)
      One thing I wanted to add was to delay a watering if the wind speed is too high because it gets very windy here and the other day it turned on and washed my car rather than watered the garden.


  2. “He figured out that by syncing the mbed’s clock to network time and sending a GET request for one minute in the future”

    That sounds “optimal”.. 1h buffer?

    1. 2 reasons why I poll the API every 30 seconds rather than buffering it in blocks:
      1. I’m not a very good C programmer and this way is easier
      2. I wanted it to respond to changes of the temperature and schedule immediately.

  3. I love the project, but this sadly falls into the category of ‘cloud based misadventure’ when it goes pear-shaped.

    Client-Server and Socket based remoting have been around for years, but are still dependent on the hosts lawyers, and the guy that fixes your cable or telephone jack for it’s reliability. Not where I’d be putting all my eggs.

    P.S I do the same thing – using an extra calendar on my Outlook client.

    For non-critical activities – like watering the garden on odd occasions or filling the dog bowl for a couple of days – fine, but remember the fundamentals behind ‘CLOUD’ ase ‘Centralized Lock On User Data’… and ‘SOCKETS’… ‘Some Other Controller Knows Every Thing Said’…

  4. very cool – i just started work on my arduino based home automation system, though when i get around to the task scheduling i’ll probably have my automation server look at a local whole house email/calendar server instead of the cloud. I love using google services, but having the schedule for everything that happens in my house accessible to google staff is not exactly something i’d want.

  5. I stumbled on this article while looking how to query Google Calendar for a heater too. Very happy I found this. At least I’m not the only one who had that idea. Good job Shane!

  6. Hello Shane,
    I am doin the same project on ARM CORTEX M3. Can I use the code done by you.Its really urgent for me.What about the header(.h) files. Expecting a favour from you.Please help me go through my final year project.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.