Using an Arduino Yun, Temboo and Parse to make a temperature logger
I recently got my hands on one of the latest breed of Arduino boards - the Yún, so I decided to knock together a quick hack to log the temperature and display it using a webapp.
The Yún takes web connected projects to a whole new level due to the fact that it has onboard ethernet and wifi accessible via a dedicated Linux chip, providing more power to better handle data connections. The Yún is similar to an Arduino Leonardo which based on the ATmega32u4 processor with the addition of a separate chip running Linino (which is based on OpenWRT). The two chips communicate via an Arduino library called Bridge, which allows you to write familiar Arduino sketches, and also easily harness all of the extra power from the Linino chip. This makes consuming the web easier, and paves the way for a whole host of IoT applications.
The other great thing about the Yún is the integration with Temboo.
Temboo is a scalable, fault-tolerant environment for running and managing smart code snippets that we call Choreos. Choreos can call APIs, simplify the OAuth process, send email messages, perform encoding, update databases, and lots more.
The Yún includes two parts that make it easy to connect with hundreds of APIs from any sketch.
The first part is a small library called Temboo.cpp that comes bundled with the Arduino IDE. When this is included in sketches, it provides a unified way of connected to the APIs. The other part is a Python client that is bundled with the Linino base image that forwards request over HTTPS to the Temboo cloud service.
One of the hundreds of API integrations that Temboo have is with Parse.
Parse allows your team to focus more on creating a great user experience and forget server maintenance and complex infrastructure. Instantly add push notifications, data storage, social integration, and more the moment you integrate a Parse SDK into your app.
To read the temperature I used a DHT11 sensor. This was mounted on a shield, along with a WS2812 RGB LED to provide feedback. It flashes blue when data is being sent to Temboo. If the API call was successful, the led blinks green or red if an error was encountered.
Using Parse Data and the Create Object Choreo, it’s really easy to save data to Parse. I simply read the values from the DHT11 sensor and wrote those to Parse each hour. To get the data back out was a matter of using the Parse JS SDK and throwing together a few queries.
A sprinkle of Helvetica and iOS7 inspired design allowed me to create a simple web page to view and present the data. Sparklines was used to provide a graph of the last 5 hours of temperature readings.