IoT Technologies and its support in Sofia2


IoT technologies make it easy to connect all kinds of things to the network and develop applications to control and manage these “things”. All the complexities of enabling connectivity, services, and deployment for these devices is the task of the IoT platform.

An IoT platform ensures integration with different hardware devices supporting a wide range of communication protocols. Through the integration interfaces provided by the platform, you can also manage the IoT data collected to specific systems for data visualization, data storage, as well as transmitting data to connected devices (configuration, notifications) or between them (controls, events ).

IoT platforms are also known as IoT Middleware, which underlines its functional role as mediator between hardware and application layers.

Let’s see an IoT flow and the components involved:


Sofia2 supports each and every one of the modules in the previous diagram as follows:


         Generic IoT Platform                                  Sofia2 IoT Platform

p2                 thingssofia2

We understand Things as any device that is capable of sending data, whether sensors, surveillance cameras, robotic arms, Smart watch … Some of the devices supported by Sofia2 are:

  • Devices:
    • Opening and closing doors sensor : CLIMAX, Leedarson, Nyce, Wulian, Centralite.
    • Environmental thermometer: Several manufactures
    • Pulsoximetros: several manufactures using IEEE protocol
  • Smart Home: presence sensor: CLIMAX, Leedarson, Nyce, Wulian, Centralite, DEVELCO.
  • Smart Building: Smart Plug: Meazon, 4-Noks
  • Smart Retail:
    • Thermostat: 4-Noks, Centralite
    • IP Camera: D-LINK, Panasonic
    • Temperature and humidity sensor: Wulian, Centralite, Leedarson
    • Smoke and gas sensor: CLIMAX, DEVELCO, Leedarson, Wulian
    • Flood sensor: Centralite, CLIMAX, DEVELCO, Wulian
    • Light sensor: Leedarson
    • Smoke Listener: Centralite
    • Siren: Metalligence, Wulian
    • LED illumination: LG, Leedarson
    • Switches: CLIMAX, Centralite
    • Thermostatic valve: CLIMAX
    • Weather station: Adafruit sensors
    • Beacon: Indra, Estimote
    • Panic button: CLIMAX, Centralite
    • Smart Meters: Several manufactures
  • Smart Cities: Environmental humidity sensor: several manufactures
  • Smart Traffic: Sensor power consumption: several manufactures
  • Smart Agro: Flowmeter: several manufactures
  • Smart Tourism:
    • Tensiometer: several manufactures
    • Potentiometer: several manufactures
    • Smart metering: several manufactures
    • Traffic ligth: Cross
    • Intelligent lighting: UVAX, LUIX
    • Libelium sensors
      • Air Quality
      • Atmospheric pressure
      • Temperature
      • Humidity
      • Luminosity
      • Waspmote internal temperature, batterty level, accelerometer
  • Smart Health: scales, several manufactures using IEEE protocol
  • Smart Insurance:
    • Tensiometers: several manufactures using IEEE protocol
    • Thermometer: Fora
    • Glucometer: Fora
    • Nociceptor: several manufactures
    • Anesthesia tower: Drager, General Electric
    • Pressure sensor in bed
    • Fall sensor
    • SmartBand: Withings
  • Otros:
    • Quadrirotor/Drone: Indra, 3DRobotics, Microsoft IPCam
    • Rover/Drone: Indra
    • Raspberry Pi: Indra
    • ARduino

In addition to supporting the data collection of all these devices, Sofia2 also allows the ingestion of data from other types of sources, such as RRSS, APIs and general files:



Generic IoT Platform        Sofia2 IoT Platform

p3.PNG    Comunicacion Sofia2

Sofia2 is agnostic of the communications, with implementations in multiple protocols of light communication (REST, OPC, MODBUS,  WebSockets, MQTT, WS, JMS, AMQP…)

In addition, among others, the gateways supported by Sofia2 are:


Services and Cloud

 Generic IoT Platform                                   Sofia2 IoT Platform


In the platform Sofia2 the following elementary concepts are defined:

smart space sofia2


It is the collaborative universe of systems and/or devices (ThinKPs) that exchange information between them. The core of a Smart Space is the SIB (Semantic Information Broker):

SIB: It is the core of the Smart Space, acts as an element of integration of the information exchanged by the devices. There may be several in a Smart Space.

ThinKP: Each of the systems and / or applications that interoperate in the Smart Space through the SIB must be defined as ThinKP in the same. The ThinKP is an element deployed in the Smart Space that can consume and/or produce information.

Ontology: Semantic atomic element with which to model the different information systems that interoperate in the Smart Space domain.

Ontologies are semantic descriptions of a set of classes. In this way, applications that share classes (usually called concepts) of the same ontology, can exchange information through concrete instances of these common classes.

In Sofia2, these ontologies are represented in JSON-Schema format that defines and validates them.

In terms of data storage in Sofia2 we distinguish between:


For each ontology can be configured a time window from which the information is considered ‘historical’.

The information remains in this database until it is automatically migrated to the historical information repository.

The stored information will be available as data source for the different modules of the platform: Integration, Machine Learning, APIManager.

Sofia2 has an API Manager with the following capabilities:


Apps and Analytics

Generic IoT Platform                             Sofia2 IoT Platform

p5   AppsyAnalyticsSofia2

In sofia2/console we will find the user interface and experimentation environment with all the capabilities of the platform. In it we can not only create Ontologies to model our data, ThinKPs or ingest data files or RRSS, but also we can create rules (SCRIPTS) to process all this information in the way we are most interested, to visualize this data in Gadgets and Dashboards Or publish ontologies via API. We also have Analytics modules that will allow us to create pipelines and notebooks, or create Machine Learning flows:


To conclude, here we can see the architecture of the platform Sofia2:


As well as an overview of the Sofia2 components:

flujo general Sofia2

IoT Technologies and its support in Sofia2

Visual development in Sofia2 with Raspberry, Node-RED and Dashboards


We have already spoken in previous publications about Node-RED, a tool for visual editing and execution of flows.

In this post will be presented a set of nodes designed to interact with Sofia2 IoT Platform and will present a small demo using those nodes deployed on a Raspberry with a SenseHat sensor.

We will start presenting this set of nodes:


We have a configuration node that has a global reach, that is, its state will be shared between flows. This node represents a shared connection with a remote system, in this case the configuration node is responsible for creating the connection (REST or MQTT) and make it available to the other nodes.

As for the other nodes are the performers of the operations of insertion, update, deletion, queries and release of the connection.

The nodes are available in Sofia2’s Github, in the npm repository and in the official Node-RED page.

Next we will develop two flows using the Node-RED tool, one of them will be deployed in a Raspberry Pi and another in Sofia2 IoT Platform:


The flow of the Raspberry Pi will trigger the process:


  • A node controls the SenseHat sensor data that we have integrated with our Raspberry Pi, and triggers the flow every second with temperature, pressure and humidity data.
  • A function node performs a data processing to generate a JSON instance that matches the ontology that is registered in Sofia2.
  • One of the nodes previously presented, will be responsible for sending a message to Sofia2 IoT Platform with the data obtained from SenseHat to the ontology and will be stored in the Real Time Database, which will feed us later the Dashboard.

The flow in Sofia2 IoT Platform


We have a flow that consists of two parts:

  • On the one hand we have a node that retrieves from an Internet service the temperature of Madrid. This data is stored in the context at the flow level.
  • On the other hand we have a node listening the events received from the Raspberry to the ontology in which the data obtained from the SenseHat board are being inserted. In this flow a simple calculation will be made to obtain the difference of temperatures, in addition a rule will be created in which if that difference exceeds a certain threshold a tweet will be sent. Note that the temperature variation data will also be stored in another ontology in Sofia2, so that you can then feed the Dashboard.

Once the demo is in progress, we create a Dashboard on the Platform, which represents the data of temperature, pressure and humidity, collected from the SenseHat sensor, and also the data of the calculated temperature variation.


This Demo is available in a guide format at the following link:

Visual development in Sofia2 with Raspberry, Node-RED and Dashboards

Comparison of free versions on IoT platforms



In this post we compared capabilities of several IoT platforms (Sofia2, Azure IoT, Watson IoT and AWS IoT). Today we want to compare what each of these platforms offer without cost.


On one hand, the IoT Watson platform from IBM includes a maximum of 500 registered devices, a maximum of 500 application links and up to 200 MB of data:





For its part, Microsoft Azure, allows up to 500 devices and 8000 messages per day:




As well as a message size of 0.5 KB:




AWS IoT, allows up to 250,000 messages published or delivered per month:




And Sofia2, in its CloudLab environment, allows you to use the IoT version of the platform without any limitation, either at the level of connected devices, nor the number or size of messages that circulate through the platform:



In table format we would be talking about:


   Number of Max Devices Allowed Data

Azure IoT Hub


8000 Messages/day



8300 Messages/day

Watson IoT Platform


200 MB/month

Sofia2 IoT Platform Unlimited


Comparison of free versions on IoT platforms

Creating Dashboards with Node-RED


As we mentioned in previous posts, Node-RED is a tool with which you can create flows visually. In this post we will see a new use of Node-RED as a tool to create Dashboards.

To do this we will use the Freeboard node, it is available on GitHub, this node allows us to design our own dashboards.

For this demo, we used a Meshlium sensor concentrator, which inserts real-time data into two ontologies defined by a single ThinKP. To access this data, in our Node-RED flow we will use the following nodes:

  •  A SSAP-process-request node: listening to insert events on the ontologies defined.
  • A function node, whose function will be to parse the data recovered from the ontology. It must be taken into account that the freeboard node only represents the data provided by the message payload in JSON format.
  • A Freeboard node, this will allows us to design our dashboard.

Our flow would look like this:


We will create two different Dashboards, in one of them we will represent the monitoring data of the device as the battery, internal temperature … In the other one we will represent the measurements provided by the sensors: solar radiation, humidity …

The two dashboards are shown below:



Once we have created the Dashboard, we save it to be able to access it from other devices or at another time. There are two ways to open a dashboard that you have saved:

  • By copying the URL generated at the time of saving the dashboard, through this URL we can access it from another device or browser.
  • By selecting the option “LOAD FREEBOARD” in the upper left corner, where we will have to load the generated .json file when we save the dashboard.

In the following video you can see a video of the demo:

Creating Dashboards with Node-RED