This is the second tutorial of this series on Cayenne, the first ever drag and drop Internet of Things (IoT) platform. It teaches you how to quickly develop IoT applications using Arduino Yún.

In this tutorial you are going to develop a simple Temperature Monitoring System using Arduino Yún and Cayenne.

Learning Objectives

At the end of this tutorial you will be able to:

  • Read and display data from temperature sensor on dashboard in Cayenne

Hardware

Note: If the model of Arduino that you are using comes with built-in WiFi capabilities then you do not need a separate WiFi Shield.

  • Arduino Yún
  • Temperature Sensor (TMP36)
  • Breadboard
  • Jumper Cables

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Software

Circuit

Step 1: Make sure your Arduino is not connected to a power source.

Step 2: Using jumper cables connect power (VNC) and ground (GND) ports on Arduino to power (+) and ground (-) ports on breadboard.

Tip: It is a good practice to use red jumper cable for power (+ / VNC) and black jumper cable for ground (- / GND).

Step 3: Now that your breadboard has a power source, using jumper cables connect power (+) and ground (-) ports of your breadboard to power and ground ports of the TMP36 sensor.

Step 4: To read temperature values, you will need to connect a jumper cable from signal port (usually middle port) of TMP36 sensor to A0 (Analog) port of your Arduino.

Your circuit is now complete and it should look similar to the figure below.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Cayenne Setup

Step 1: Login to Cayenne.

Step 2: From Dashboard click on Add new… link.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Step 3: Expand Sensors, then select Temperature and TMP36 as shown in the figure below.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Step 4: As shown in figure above enter settings of your sensor.

Note: Selection in Connectivity dropdown depends on the type of sensor you are using. You have three options in this case Digital, Analog and Virtual. Virtual reads analog data and according to the selected sensor converts value into correct format. For example TMP36 will return data in voltage, so you will need to write a formula to calculate correct value. Choosing Virtual simply does that for you.

Step 5: Click on Sketch button and copy the code.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Step 6: Start your Arduino IDE, paste the code in a new file and compile. Make sure the virtual port in code is V0 since your temperature sensor is connected to A0.

Note: During compilation the default code for Arduino Yún was throwing an error, so code was slightly modified to #include <YunClient.h>.

Step 7: Click on Step 2: Add Sensor button.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Step 8: Your temperature sensor will show up on the dashboard.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Step 9: Upload the code to your Arduino device and then switch back to dashboard, within a few seconds dashboard will start showing your sensor readings. These readings automatically get updated, you do not have to write any special code.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Step 10: Cayenne provides you with a few different options to view sensor data on dashboard. Click the gear icon on top-right of your sensor and select Settings.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Step 11: From Settings screen you have the option to change the widget.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Step 12: Choose Line Chart and Save the Settings. Dashboard will update to show sensor readings in a line chart. There are a few other widgets available as well, and we will try those in upcoming tutorials.

CodifyThings - Getting Started with Cayenne Internet of Things (IoT)

Next Steps

In the next tutorial we are going to develop a Soil Moisture Monitoring System using Arduino and Cayenne.