Registering your Device with Sigfox
In order to send a Sigfox message, you will need to register your Device with the Sigfox Backend. Navigate to https://backend.sigfox.com/activate and you will find a list of Sigfox enabled development kits, choose your kit to proceed.
Next you will need to choose a Sigfox Operator for the country in which you will be activating your Device. Find your country and select the operator to continue.
Once your device is registered in the Sigfox backend you should see it on the Device section as shown on the image below:
Setting up the Sigfox callback to the Ubidots Cloud
The management of the data between Sigfox and Ubidots goes through a "Callback". The Sigfox device will be in charge to read the sensors and send the values to Sigfox, the message will be decoded using the custom payload config at the callback configurations to build the request to uplink the message to Ubidots.
Now it is time to set up the callback. Go to the Device section and click on the registered device:
Next, verify your device information and select "CALLBACKS" from the menu on the left of the page, as you can see below:
Sigfox callbacks allow you to report data to an external system like Ubidots. To setup a callback to Ubidots API, use these parameters:
Type:
DATA
-UPLINK
Channel:
URL
Custom payload config:
temperature::float:32:little-endian pressure::uint:8
Url pattern:
https://industrial.api.ubidots.com/api/v1.6/devices/{device}/
Use HTTP method:
POST
Send SNI: Checked
Headers:
x-auth-token
-Your Ubidots Token
Content Type:
application/json
Body:
{
"position":{"value":0,"context":{"lat":"{lat}","lng":"{lng}"}},
"temperature" : {"value":"{customData#temperature}"},
"pressure" : {"value":"{customData#pressure}"}
}
IMPORTANT NOTE: The field "custom payload config" allows you to specify how you would like Sigfox to decode your device's payload. You might for example wish to decode an incoming byte as an unsigned integer. An example of this is the first line of the sample below:
int1::uint:8 // Unsigned integer of 8 bits with name int1
str::char:6 // Character String of 6 letters with name str
b1::bool:7 // Boolean based on value of bit in position 7 with name b1
Where "int1" is the name of the value, "uint:8" specifies the datatype and the number of bits, respectively. To know more about how to build the custom payload config, please reference to the sigfox documentation pressing the question icon to display help.
The Sigfox payload will decode the message and it will be received on the Ubidots side without matter the format used on it, but take in count that you have to set the same format into your device's code because if not, the data will not be received by Sigfox. To verify if the message is received at Sigfox go to the Device section, then select the device's ID:
Next, at the left menu select "message" to visualize the messages received:
Please note the "customData#..." from the body field will contain the actual sensor information, in the example shown as "temperature"and "pressure". If you desire send more values, you have to assign it at the custom payload config, them assign it at the body following the same structure.
Following this guide, we configured two variables "temperature" as float and "pressure" as uint; You can use the format that you desire but take in count that the device have to send the values using the same format assigned by you at the custom payload config.
The temperature is configured as "float" which can be either 16, 32 or 64 bits, optionally the endianness for multi-bytes floats, and optionally the bit offset where to start the reading of the first byte. Depending of the bits that you assigns you will be able to send 2 values(16 bits) and 4 values (32 bits)
temperature::float:32:little-endian
The pressure is configured as "uint" the parameters are the number of bits to include in the value, optionally the endianness for multi-bytes integers, and optionally the bit offset where to start the reading of the first byte. Using this configuration you will be able to send 12 values.
pressure::uint:8
NOTE: To know more about how to build the custom payload config, please reference to the sigfox documentation pressing the question icon to display help.
After configuring the callback, it should look like this:
Once you verify the callback, press "OK". Now your callback is ready and enabled to post to the Ubidots Cloud.
IMPORTANT DEPLOYMENT NOTE: Ubidots and Sigfox communicate via either URL or Batch URL (used for large deployments). This tutorial explains the standard URL channel. If you have a large scale sensor network, please contact sales@ubidots.com to receive additional information for Batch URL integrations.
Now it is time to program your device! The Ubidots team provide you this article to start with the Sipy Board:
Once your device is ready, go to your Ubidots account to visualize the new device created with the variables.
Please note that the "API Label" will be the same as the Sigfox {device} field.
IMPORTANT NOTE: If you desire to returns device messages where at least one callback has failed, reference to the Sigfox API to know how to implement it.
Result
Now it is time to create a dashboard to control and manage the variables of your Sigfox device. To learn more about Ubidots widgets and events, check out these video tutorials.