Do you have to interact with your devices from the Internet? or from a mobile phone? Tired of building web servers in small microcontrollers only for switching some relays, leds, or controlling a servo? Tired of using platforms where you need to build and submit complete HTTP requests to post data to the Internet? Bored of parsing JSON or XML in your devices? If you have answered to some of this questions to yes, this is your platform, and you can start testing it in https://thinger.io. Just request a beta access key to start connecting your devices.

As a maker and developer, I started connecting things to the internet some years ago. There were not many alternatives to providing fast, easy, and cheap connectivity to our devices, and we were tied to some specific and expensive modules. Nowadays we can find several cheap alternatives, like TI CC3200, and ESP8266, and the tend is to have any device or sensor connected somehow to the Internet (you all know the Internet of Things).

In this transition I started to look the way of connecting things to the Internet, in the way the devices or sensors can be managed remotely (actuating and sensing), or transmitting information or alarms to third party services, mobile phones, push notifications, and so on. I found that there are several alternatives from different vendors to provide closed clouds for the connection (mainly for interoperate with their custom hardware), and some open source initiatives. None of them fits in he idea I have about how a device should be connected to the Internet, mainly from the point of the developer. I get scared when I look at some code examples in different platforms just for turning on and of a led from the internet, or for sending a temperature report. I see tons of platforms relying in the same old idea of making HTTP request to a cloud platform.... or parsing a bunch of JSON data or strings for just discover what is the command to run with their parameters. Who loves working and programming with this platforms and libraries? Not me! (not to mention the poor performance in terms on power and traffic consumption).

In this way, I started to think in different ways of interaction. Something easier for the developers, so doing simple things do not become a nightmare. Something that is compatible with practically any hardware, from small microcontrollers like Arduinos, to devices with more capabilities like Intel Edison or Raspberry Pi. And of course, something that can become an open source platform. This way born the https://thinger.io platform.

At this moment I have been working so hard in the server side (creating a fully C++ ASIO server from scratch), creating some client libraries for the platform (for Arduinos, ESP8266, Raspberry Pi, Intel Edison, etc), defining and creating the encoding protocol between the devices and the server (named as protoson), and creating a frontend so the users can manage and handle their devices easily. Some of this code is already available in Github, but I am in the process of opening the platform in an alpha state to some users... So this is just the beginning on building a open source platform for the IoT.


Here you have two short videos that illustrates the current functioning of the thinger.io platform. The first video is a full example of connecting a ESP8266 device (Node MCU) to the platform for reading a DHT11 sensor from the Internet. The whole process does not requires more than 4 minutes, including registering the device, compiling and uploading the sketch, and interacting with the device from the Internet. It demonstrates how easy is to define new resources in the device and how to interact with them from the Internet.

The second one is a TL;DW example of controlling a led from the Internet using an Arduino Nano with the Adafruit CC3000. You can see more details in the second video.


The thinger.io platform is composed by two different parts at this moment. The first one is the backend, that is a multithreaded server fully written in C++ using modern C++11 code with ASIO techniques for ensuring maximum performance. Using C++ allows consuming much less resources on the cloud infrastructure, which will provide better scaling required in the IoT domain. The server handles all the things connections, providing authentication, and communication. All the devices resources can be accessed from a REST API. The server provides both TCP and TLS connections to the devices, and communicates with them using protoson, a encoding protocol specifically designed in this project for microcontrollers and devices with small memory capabilities. The protoson can be directly transcoded to and from JSON, so all the data transfer from/to the devices through the REST API interface is done in JSON. This ensures saving communication bandwidth in the devices side while allowing maximum interoperability with external clients like webs or mobile devices. The server provides also some interconnection capabilities to the devices, like sending emails, doing HTTP/HTTPS requests, enabling Websockets and Server Side Events for streaming device data, integrating with IFTTT Maker Channel, Keen.io, and so on.


The second part are the client libraries that are compiled in the devices to allow exposing them to the Internet. The libraries have been designed thinking in microcontrollers, so they can be compiled both on small microcontrollers like Arduinos, and more powerful devices like ESP8266, Raspberry Pi, Intel Edison, etc. All the code is in C++, so it can be compiled in almost every platform. At this moment, the libraries have been tested with Arduino Nano + CC3000, ESP8266, Texas Instruments CC3200, Raspberry Pi, Intel Edison, Arduino Yun, Arduino Ethernet, and some other linux distributions. Those libraries are already available for the Arduino ecosystem through the Library Manager, so connecting devices is so easy. The libraries use the already mentioned protoson encoding for the communications with the server, which reduces memory and bandwidth requirements compared to other encodings techniques like JSON, XML or string parsing. The client libraries also allows calling configurable endpoints in the cloud infrastructure for sending emails, sending HTTP/HTTPS request, and so on. You can take a look to this project example that sends an email when a plant requires water. You can see also in this project how to configure some parameters on the device, like the hysteresis time, enabling/disabling the led alarm and so on.

Here you have a simple example for exposing some device resources with input/output parameters for a ESP8266 device that you can compile and upload directly from the Arduino IDE:

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerWifi.h>

#define USERNAME "your_user_name"
#define DEVICE_ID "your_device_id"
#define DEVICE_CREDENTIAL "your_device_credential"

#define SSID "your_wifi_ssid"
#define SSID_PASSWORD "your_wifi_ssid_password"

ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

void setup() {
  pinMode(BUILTIN_LED, OUTPUT);

  thing.add_wifi(SSID, SSID_PASSWORD);

  // resource input example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
  thing["led"] << [](pson& in){ digitalWrite(BUILTIN_LED, in ? LOW : HIGH); };

  // resource output example (i.e. reading a sensor value)
  thing["millis"] >> [](pson& out){ out = millis(); };

  // resource input/output example (i.e. passing input values and do some calculations)
  thing["in_out"] = [](pson& in, pson& out){
      out["sum"] = (long)in["value1"] + (long)in["value2"];
      out["mult"] = (long)in["value1"] * (long)in["value2"];
  };
}

void loop() {
  thing.handle();
}

This project is supported by some open source libraries:

  1. Boost (Boost License)
  2. Crypto++ (Boost License)
  3. Nlohmann JSON (MIT License)
  4. GeoIP (LGPL License)
  5. Protoson (MIT License)
  6. OpenSSL (License)
  7. Jemalloc (BSD-derive License)
  8. Mongo CXX Driver (Apache License)