Project tutorial

Connecting Anduino to IFTTT © Apache-2.0

Connect your anduinoWiFi to IFTTT. Control everything around you, or 'let go' and let random events in cyberspace control your surroundings!

  • 14,525 views
  • 0 comments
  • 11 respects

Components and supplies

Apps and online services

About this project

Motivation

The Arduino, and most popular DIY embedded solutions for that matter are usually great at one of two things; Communicating with sensors and discrete pieces of hardware, or running complex or interpreted code and connecting to third party services (APIs). Balancing power consumption, processing capabilities, and storage will always offer tradeoffs. This usually lands us choosing between Raspberry Pi or Arduino.

Raspberry Pi and embedded Linux grants you the opportunity to easily integrate third party libraries and implementations to utilize, say a Java SDK to connect to AWS. Although things can get tricky when it comes time to speak to the DHT22 temperature sensor that's pushing readings to your S3 bucket.

With Arduino, instead of having to wrap Python, on top of C, and having no real great way to guarantee consistent timing for readings; You can easily communicate to the sensor on the Arduino using the "bit-banged" proprietary protocol and less than 200 lines of code. Not to mention you'll be hard pressed to get your Arduino MKR1000 to draw 750ma of current to get the job done.

In an ideal world you'd have:

  • Low power consumption
  • Simple/close to the hardware, real time sensor integration
  • 3rd party API connectivity and TLS security

Finding a single hardware device that fulfills all these requirements is inevitably going to initiate some compromises. I might argue that a true, complete solution, would actually include both an Arduino style embedded device and an embedded Linux machine working together. But when you've only got your Arduino Due and anduinoWiFi shield there's still a great way to get connected to the wonderfully diverse world of open API's out in the wild.

Enter, IFTTT (If This... Then That). This write up is all about getting your anduinoWiFi speaking to any of the services (applets) available. Imagine:

All of these ideas are totally possible with only a WiFi101 connected Arduino. In a recent project write up we saw how easy it is to connect Arduino to Adafruit IO using anduinoWiFi. Adafruit IO is going to be our gateway to IFTTT. So essentially, by publishing/subscribing to feeds using MQTT (just like we did here) we'll be able to communicate with any applet on IFTTT.

Getting Started

We're going to jump right into IFTTT and assume that you've already tried the 'Anduino Speaks Adafruit' project and are completely fluent in Adafruit IO, Adafruit MQTT, feeds, etc. If not, take a quick detour and come back in 20 minutes. Assuming you've just confirmed your sensor readings in the Adafruit IO dashboard what's next? Let's hop on over to IFTTT and get these sensor readings streaming to Google Docs.

So you've signed up for IFTTT and your ready to create your first applet. Applets are what IFTTT calls the little logic widgets that control what happens 'if this' event occurs. Click '+ this':

And you're greeted with a long list possibilities! In this first applet we're going to send data from our Arduino to Google Docs. So:

IF our Arduino has a 'temperature reading' log that reading in a google spreadsheet'.

Using MQTT we've already published our latest reading in a feed on Adafruit IO, so next we need to get that feed speaking to Google. Search for Adafruit and select:

'Any new data'. This way, anytime our 'Temperature' feed receives new data, we'll send it over to Google.

Now we get to select our 'trigger' and complete the 'that' portion of our logic.

Search for Google, select Google Drive, and then, 'Add row to spreadsheet'. (If this is your first time using the Google Drive applets you'll be prompted to authenticate using your google account):

The applet pre-populates with variables representing our feed, values, etc...

Don't worry about creating the spreadsheet first, this applet will create one for you named 'adafruit_io_Temperature'. (Or whatever you type in the first field.) Each row in our spreadsheet will contain our temperature value and the timestamp it was created.

That's it! Just like we had planned earlier...

IF our Arduino has a 'temperature reading' log that reading in a google spreadsheet'.

Let's see it in action!

Anduino --> IFTTT!

We've just received our first temperature reading from our Arduino on /bcarbon1/feeds/Temperature:

At the same time if we check our Google Drive:

We even received a push notification (requires d/l of the IFTTT app on your iOS/Android phone) to let us know the new published reading.

That's it! We've just laid the groundwork for easily connecting your Arduino to just about any API out there.

What's next?

What about using a third party app as a 'trigger' to control something on our Arduino? Bi-directional communication is totally possible. Keep an eye out for more anduino projects where we'll show just how easy it is to subscribe to feed data using MQTT and actuate something in your environment using the Arduino. Can't wait to see what you create using IFTTT, Adafruit IO, and anduinoWiFi!

Code

Anduino
An Arduino library for the Andium(Anduino) shield. Transform your Arduino into an AndiumNode.
Adafruit MQTT
Arduino library for MQTT support

Comments

Similar projects you might like

Thirsty Tweeting Office Plants

Project tutorial by Brian Carbonette

  • 5,955 views
  • 10 comments
  • 28 respects

Anduino Speaks Adafruit!

Project tutorial by Brian Carbonette

  • 3,007 views
  • 1 comment
  • 5 respects

Arduino RFID Keycard Access

Project tutorial by Brian Carbonette

  • 11,856 views
  • 1 comment
  • 25 respects

NFC Color Changer

Project tutorial by Brian Carbonette

  • 1,229 views
  • 0 comments
  • 3 respects

Measuring CO2 Levels aka "The Sleepiness Multiplier"

Project tutorial by Brian Carbonette

  • 5,958 views
  • 8 comments
  • 16 respects

IoT Gauge with Arduino, Yaler & IFTTT

Project tutorial by Thomas Amberg

  • 5,246 views
  • 8 comments
  • 25 respects
Add projectSign up / Login