Description

Introduction

The Internet of Things(IoT) is a system of ‘connected things’. The things generally comprise of an embedded operating system and an ability to communicate with the internet or with the neighboring things. One of the key elements of a generic IoT system that bridges the various ‘things’ is an IoT service. An interesting implication from the ‘things’ comprising the IoT systems is that the things by themselves cannot do anything. At a bare minimum, they should have an ability to connect to other ‘things’. But the real power of IoT is harnessed when the things connect to a ‘service’ either directly or via other ‘things’. In such systems, the service plays the role of an invisible manager by providing capabilities ranging from simple data collection and monitoring to complex data analytics. The below diagram illustrates where an IoT service fits in an IoT ecosystem:

One such IoT application platform that offers a wide variety of analysis, monitoring and counter-action capabilities is ‘ThingSpeak’. Let us consider ThingSpeak in detail.

What is ThingSpeak

ThingSpeak is a platform providing various services exclusively targeted for building IoT applications. It offers the capabilities of real-time data collection, visualizing the collected data in the form of charts, ability to create plugins and apps for collaborating with web services, social network and other APIs. We will consider each of these features in detail below.

The core element of ThingSpeak is a ‘ThingSpeak Channel’. A channel stores the data that we send to ThingSpeak and comprises of the below elements:

8 fields for storing data of any type - These can be used to store the data from a sensor or from an embedded device.

3 location fields - Can be used to store the latitude, longitude and the elevation. These are very useful for tracking a moving device.

1 status field - A short message to describe the data stored in the channel.

To use ThingSpeak, we need to signup and create a channel. Once we have a channel, we can send the data, allow ThingSpeak to process it and also retrieve the same. Let us start exploring ThingSpeak by signing up and setting up a channel.

Getting Started

This article is a beginners walk through of Developing an IoT framework for Arduino without Ethernet/WiFi shield using ThingSpeak Services with a real time Online Weather Station

Contents

1. Background

2. Hardware Setup

2.1 Configuring LM 35 with Arduino

2.2 Configuring LDR with Arduino

3. Getting Started With ThingSpeak

3.1 Creating Channel

3.2 Read and Write Data Operations In Channel

4. Configuring ThingSpeak With C#

4.1 Updating Data

4.2 Retriving Data

5. Updating ThingSpeak Channel with Arduino Data

6. Conclusion

ThingSpeak is a IoT cloud service provider. Embedded IoT devices like Arduino, Raspberry Pi can be connected to internet. These boards then can fetch data or upload data to ThingSpeak storage using APIs. The data stored by a device can be accessed by other client entities like Mobile, Tablet, laptop connected to internet using ThingSpeak APIs. So in short ThingSpeak is an IoT service provider that provides APIS to upload, retrive and visualize data from IoT devices over cloud.

Having learnt what ThingSpeak is, let us try to understand it in bit more detail. Basically when a Device like Arduino Yun, Intel Edison, Intel Gallileo, Raspberry Pi is connected to internet, they can access other nodes in the internet ( like Google, facebook or any other websites). But in order to exclusively connect these devices as Masters or servers from which other clients over Internet can fetch data needs a lot of networking setup which includes assigning unique IP address to nodes, setting up server and so on. An easy alternative to this problem is to deploy a middleware that can handle the communication. It acts like global message space for the device. Device takes command from the server, sends it's data to the server. Other nodes like a Mobile device can fetch data of the device from the server. Hence it does not require any exclusive networking protocols.

This is where IoT service providers comes handy. They provide easy and secured APIs for the devices to access the data from cloud. ThingSpeak is a great solution for IoT as it not only provides easy time stamped data access mechanism over cloud, but at the same time also integrates Social Network services. Thus generating a Social Notification ( like updating Facebook Status Message, Sending an Email, Publishing a tweet) based on an event ( like Gas leakage, Flood, Over Temperature or a timer event) becomes easier.

...

4. Configuring ThingSpeak With C#

4.1 Updating Data

The logic for calling ThingSpeak Update method for specific Channel is really very simple. Every channel will have independent API key for update method. All we need to do from our program is form an URL of the format:

http://api.thingspeak.com/update?

Now append key=YOUR_KEY_VALUE&field1=FIELD1_VALUE&FIELD2_VALUE

Once the URL is ready we can use HttpWebRequest to request the URl and Obtain the result using HttpWebResponse.

In order to make the method reusable and more generic I have created a Method by name UpdateThingSpeakData which takes parameters as a string array and the api key and returns the result as string.

Here goes our UpdateThingSpeakData method:

...

Finally, while this post is a few years old, I thought it still appropriate.

The Netduino Plus is an Atmel 32-bit microcontroller development board that includes on-board Ethernet and USB. You create firmware using the Microsoft .NET Micro Framework, Visual C#, and Microsoft Visual Studio IDE. The board also has the same header foot print as the Arduino, so the board makes use of the many Arduino Shields available.