3 reasons to use thethings.iO IoT platform

Every company that wants to be successful in the Internet of Things realm have a lot to do. One of the most crucial part is the IoT platform. Some of the key questions when building an IoT product are: Should I build my own IOT platform? should I use an IaaS as an IoT platform? or should I work with an existing IoT platform ready to go?

thethings.iO IoT platform

thethings.iO IoT platform

The answer is, don’t reinvent the wheel and keep IoT simple! We strongly recommend to use an existing IoT platform. At thethings.iO, we will be very happy to listen about your IoT use case or project and showcase you how does it look a tailored IoT platform for your product and customers with thethings.iO technology. And the most important part, making your life much easier for less!

Here find the main 3 reasons to use thethings.iO as the IoT platform our your connected product, if you are building an Internet of Things product.

IoT platform

IoT platform

1) The IoT platform working from the very first minute

thethings.iO IoT platform is the simplest IoT platform in the market. We know that launching a connected product is hard but it should not be complex to store data, monitor the data with flexible IoT dashboards and analyze the data from your devices and customers.

thethings.iO is a complete IoT platform solution that works literally in minutes. By working with thethings.iO, we save your time building your own IoT platform and maintaining it, with a fix cost. At thethings.iO we offer scalability, flexibility and security since you connect your first pilot until your production product is scaling to millions.

IoT Dashboards

IoT Dashboards

2) Customizable IoT dashboards

At thethings.iO, our customers and users can access to the data from any sensor, anytime anywhere. Historical data or real-time streams are pushed to thethings.iO panel. With unlimited API requests and data storage included, thethings.iO provides beautiful historical charts and real-time charts that you need to monitor and control your products.

thething.iO provides customizable and flexible dashboards to our customers. The IoT dashboards enable customers to visualize insights from the Big Data, we provide aggregations and KPIs, revealing trends or even detecting anomalies. Some of the features most used are the predictive maintenance, assets management or understanding the final customers usage of the connected products (churn, ROI, etc).

All of these data showed with a flexible dashboard and amazing widgets under the brand of our customers (logos, colors and URLs) makes thethings.iO one of the mot flexible and beautiful IoT platform in the market.

IoT Analytics

IoT Analytics

3)Cloud Code ready with deep analytics

As we are working with massive amount of data from the devices connected to thethings.iO, we have built a tool with enough flexibility to apply Big Data and Analytics algorithms on the top of the data in real-time or every some time (hours, days, etc), this is Cloud Code.

At thethings.iO Cloud Code feature you can work oriented to events with Triggers and get real-time alerts every time that any of your things send data. Configurable in just few clicks on or enjoying the power to code all what you need, thethings.iO offers this flexibility to non-technical managers or developers. The main goal of triggers is to get an instant alert when special conditions appears (e.g. temperature is too low, device is our of a virtual fence, button is pushed, among other).

The cloud code also offers Jobs which are algorithms executed every hour or every day. The aim of Jobs are providing a such powerful tool that enable technical people to aggregate data, summarizing the data, revealing trends, and detecting anomalies through Big Data algorithms such as predictive maintenance or artificial intelligence algorithms.

thethings.iO is ready to rock

Today thethings.iO is an IoT platform company operating on several verticals of the Internet of Things with a lot of experience on the industry, logistics and connected home use cases. We have close relationship with engineering companies, telcos and app developers to understand how to build end-to-end solutions.

All in one, thethings.iO IoT platform is the right place for every company seeking the best IoT platform and IoT dashboards to use with their networked products. Our main goal is to build the most simple IoT platform, so thethings.iO IoT platform is very easy and intuitive to use, and technical support is always available. You get your things connected quickly and easy with most of the IoT protocols such as HTTP, MQTT, CoAP, ModBus and Websockets.

So, why wait? There are a lot of advantages of a state of the art IoT platform waiting for you at thethings.iO.

Connect STMicroelectronics boards to thethings.iO

Today, we’re gonna show you how to connect your STMicroelectronics board with thethings.iO. At this post we are going to connect exactly STMicroelectronics Discovery-F746NG board to take advantage of the mbed platform.

STMicroelectronics & thethings.iO

STMicroelectronics & thethings.iO

The STMicroelectronics Discovery-F746NG is a development kit board of the ST32F7 series of microcontrollers based on ARM Cortex-M7 processor. The board brings a microcontroller with 1MB of flash memory and 340KB of RAM connected with a 4.3 inches 480×272 TFT with capacitive touch screen. It brings Ethernet connectivity for Internet and for example Arduino UNO connectors. One of the most interesting part for this demo is that this board support mbed IDE.

thethings.iO-stm32f746ng

We decided to connect it to the Internet with thethings.iO to build a functional pilot for a customer.

How to connect STMicroelectronics Discovery-F746NG to thethings.iO

In order to connect with thethings.iO IoT platform, we’re going to need a thingToken to identify our board with the IoT platform and the business logic on the top. Find here the instructions to make it happen:

    1. Login or Register to thethings.iO (or quickly register here).
    2. If you already have a thing to work with, skip two steps. Navigate to Things (third row on the left)  and click on “Create new IoT product”. Insert a name, choose 8266 as the board and JSON as the format.

thethingsio-things-manager

  1. Click on the created product and click on “Get activation codes”. If you don’t have enough activation codes, generate more using “Genereate Activation Codes”. Now press on the “+” below “Activate” Row and copy the thing Token.

Making the firmware at the mbed platform

One of the interesting parts of this board is the use of the mbed platform that simplifies a lot the way to deploy new firmware on the board.

    1. Navigate to mbed developers site and login (or signup if you don’t have an account).

thethings.iO-mbed-login

    1. Click the  “Compiler” button. This link will redirect you to the mbed online compiler.thethings.iO-mbed-compiler
    2. A floating window will emerge, asking for a platform to work with. Select your board (DISCO-F746NG).
    3. On the top part of the mbed online compiler, click on Import.

 

  1. Press “Click here to import from URL”.

thethingsio-mbedcompiler-import

  1. Insert the following link: 
    1. For the HTTP version https://developer.mbed.org/users/charlyo/code/thethingsiO-DISCO_F746NG-http/
    2. For the MQTT version https://developer.mbed.org/users/charlyo/code/thethingsiO-DISCO_F746NG-mqtt/
  • The program is going to be imported into your workspace. Remember to change the TOKEN define with your thing token.
  • Connect the board to the computer: Connect both ST-LINK (mini USB) and FS (micro USB) to the computer. A new drive unit is going to appear in your computer:

thethings-usb-disco_f746ng

  • Click on compile. After compile is done, download the file into the USB disk that appeared when you connected the board to the computer.
  • The code is going to be flashed into the board and executed afterwards on the board.

thethings-io-stm-demo-crop

thethings.iO STMicroelectronics library

Once we know how to program the STMicroelectronics board with ARM mbed platform. It’s time to build a code that send the sensors’ data to thethings.iO. Find thethings.iO IoT platform STMicroelectronics library at our github account for HTTP and MQTT, with an example for each.

This is the library that connects the STMicroelectronics board to thethings.iO with HTTP. It have 4 basic calls to thethings.iO API: activate, read, readAll and write.



#include "ThethingsiO_DISCO_F746NG.h"

ThethingsiO_DISCO_F746NG::ThethingsiO_DISCO_F746NG()
{
    this->interface.init();
    this->interface.connect();
    this->buffer = network::Buffer(1024);
}

ThethingsiO_DISCO_F746NG::ThethingsiO_DISCO_F746NG(string token)
{
    this->interface.init();
    this->interface.connect();
    this->thingToken = token;
    this->buffer = network::Buffer(1024);
}

ThethingsiO_DISCO_F746NG::~ThethingsiO_DISCO_F746NG()
{

}

string ThethingsiO_DISCO_F746NG::thingReadAll(int limit)
{
    std::string request("GET /v2/things/");
    request.append(thingToken);
    request.append("/all_resources?limit=");
    stringstream convert;
    convert << limit;
    request.append(convert.str());
    request.append(" HTTP/1.1\r\nHost: %s\r\nUser-Agent: curl/7.43.0\r\nAccept: application/json\r\n\r\n");
    if (socket.open() < 0) {
        printf("Failed to open TCP Socket\n\r");
        return "Failed to open TCP Socket\n\r";
    }
    if (socket.connect("api.devices.thethings.io", 80) < 0) {
        printf("Failed to connect with thethings.iO\n\r");
        return "Failed to connect with thethings.iO\n\r";
    }
    if (socket.write((void *)request.data(), request.size()) < 0) { printf("Failed to write HTTP request\n\r"); return "Failed to write HTTP request\n\r"; } int result = this->socket.read(buffer);
    //printf("Received %d bytes:\n\r%s\n\r", string string string string string string string int result, (char *)buffer.data());
    string response = string((char*)buffer.data()).substr(string((char*)buffer.data()).find("\r\n\r\n"));
    buffer.flush();
    socket.close();
    return response;
}

string ThethingsiO_DISCO_F746NG::thingRead(string resource, int limit)
{
    std::string request("GET /v2/things/");
    request.append(thingToken);
    request.append("/resources/");
    request.append(resource);
    request.append("?limit=");
    stringstream convert;
    convert << limit;
    request.append(convert.str());
    request.append(" HTTP/1.1\r\nHost: %s\r\nUser-Agent: curl/7.43.0\r\nAccept: application/json\r\n\r\n");
    if (socket.open() < 0) {
        printf("Failed to open TCP Socket\n\r");
        return "Failed to open TCP Socket\n\r";
    }

    if (socket.connect("api.devices.thethings.io", 80) < 0) {
        printf("Failed to connect with thethings.iO\n\r");
        return "Failed to connect with thethings.iO\n\r";
    }

    if (socket.write((void *)request.data(), request.size()) < 0) { printf("Failed to write HTTP request\n\r"); return "Failed to write HTTP request\n\r"; } int result = this->socket.read(this->buffer);
    //printf("Received %d bytes:\n\r%s\n\r", string string string string string string string int result, (char *)buffer.data());
    string response = string((char*)this->buffer.data()).substr(string((char*)this->buffer.data()).find("\r\n\r\n"));
    this->buffer.flush();
    socket.close();
    return response;
}

int ThethingsiO_DISCO_F746NG::thingWrite(string resource, string value)
{
    string body;
    body.append("{\"values\":[{\"key\":\"");
    body.append(resource);
    body.append("\",\"value\":\"");
    body.append(value);
    body.append("\"}]}");
    std::string writerequest("POST /v2/things/");
    writerequest.append(thingToken);
    writerequest.append(" HTTP/1.1\r\nHost: %s\r\nUser-Agent: curl/7.43.0\r\nAccept: application/json\r\nContent-Type: application/json\r\nContent-Length: ");
    stringstream convert;
    convert << body.length();
    writerequest.append(convert.str());
    writerequest.append("\r\n\r\n");
    writerequest.append(body);
    writerequest.append("\r\n");
    if (socket.open() < 0) {
        printf("Failed to open TCP Socket\n\r");
        return -1;
    }
    if (socket.connect("api.devices.thethings.io", 80) < 0) {
        printf("Failed to connect with thethings.iO\n\r");
        return -1;
    }
    if (socket.write((void *)writerequest.data(), writerequest.size()) < 0) { printf("Failed to connect with thethings.iO\n\r"); return -1; } int result = socket.read(buffer); //printf("Received %d bytes:\n\r%s\n\r", string string string string string string string int result, (char *)buffer.data()); string response = string((char *) buffer.data()); //printf("%s\n", (char *) buffer.data()); int ret = response.find("status:created"); buffer.flush(); socket.close(); if (ret >= 0) return 0;
    else return -1;
}

string ThethingsiO_DISCO_F746NG::thingActivate(string activationCode)
{
    string body;
    body.append("{\"activationCode\":\"");
    body.append(activationCode);
    body.append("\"}");
    std::string writerequest("POST /v2/things/");
    writerequest.append(" HTTP/1.1\r\nHost: %s\r\nUser-Agent: curl/7.43.0\r\nAccept: application/json\r\nContent-Type: application/json\r\nContent-Length: ");
    stringstream convert;
    convert << body.length();
    writerequest.append(convert.str());
    writerequest.append("\r\n\r\n");
    writerequest.append(body);
    writerequest.append("\r\n");
    if (socket.open() < 0) {
        printf("Failed to open TCP Socket\n\r");
        return "Failed to open TCP Socket\n\r";
    }
    if (socket.connect("api.devices.thethings.io", 80) < 0) {
        printf("Failed to connect with thethings.iO\n\r");
        return "Failed to connect with thethings.iO\n\r";
    }
    if (socket.write((void *)writerequest.data(), writerequest.size()) < 0) { printf("Failed to write HTTP request\n\r"); return "Failed to write HTTP request\n\r"; } int result = socket.read(buffer); //printf("Received %d bytes:\n\r%s\n\r", string string string string string string string int result, (char *)buffer.data()); string response = string((char *) buffer.data()); response = response.substr(response.find("\r\n\r\n")); buffer.flush(); socket.close(); //string string string int result = "{\"status\":\"created\",\"message\":\"thing activated\",\"thingToken\":\"5RWZ6xFogVSJEla3b2gbToHGF1Ko-R8vTNoS3FMl8mM\"}" return response; } string ThethingsiO_DISCO_F746NG::getToken() { return this->thingToken;
}

void ThethingsiO_DISCO_F746NG::setToken(string token)
{
    this->thingToken = token;
}

Try it and let us know how do you connect your STMicroelectronics board to thethings.iO. We are going to publish your example at our github and at thethings.iO blog.

How to visualize your SCADA diagram at thethings.iO in 3 steps

Imagine you have a number of different Internet-connected devices that fit together within one system. This could be a plant with humidity, light and pH sensors or, on a larger scale, a connected home system with numerous connected devices or a factory where you can monitor and control the valves, faucets, among others. The possibilities are endless, but either way, these instances can all be easily monitored through the use of a SCADA diagram.

A SCADA (Supervisory Control and Data Acquisition) diagram allows you to create a visual representation of your system’s processes and monitor them in a unique, dynamic diagram. Created in the ’60s, SCADA systems have evolved as one of the most important representational systems for industrial and infrastructure processes.

And now you can create your own SCADA diagram on thethings.iO dashboard! By the way, this is just the first version of the SCADA diagrams at thethings.iO dashboard, so we will update them soon. Follow these three simple steps to make a customized SCADA diagram.

Step 1: Go to the Dashboard and Create a Widget

Before you can start making your own SCADA chart, you need to sign up at thethings.iO and connect a device! If you already have an account and a connected thing, all you need to do is to log in. If not, click here to learn how to connect your first thing in 6 simple steps.

Once you are logged in, you will see a “meter” icon on the left-side navigation panel; this represents your customizable dashboard. Go to the dashboard and select the “Edit Dashboard” button in the top right corner. Now you can edit all your widgets and organize them any way that you prefer.

Scroll down until you see the “Add a new widget!” container and click the “Add Widget” button. A window will pop up in which you must type the name of your widget. Select the “Scada Control” option from the Data Source drop-down menu and click “Add” to create the widget.

Step 2: Adding Your Own Image

Now that you have created the widget, it’s time to personalize it with an image of your system! Scroll to the SCADA widget that you made in the last step and click the “Select Image” button. Upload your desired picture and resize the widget to fit your preference.

Step 3: Tagging Things on Your SCADA diagram

Once you have the image of your system uploaded, you must place your things on it! For example, I will be placing a “light” icon over the location of the lamp in the house diagram. You will place the things you want to monitor in their correct locations on your own image.

To do this, click the “Tag Thing” button on the right side of your widget. Hover the crosshair mouse over the location you want to tag and click. Select the Product, Thing and Resource of the item that you are trying to represent. Next, select an icon to represent your thing. You can choose from specific icons like a microphone or a car, or opt for a more general icon like a circle.

The final step to tagging your things is the optional Color Management feature. Here you can choose to change the color of your icon based on its last sent data value. A certain color can be applied to either a range of data values or one specific value. This feature makes the monitoring of your connected devices especially easy. With only a glance you can tell the status of your things.

Click the “+” button to add as many color management options as you desire and then click “Add Thing” to finish tagging your thing. Continue tagging different things until all the ones you wish to show are displayed on the SCADA diagram.

After you have tagged all your things you are finished! Click the “Save Dashboard” button and view your new SCADA chart in action! You can even click each icon to view a list of the last values along with the date.

Got an IoT product you need to connect? Head over to the simplest IoT platform on the market and sign up now.

thethings.iO September’16 Fresh New Features!

At thethings.iO we are constantly learning from our customers to improve our IoT platform. At thethings.iO we use a software continuous delivery, that means, that when we have a new feature we deploy it immediately (after unit testing and other). Yesterday, because of the specific features that we deployed we had to schedule a maintenance outage.

We are glad to announce that yesterday we delivered these next 3 great new features:

Users Management

Create users and grant access to developers, testers and people from your organization to the dashboard. Grant different permissions to the users depending of their role. The users will be able Read, Read&Write or Administrate the account.

iot-users-manager-thethingsio

Activation Codes By Product

One of the most requested features used to be the possibility to move acquired Activation Codes among products. Since yesterday that was not possible. We have improved the Activation Codes and made the way you provision the new things more dynamic.

First of all, now you can share Activation Codes among products and we also open the possibility to have an Activation Code that activates multiple things. That means that now, with only one activation code for product, you are able to activate as many thing things as you need.

Apps Management

We improved the Applications Manager user interface. Now, using the new Application scope, it’s possible to define in a better and easy way how your Apps will interact with thethings.iO.

iot-app-scope-thethingsio

One more thing

Yesterday we also published our status page!

Status Page

We created the status page https://status.thethings.io where you can check the status of all our services, the average of the response time and a board of incidences.

iot-status-page-thethingsio

At thethings.iO we are building the simplest IoT platform in the market for several verticals such as Industry 4.0, Agriculture, Logistics or Connected Home. Feel free to contact us for more information.

Connect the ESP8266-V12 Wemos to thethings.iO

One of our favorite WiFi device is the ESP8266. After explaining how to connect ESP8266 v1 to the IoT platform thethings.iO, here we would like to explain how to connect ESP8266 v12 or WEMOS to thethings.iO. In this case we are working on a Wemos D1 Mini.

Wemos esp8266v12

Wemos esp8266v12

We decided to work in some projects with the Wemos D1 Mini (that brings the esp8266 v12) because they work great. For less than 5$ you get a very powerful SOC (System On Chip) of 32 bits at 160MHz with RAM and EEPROM plus the WiFi. Just to tell you more information about the Wemos, this is a WiFi board based on the microcontroller ESP8266EX and it brings 11 digital pins and 1 analog input. The digital pins are input and output pins with support of interrupt, i2c and pwm. The analog input support a maximum of 3.2V input. The Wemos is compatible with Arduino and nodemcu.

Wemos D1 Mini

Wemos D1 Mini

Today we’re going to connect the ESP8266 v12 (a wemos) to thethings.iO using MQTT protocol and the Arduino language.

Let’s get started!

  1. Create a thing to work with:
    1. Login to thethings.iO (or quickly register here).
    2. If you already have a thing to work with, skip two steps. Navigate to Things (third row on the left)  and click on “Create new IoT product”. Insert a name, choose 8266 as the board and JSON as the format.

      thethings-create-product

    3. Click on the created product and click on “Get activation codes”. If you don’t have enough activation codes, generate more using “Genereate Activation Codes”. Now press on the “+” below “Activate” Row and copy the thing Token.

      thethings-activate-code

  2. Installing the esp8266 libraries for the Arduino IDE:
    1. Make sure you have the latest Arduino (check here). Install it in your computer.
    2. Open Arduino and navigate to preferences.
    3. Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager’field. You can add multiple URLs, separating them with commas.

      thethings-preferences-arduino

    4. Open Boards Manager from Tools > Board menu and install esp8266 platform (and don’t forget to select your ESP8266 board from Tools > Board menu after installation).

      thethings-install-board

  3. Uploading the code to the board:
    1. Clone or download the code from our repo. Link here. First read the README to understand how to use the addValue and send calls.
    2. 
      #include 
      #include 
      
      // Update these with values suitable for your network.
      
      const char* ssid = "SSID";
      const char* password = "PASSWORD";
      const char* mqtt_server = "mqtt.thethings.io";
      
      #define TOKEN "YOURTOKEN"
      
      String topic = "v2/things/" + String(TOKEN);
      
      WiFiClient espClient;
      PubSubClient client(espClient);
      long lastMsg = 0;
      
      int cont = 0;
      
      String msg ="{\"values\":[";
      
      void addValue(String key, String value) {
          if (cont == 0) msg += "{\"key\":\""+key+"\",\"value\":\""+value+"\"}";
          else msg +=",{\"key\":\""+key+"\",\"value\":\""+value+"\"}";
          cont++;
      }
      
      void addValue(String key, int value) {
          if (cont == 0) msg += "{\"key\":\""+key+"\",\"value\":\""+value+"\"}";
          else msg += ",{\"key\":\""+key+"\",\"value\":\""+value+"\"}";
          cont++;
      }
      
      void addValue(String key, float value) {
          if (cont == 0) msg += "{\"key\":\""+key+"\",\"value\":\""+value+"\"}";
          else msg += ",{\"key\":\""+key+"\",\"value\":\""+value+"\"}";
          cont++;
      }
      
      void send() {
          msg += "]}";
          client.publish((char*)topic.c_str(),(char*)msg.c_str());
          msg = "{\"values\":[";
          cont = 0;
      }
      
      void setup() {
        pinMode(BUILTIN_LED, OUTPUT);     // Initialize the BUILTIN_LED pin as an output
        Serial.begin(115200);
        setup_wifi();
        client.setServer(mqtt_server, 1883);
        client.setCallback(callback);
      }
      
      void setup_wifi() {
      
        delay(10);
        // We start by connecting to a WiFi network
        Serial.println();
        Serial.print("Connecting to ");
        Serial.println(ssid);
      
        WiFi.begin(ssid, password);
      
        while (WiFi.status() != WL_CONNECTED) {
          delay(500);
          Serial.print(".");
        }
      
        Serial.println("");
        Serial.println("WiFi connected");
        Serial.println("IP address: ");
        Serial.println(WiFi.localIP());
      }
      
      void callback(char* topic, byte* payload, unsigned int length) {
        Serial.print("Message arrived [");
        Serial.print(topic);
        Serial.print("] ");
        for (int i = 0; i < length; i++) {
          Serial.print((char)payload[i]);
        }
        Serial.println();
      }
      
      void reconnect() {
        // Loop until we're reconnected
        while (!client.connected()) {
          Serial.print("Attempting MQTT connection...");
          // Attempt to connect
          if (client.connect("ESP8266Client")) {
            Serial.println("connected");
            client.subscribe((char*)topic.c_str());
          } else {
            Serial.print("failed, rc=");
            Serial.print(client.state());
            Serial.println(" try again in 5 seconds");
            // Wait 5 seconds before retrying
            delay(5000);
          }
        }
      }
      void loop() {
      
        if (!client.connected()) {
          reconnect();
        }
        client.loop();
        long now = millis();
        if (now - lastMsg > 2000) {
          lastMsg = now;
          addValue("value", (int)random(1,5));
          send();
        }
      }
      
    3. Connect the board to the computer and select your esp8266 board inside “Tools” > “Board”. Also don’t forget to select the proper port.
    4. Change “YOURTOKEN”, “SSID” and “PASSWORD” with your credentials.
    5. Flash the code.

Now you are ready to build a dashboard with the IoT platform thethings.iO and store, visualize and analyze all the data from your Wemos in real-time.

IoT platform dashboard

IoT platform dashboard

If you work with ESP8266 or Wemos, you need an IoT platform. Don’t hesitate to try thethings.iO and keep us updated with your projects.

Developing Android app with the thethings.iO

Last week we explained how to create Apps and IoT dashboards from thethings.iO, this week its time to build real mobile apps connected to an App Id. Because most of thethings.iO IoT platform customers do not only make a connected product, but also build mobile applications. Mobile apps are useful to let final customers access to the data generated by the connected products and even interact with them, all with a great UX. iOS and Android are the predominant operating systems at the moment, so we built some simple examples on Android and iOS in order to show to our customers what they need to connect their mobile app with thethings.iO.

Developing Android app with thethings.iO

Developing Android app with thethings.iO

We designed an Android application in order to show you how all thethings.iO’s API calls work from Android SDK. From the user registration and login to the link thing or read and write. All the useful API calls that any Android developer need to connect a mobile app with the IoT platform thethings.iO in few minutes.

Find below a step by step guide about how to use the Android app available at our github repo thethings.iO-android-app . Having said that, remember to have Android Studio installed on your computer.

  1. Building the app:
    1. Open Android Studio
    2. Choose “Check out project form Version Control”. Select Git from the list. Paste the previous github link.thethings-project-checkout
    3. Select the directory and press clone. Maybe will need to install some dependencies (toolkit 21).
  2. Creating an app from thethings.iO
    1. Login (or quickly register here) to your thethings.iO account.
    2. Navigate to Apps (fourth row of the menu) and click on “Create new IoT application”.thethings-app-manager
    3. Select the name and press “Create”. Remember to copy and paste your app-id. You’ll need it later.
  3. Choosing app permisions
    1. Navigate to the product you want to share with the app (third row of the menu).
    2. Click on “Product details”.thethings-resource-permisions
    3. Write the name of the resources that will be available in the app (each one followed by a space).
  4. Clone thethings.iO Android app on your local repository and launch it
    1. The first display will request some of the basic credentials. Fill your login credentials (inside “Account setup”): Username, password, app-id and the thing-Id you want to interact with.thethings-app-credentials
    2. Press “Api Calls”.
    3. If it’s the first time you use the app, click on “Register”. If it’s not, click on Login. The user will be logged in the app details (at thethings.iO).thethings-app-options
    4. Press “Link thing” to start using the specified thing.
    5. Use the rest of the options at your will.

This Android app shows you all the API calls that you need to connect Android with thethings.iO. If you need more help, please post a message on thethings.iO developers forum and we will solve it ASAP.

thethings.iO API calls for mobile apps

There is a long documentation on thethings.iO developer portal to build mobile app for IoT with thethings.iO. Find here the most important API calls that you can call through HTTP, MQTT, CoAP or Websockets from iOS, Android or whatever mobile OS that you are using.

Register

The first call is to Register a user at thethings.iO IoT Platform. This endpoint also login the user (returns the session token and roles), so you don’t have to do another API call to login the user.

POST https://api.thethings.io/v2/register

curl -i -H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"email": "YOUR EMAIL HERE", "password": "a hard to guess password", "app": "The appID given in the panel"}' \
-X POST "https://api.thethings.io/v2/register" -k

Login

Here you can Login a user on your app through thethings.iO IoT Platform. This API call returns the session token and roles. Roles identifies the resources and things that the user has authorized the App to access.

POST https://api.thethings.io/v2/login

curl -i -H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"email": "YOUR EMAIL HERE", "password": "a hard to guess password", "app": "The appID given in the panel"}' \
-X POST "https://api.thethings.io/v2/login" -k

Link Thing

This is one of the most important API calls because it joins a user and a thing. That means that it’s a procedure that entitles the owner of a thing.

This procedure needs a thingToken (or the thingId) and a sessionToken of the user (after log in or register). And it requires some kind of direct communication between the mobile app and the thing.

For example, when setting up for first time a thing with WiFi, you usually have to configure the WiFi for the thing. That means that the thing generates a hotpsot, the app connects to that WiFi and the user (after login or registration through the app) introduces the WiFi’ SSID and WiFi’s password. The thing gets the information and get connected to the Internet. At this moment the thing call the API activate and receives the thingToken of the thing. With this thingToken, the App will be able to do the REST call to link the think to the user and store the relation at the platform. The other possibility is to send the sessionToken of the user (after log in or registration) during the WiFi configuration (sending the SSID + WiFi password and the sessionToken).

Note that in order to link the thing the user must be logged in and the thing must be activated (i.e. have a thingToken)

This operation can only be done for applications which have been authorized for the thing developer, this kind of apps are called official apps.

POST https://api.thethings.io/v2/me/things


curl -i -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: { {SESSION TOKEN} }" \
-d '{"thingToken": "{ {thingToken} }"}' \
-X POST "https://api.thethings.io/v2/me/things" -k

Find all the documentation about how to make a mobile app connected to the IoT platform thethings.iO at the developers site.

Today we explained a step by step to build an Android app connected with your things at thethings.iO. Feel free to use our Android app on thethings.iO’s github account. Don’t waste your time and create and account at the most simple IoT platform in the market.

Create an App and IoT dashboard with thethings.iO

Most of the Internet of Things devices bring applications with them. Most of the user experience behind these device live at the mobile applications or websites precisely designed to manage, control and interact with the connected thing. At thethings.iO we know what that means and that’s the reason why you can manage all of your apps through thethings.iO panel.

Apps & thethings.iO

Apps & thethings.iO

One of the features that are “hidden” for FREE users are the IoT apps or how we internally call it, the custom dashboards for users. This feature is only available for Enterprise customers and it is one of the most used by our clients.

Custom IoT dashboards for users

Firstly, we call Apps an interface (mobile app, website, thethings.iO dashboard or API) that have access to a subset of data or subset of machines. Technically an App has an AppId that is needed to be included on the login or register of the users. Any App and user’s App can be managed through the Apps Manager at thethings.iO.

The custom IoT dashboard, it’s a kind of an App that thethings.iO supports. That means that the App or the IoT dashboard can access to the data of the things that are “linked” to this App. Moreover, you can create apps and IoT dashboards under your own brand (colors, logos, etc) and under your URL for your own users. We learnt that users wants that buys a connected product from a specific brand don’t want to go to an application or dashboard from a third party company, they want to perceive that everything belong to you.

How to create an app or IoT dashboard

Let me tell you an example of an IoT dashboard for Cisco that we built some time ago to manage some devices connected to Cisco. In that case, the admin of the account had a login and password on their own custom brand. Remember that custom brand your panel is an Enterprise feature, contact us in case your would like to see a demo with your own brand.

Login page Custom IoT Dashboard

Login page Custom IoT Dashboard

Then we go to the App icon and click “Create new IoT application“. Here if you want to develop only a mobile app click on App button. Nevertheless if you also want to offer a dashboard for your users, click on App + Dashboard.

Create an App and IoT dashboard with thethings.iO

Create an App and IoT dashboard with thethings.iO

Now it’s time to introduce not only the name of the app, but also the subdomain where the users will introduce as URL to log in at the dashboard. For example http://iot-panel.cisco.com.

Next step is to define the App Details.

App details of a custom IoT dashboard @ thethings.iO

App details of a custom IoT dashboard @ thethings.iO

At the App Details, first of all you need to manage all the permissions of the App. What products does the App have access? What things from the app? What resources from the things? Any tag to take into account? The App has access to KPIs from the organization? or KPIs generated through cloud code? These are some of the permissions that you need to manage when create an App.

Edit permissions App Details @ thethings.iO

Edit permissions App Details @ thethings.iO

On the other hand, if you build a mobile app connected to your things you need to manage the permissions and copy the App Id and paste it in the code of your mobile Application. If you want to build a dashboard for your users, then you need to click on Edit Dashboard after editing the permissions.

Edit custom IoT dashboard for users with thethings.iO

Edit custom IoT dashboard for users with thethings.iO

Next step is to invite users to the App through the “Add user” button on the App Details and let them enjoy the user experience of your products with thethings.iO. Once you invite a user they will receive an e-mail customized with your message with their login and password to your IoT dashboard. Check here an example.

E-mail sample of an invitation to an IoT dashboard powered by thethings.iO

E-mail sample of an invitation to an IoT dashboard powered by thethings.iO

From now the users can access to the dashboard design by you to them, under your brand and URL and powered by thethings.iO, so you don’t need to think about the cloud.

Remember, to create a custom IoT dashboard, of course you need to create an App at thethings.iO under your custom brand panel. That means, that you need to become an Enterprise customer before you create that App (under your subdomains and look&feel).

It’s time to start using the most simple IoT platform in the market, don’t waste your time and sign up at thethings.iO and start making cool things and don’t worry about the IoT platform.

thethings.iO Texas Instruments Library

We are happy to announce the release of the library for the Texas Instruments Launchpads!! With this library it just got really easy to connect these devices to thethings.iO. And it is available for the open source IDE “Energia” as well as for “Code Composer Studio”! The first one was tested on the CC3200 launchpad and on the MSP-EXP432P401R Launchpad with the CC3100 booster and the second one was tested on the CC3200 launchpad.

So, let’s get right to it! Here, we assume that you have already worked with the launchpads. If you want more examples or a more step by step introduction, soon we we will publish more detailed tutorials. You can find our API reference at github.com.

Step 1: Create a product at thethings.iO

1.1 Get an account at thethings.iO

If you already have an account you can skip this step.

  • Go to thethings.io.
  • In the upper right corner click on ‘Start now’.

thethings

  • Register.

1.2 Create your first product

  • In your account, at the sidebar on the left click on ‘Things’.
  • Then click on ‘Create New Product’ and you will see the following screen:

new_product

  • Fill out the name of your new product.
  • For ‘Board’ choose ‘Other’.
  • If you want, you can add a description.
  • We will leave the format at JSON.
  • Leave ‘Opendata’ unmarked.
  • Click on ‘Create’.

1.3 Activate your thing!

  • Click on your new product.
  • In the ‘Things’ section click on ‘Get activation codes’.
  • Then click on ‘Generate Activation Codes’.
  • You will be asked how many activation codes you need, leave it at 1 and click ‘Generate’.
  • Then click on the ‘+’ sign on the right side.
  • A window will open, click on ‘Accept’.

Congratulations! You have just activated your first thing on thethings.iO!

ENERGIA

Step 2: Try an example from the library

2.1 Download and extract the library

download

  • Extract the downloaded archive and copy the folder ‘thethingsiO_energia’ to C:\Users\[your user name]\Documents\Energia\libraries\

2.2 Open and edit the example

In this step we will try an example that generates random numbers and sends them to our thing at  thethings.IO.

  • Open Energia and select ‘Open…’ from the ‘File’ menu
  • Navigate to C:\Users\[your user name]\Documents\Energia\libraries\thethingsiO_energia\examples and select ‘send_random’
  • A window will pop up telling you that the file ‘send_random.ino’ needs to be inside a sketch folder and asking you if it should create the folder and move the file for you.
  • Click ‘Ok’ (It will actually move the file, so you will “lose” the original if you don’t copy it back).
  • In line 11, put the name of your network (SSID).
  • In line 13, put the password of your network.
  • Next, we need to know our token.
  • Enter into your account at thethings.iO
  • Go to your things by clicking on ‘Things’ at the left sidepane:

tut_cc3200_energia_things

  • Then click on the thing that you created in step 1.
  • Now you can see your Thing Token.
  • Put that token in line 8 of our example code.

2.3 Execute the example

Upload the sketch to your launchpad!

2.4 See the random numbers arriving at thethings.iO!

  • Log into your account at thethings.iO
  • Click on ‘Things’ at the left sidepanel.
  • Click on the thing you created at step 1.
  • Click on ‘Details’ of the token you copied in the code:

details_token

  • In the resource section, choose ‘random’:

choose_resource

  • Then click on ‘Real-time’…

realtime-1

  • And see the random numbers arriving!

random_arriving

CODE COMPOSER STUDIO

Step 2: Try an example from the library

In this step we will execute an example provided by the library that sends random numbers to thethings.iO.

2.1 Download the library

download-1

2.2 Import the example as a project

  • Unpack the zip folder you just downloaded.
  • Open Code Composer Studio
  • Then select ‘Project’ -> ‘Import CSS Projects…’ from the menu.
  • In the window that opens, mark ‘Select Archive File’ and click on ‘Browse’:

sel_arch

  • Go to the folder thethings.iO-TexasInstruments-library-master you just unpacked
  • And navigate to the thethingsiO_css -> examples -> send_random_ttiO
  • Select ‘send_random_ti_css.zip’ and click on ‘Open’.
  • ‘send_random_ttiO’ should appear as discovered project.
  • Select it and click on ‘Finish’.

2.3 Execute the example

The example we just imported, generates random numbers and sends them to thethings.iO. We only have to change one line in order to make it work:

  • In Code Composer Studio, go to the Project Explorer and select ‘send_random_ttio’ so that it is marked as ‘[Active – Release]’.
  • Next thing, we need to know our token.
  • Enter into your account at thethings.io.
  • Go to your things by clicking on ‘Things’ at the left sidepane:

tut_cc3200_energia_things-1

  • Then click on the thing that you created in step 1.
  • Now you can see your Thing Token.
  • After that, open the main file and copy your token in line 41.
  • Save the changes
  • Debug the application clicking on the debug icon:

debug

  • Execute the application by  pressing the execute (or F8) button to execute the application:

execute

2.4 See random numbers arriving at thethings.iO!

  • Log into your account at thethings.iO
  • Click on ‘Things’ at the left sidepane.
  • Click on the thing you created at step 2.
  • Click on ‘Details’ of the token you copied in the code:

details_token

  • In the resource section, choose ‘random’:

choose_resource-1

  • Then click on ‘Real-time’…

realtime-iot

  • And see the random numbers arriving!

random_arriving_iot

Get Creative!

Congratulations!! You just set up your launchpad with thethings.iO! Now it is time for you to make your ideas reality. You can use the thethings.iO library and change one of the examples or start from scratch. You can find our API reference at github.com. Happy coding!