Sens'it is a multisensor device provided by Sigfox as a simple but complete IoT solution, allowing for approaching the IoT world in a friendly and intuitive way, all through the Sigfox network. This compact but powerful device allows for monitoring some environmental variables and verifying things' state, providing multiple applications, both in home and industry. Moreover, the possibilities increase thanks to its low energy consumption.
Sens'it 2 and Sens'it 3. Image taken from Sens'it for Developers website.
Sens'it can be configured in six different modes:
Temperature and Humidity (LED blinks green).
Light (LED blinks yellow).
Door opening detection (LED blinks light blue).
Vibration detection (LED blinks light blue).
Magnet (LED blinks purple).
Button (Secondary LED blinks white)
By following this guide closely, you'll be able to collect data using a Sens'it device version 2.1, working in "Temperature & Humidity" mode or "Light" mode. If you want to learn more about Sens'it devices, we recommend you to visit the official Sens'it website.
Requirements
Sens’it device (Already transmitting data to Sigfox Backend).
1. Device setup
Before you start, you have to set up your Sens’it device with the right configurations in order to be able to transmit data properly. Please, verify the following configurations in order to ensure the correct functionality:
Install the SDK environment for your Sens'it device.
Verify your device's version is up to date.
Verify if Sigfox Zone configured for the device is the right one for the place where is going to be deployed. If not, the zone has to be configured.
Verify if your device’s working mode is "Temperature & Humidity" (LED blinks green).
To perform all of these configurations, you must refer to this Sigfox documentation: Sens’it for Developers.
2. Understanding Sens’it Payload structure
NOTE: All the images used in this step were taken from the official Sens’it documentation. This step assumes the Sens'it device is already configured and is currently transmitting data to your Sigfox backend.
Please remember that this guide explains how to manage and transmit data for the “Temperature & Humidity” mode or “Light” mode of the Sens’it device v2.1. If you want to use a different mode, check out the official payload structure document, which can be found in Sigfox Build.
To send data from the Sigfox Backend to Ubidots, we have to manage uplink messages. To do this, first let's get deep in the payload structure managed by the device in order to clarify how to handle it.
In the case of uplink messages, the Sens'it payload contains only 4 bytes of mode values:
Keep in mind that all the data sent from the device server-side to the Sigfox backend is managed in an hexadecimal frame. To handle the received data, we have to decode it by following the payload structure provided by the Sens'it vendor.
The information contained in the Sens'it payload changes according to the working mode of the device. This section explains how the payload should look for our two use cases: "Temperature & humidity" and "Light," and how to obtain the final values of the respective variables of interest from the decoded data.
2.1. TEMPERATURE & HUMIDITY MODE
For the "Temperature & Humidity” mode, the four bytes from the Sens'it payload should look like this:
Byte 1: Same for all the modes.
Byte 2: Same for all the modes.
Byte 3: Depends on the mode.
Byte 4: Depends on the mode.
However, we'll be focusing on extracting and decoding the specific information about temperature and humidity values.
NOTE: All the equations used to obtain the temperature and humidity values are described in the Sens’it payload structure document.
Temperature:
To obtain the temperature data, you must follow these steps:
Extract “Temperature value MSB” (Most Significant Bits), which corresponds to bits 7 to 4 from byte 2 (4 bits).
Extract “Temperature value LSB” (Less Significant Bits), which corresponds to bits 5 to 0 from byte 3 (6 bits).
Add the bits extracted in step 2 (6 bits) to the bits extracted in step 1 (4 bits), in order to obtain a set of 10 bits, like this:
To obtain the corresponding temperature value, you must apply the next operation to the 10 bits obtained previously:
Temperature = ( temperature (10 bits) - 200 ) / 8 [°C]
Humidity:
To obtain the humidity value, you must extract “Humidity value” from byte 4, that is, all the bits contained by byte 4 (8 bits).
Then, apply the next operation to the 8 bits set:
Humidity = humidity (8bits) / 2 [%]
It's important to mention that the temperature value provided by the device is in Celsius, and the humidity value is the relative humidity. In case you wish to change the units of the obtained values, you can easily do it using the Synthetic Variables feature provided by Ubidots. Also, if you want to add the measuring unit to a specific variable, you’ll be able to do it by following this guide: Add Units of Measure.
2.2. LIGHT MODE
For the "Light” mode, the four bytes from the Sens'it payload should look like this:
Byte 1: Same for all the modes.
Byte 2: Same for all the modes.
Keep in mind that, as bytes 1 and 2 do not depend on the mode, they will look the same as in the "Temperature & Humidity" mode.
Byte 3: Depends on the mode.
Byte 4: Depends on the mode.
NOTE: All the equations used to obtain the light value are described in the Sens’it payload structure document.
To obtain the light value, you need to process the 6 bits from the byte 3 that correspond to "Light Value" field:
However, the calculation to obtain the light value depends on the "Light mask" field value:
Light Mask equal to "00":
Light Value = Light (6 bits) / 96 [lux]
Light Mask equal to "01":
Light Value = ( Light (6 bits) * 8 ) / 96 [lux]
Light Mask equal to "10":
Light Value = ( Light (6 bits) * 64 ) / 96 [lux]
Light Mask equal to "11":
Light Value = ( Light (6 bits) * 1024 ) / 96 [lux]
As you can see, the light value is given in "lux" units. In case you wish to change the units of the obtained value, you can easily do it using the following features provided by Ubidots:
2.3. BATTERY
Additionally, you can obtain the battery value in all modes. To extract the battery variables, follow these steps:
Extract “Battery level MSB” (Most Significant Bit), which corresponds to bit 7 from byte 1 (1 bit).
Extract “Battery level LSB” (Less Significant Bits), which corresponds to bits 3 to 0 from byte 2 (4 bits).
Add the bits extracted in step 2 (4 bits) to the bit extracted in step 1, in order to obtain a set of 5 bits, like this:
Then, to find the battery value in volts, you need to apply the next operation to the 5 bits obtained previously:
Battery voltage = ( battery (5 bits) * 0.05 ) + 2.7 [V]
NOTE: This equation is described in the Sens’it payload structure document.
After understanding the structure of the data that we will receive, we are ready to configure a callback in the Sigfox Backend to send the data to the Ubidots cloud, and then, create an UbiFunction to receive, process and upload the data to our Ubidots account.
3. UbiFunction & Sigfox Backend callback configuration
After understanding the Sens'it payload structure, you will probably note that the data package must be processed before sending it to your Ubidots account. This can be done thanks to the UbiFunctions feature, which lets us transform and analyze the data provided by the sensor.
Using an UbiFunction is an intermediate and mandatory step between the Sigfox platform and the Ubidots platform. Through this tool, you'll be able to:
Catch the data coming from the Sigfox Backend.
Convert that data into binary code.
Extract the valuable bits.
Obtain the variable values.
Send the final information to your Ubidots account.
Also, it is necessary to configure a callback in the Sigfox Backend to be able to send the device data to an external system like Ubidots. To successfully complete this step, you must refer to steps 1, 2 and 3 from the guide "UbiFunctions: Manage Uplink messages from the Sigfox Backend to Ubidots," ensuring that you apply the necessary changes shown below.
In step 2, “UbiFunctions Configuration,” you must replace the sample code with the Parser code found at the Ubidots repository.
In step 3, “Setting up the Sigfox callback to Ubidots,” you must fill the callback fields just like this:
Type:
DATA
-UPLINK
Channel:
URL
Custom payload config: Leave it in blank
URL pattern: This is the URL generated by the UbiFunction in the field "HTTPS Endpoint URL." You must add the "device" parameter to it. The resulting URL should look like:
https://parse.ubidots.com/prv/your_ubidots_username/your_ubifunction_name/?device={device}
Please, keep in mind that "{device}" is a default parameter to Sigfox, which will be replaced automatically by your device's name thanks to the Sigfox backend.
Use HTTP method:
POST
Header: You must add a new header, filling the "header" field with
X-Auth-Token
and the “value” field with your Ubidots Token.Content Type:
application/json
Body:
{
"data": "{data}",
"time": "{time}"
}
Once the Sigfox callback is configured, it should look like the one below:
NOTE: Please ensure you are adding the "device" parameter at the end of the URL pattern, and enabling the "Send SNI" checkbox.
4. Visualize your data in Ubidots
After finishing your UbiFunction configuration and the Sigfox Backend callback, a new device should appear in the "Devices" section of your Ubidots account, containing the arguments sent by your UbiFunction's HTTP request as variables.
By using the different tools and features provided by the Ubidots platform, you'll be able to configure a customized Dashboard to visualize both your raw and processed data with the help of different widgets.
Here you have an example of how your Dashboard could look:
To learn more about these concepts and features, and learn how to manage, visualize, analyze and use your device's data, we recommend taking a look at the following articles:
5. Summary
Sens'it is a great option for those who want to approach the IoT world in an easy and fun way. The versatility of this device provides a wide range of possibilities to implement IoT solutions, where the limit is your imagination. To learn more about Sens’it devices, we recommend checking out the Sens'it website. Also, if you want to learn more about the Sigfox technologies, you can visit the Sigfox website.
Ubidots allows integrating third-party devices, like the Sens'it from Sigfox, with the help of the UbiFunctions add-on. This tool makes it possible to receive and process data from the third-party device's backend and send it to your Ubidots account through an HTTP request. After collecting the data in your Ubidots account, you'll be able to interact with it with the help of different features and tools provided by Ubidots through a intuitive and friendly user interface.
If you want to learn more about the third-party platforms supported by Ubidots, you can check out this article: UbiFunctions: Process/Parse data from 3rd party platforms.
Other users also found these links useful: