Introduction: Cloud Connected Sensors With Arduino

Sensors that can connect to the cloud have all sorts of useful applications in systems that depend on easy or remote access to data. This tutorial will show you how to build an Internet of Things application that logs data from a temperature sensor and sends email alerts to specified individuals when the temperature falls outside an expected range. Although we chose to use a temperature sensor here, any type of sensor could be used in this connected application.

The app we're building is powered by Temboo and an Arduino Yún, but you can use other hardware like a Samsung ARTIK 10 if you'd prefer. It's also easy to mix and match web services for the app if, for example, you want to Tweet temperature updates, or send push notifications to your phone instead of emails when the temperature is too high or low. The video shows you how to build the connected temperature sensor, and how it works once it's all set up.

Step 1: Collect Your Materials

To build our connected sensor app, we'll need:

  • The sensor that we want to connect to the cloud (in this example, we're using a Texas Instruments LMT84LP temperature sensor)
  • An Arduino Yún
  • A solderless breadboard and some wires

We'll also need a Temboo account to generate the Arduino code that handles sending the email alerts. You can sign up for a free account here.

Step 2: Add an Email Address

Next, you'll want to head to Temboo and follow along with the steps listed for the connected sensor IoT application. This is because Temboo will store our API credentials as we create them, and then auto-populate them in the Arduino sketch we'll be using.

Save your email credentials in a Temboo Profile to include them in your Arduino sketch later. By storing the credentials in a Profile, we will make the credentials more secure by moving them off the board, decrease the memory required to run the Arduino sketch, and make it possible to remotely reprogram the sketch to use a different email address at any time.

Step 3: Set Up Your Alert

Now, we need to set up our email alert, along with the tokens that our application will use to handle it. First, configure the alert by saving the email address, port, and server that you are using to send the email, as well as the subject line that you want to use and the email address to which the alert will be sent. Then, save three tokens: one associated with the alert email address, another associated with the high temperature threshold that you want to use, and a third associated with the low temperature threshold.

Step 4: Create the Circuit

Now it's time to set up the sensor. Connect it to the Arduino's 3.3v power, ground, and analog 0 pins, as shown in the diagram. You may also wish to encase the sensor or your Yún in a protective layer if you are planning to use it in an environment that could damage exposed hardware (for example, in water).

Step 5: Run the Sketch

Since we saved all of our email and token information in Profiles, it has already been pre-populated in the Arduino sketch that has been generated by Temboo. Download the sketch from Temboo, paste it into the Arduino IDE along with the header file included in the download, and it should be ready to upload and run!