[Tutorial] Connect mbed to OGC SensorThings API - Part I

This is a simple tutorial of connecting ARM mbed LPC1768 to OGC SensorThings API.

The tutorial is divided into two parts. Part 1 will help you create SensorThings Datastream with the SensorUp SensorThings Playground. Part 2 will tell you how to use mbed to upload temperature readings to the Playground.

 

 

 

 

Tutorial Difficulty Level

 Starter

Our guest blogger is Kan Luo, a PhD student at the University of Calgary. Read the original post here.


Part I: Create SensorThings Datastream in SensorUp SensorThings API Playground




Register

First fill the register form, then click the Register button

 


 

Sign In

Next Sign In with your Email and password.

 


 

Welcome Page

Next, click the Start Guided Setup button on the welcome page.

Now you can start to create your first Datastream. It is quit easy and will only take a few minutes. 

 


 

Create Thing

A thing is an object of the physical world (physical things) or the information world (virtual things) that is capable of being identified and integrated into communication networks. [ITU-T Y.2060]

Add description of the thing in the Description formfor example, "my mbed". If you are using mbed to measure the room temperature of your living room, then you can also put "my living room" here, because your living room is your THING of interest.  Then click the Next button.

 


 

Create Location

Add description and coordinates of the location of the thing.

You can click the Use my location allowing your web browser to get your location at once. Or you can move the marker on the map to choose your favourite location.

Then click the Next button.

Tips: Your web browser will ask you wheather you would allow it to use your location. Please click Allow if you would like to share your location here.

 


 

Create Observed Property 

First, choose or add the property you are going to observe, and then add the Name, Definition, Description for the observed property. 

Then click the Next button.

Search existing observed properties: Here you can type in your keywords and it will show you the existing properties that someone added in the playground. You can choose one if you like. 

Or you can add a new one for yourself. 

Here I choose an existing one: air_temperature. 

Name: You can name it as anything you like. Here I name it air_temperature for simple. 

Definition: You can fill in the blank with a website to describe your observed property detailedly. And it will be fine if you give an nonexistent URL.

Description: You can add a description for your observed property.

 


 

Create Sensor

Now it's time to create the Sensor.  You can see Sensor as the metadata, providing contextual information for your IoT project. For example, it allows others to know the accuracy of the reading collected by this sensor.

Here I just proceed with the default values. And click the Next button.

Description: You can add a description for the observing Sensor.

Encoding type: It is the encoding type of the metadata property. For example, text/htmlapplication/jsonapplication/pdf

Metadata: Here you can add a website URL which can give a detailed description for the Sensor. As we are using the mbed application shield, here you can put text/html as the Encoding type and add the link to the application shield: https://www.sparkfun.com/products/11695

 


 

Create Datastream

Datastream is a collection of Observations. Here you should give a description of the Datastream. And then add the Unit of measurement. Unit of measurement is a set of operations having the object of determining the value of a quantity [OGC and ISO 19156:2011]

Description: You can add the description for the Datastream. For example, I put down "This datastream is measuring my living room temperature."

Observation type: Leave with the default values. 

Name: Here you can name the unit of Measurement. Because I am going to measure the temperature. So I name it degree Celsius.

Symbol: It shows the textual form of the unit symbol. You can add one for your unit of measurement. Here I am going to use °C.  

Definition: Here you should put a URI that defines the unit of Measurement. http://www.qudt.org is a great place to find the definition of your unit of measurement.  In this case, as the unit is celsius, the formal definition of celsius is http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#DegreeCelsius.

I know it looks troublesome that you need to put so much information here. But trust me, unit of measurement is very very important. Read these horror stories caused by wrong unit of measurement.

Then, click the Next button. 



 

Review

Now you are almost there. Here is the review of what we have done.

Click the Complete button and then the Playground will create the code for you automatically.

 


 

Check

Click the Show button to see the code. After checking all the code, you can click the Add Observations to Datastream button.

 


 

API Request

Take a note of the Datastream's ID and St-P-Access-Token that the Playground created for you. You will use them for the next step.

 


 

Congratulations!  You've successfully entered the required information.  Now you can proceed to Part II to connect your mbed to SensorThings!