Sigfox

Introduction

If you want to build your IoT projects using SIGFOX communications technology in your devices, right now you can do it.

SIGFOX is the first company providing global cellular connectivity for the Internet of Things, fully dedicated to low-throughput communications. SIGFOX is re-inventing connectivity by radically lowering prices and energy consumption for connected devices.

The SIGFOX connectivity solution is based on an antenna and base station infrastructure that is completely independent from existing networks, such as telecommunications networks. This low-throughput only network will be rolled out in 60 countries within the next five years.

In this guide you will learn how to use a low-cost communications model with SIGFOX and integrate it with Alrair SmartCore to build your IoT projects.



How to use Alrair SmartCore with Sigfox

You have two ways to send data to Alrair SmartCore from SIGFOX cloud: you can send a POST request to a special URL we have prepared specifying all the parameters in it (apikey, device, data...) or POST a message with headers and body to Alrair SmartCore API.

Using Alrair SmartCore special URL

In Alrair SmartCore we have prepared a special URL to receive data from SIGFOX Cloud. Just send a POST request with some parameters.

Post

Send data to Alrair SmartCore

URL: http://sigfox.altairsmartcore.com/streamforms
HTTP method: POST

Parameters:

Attribute Description
apikey (mandatory) Your Alrair SmartCore apikey.
This apikey will be used to fully determine privileges and visibility for the request within Alrair SmartCore platform
protocol (mandatory) Comunication protocol. Used for checksum purposes.
Example: v1
at (mandatory) Unix timestamp (UTC) or "now". When "now" is used, Alrair SmartCore will fill "at" value with reception date timestamp.
Examples: 1340001190 or "now"
device (mandatory) Alrair SmartCore device unique identifier.
Example: d0001@smartcore
data (mandatory) Array.
Example: data[hum]=7

Response codes:

Code Description
200 OK
{"response":"ok"}
401 Error
{"response":"error message"}
404 Resource not found
503 Service unavailable.

Example:

Using Alrair SmartCore API

You can use Alrair SmartCore API to create streams from SIGFOX cloud.

URL: http://api.altairsmartcore.com/streams/
HTTP method: POST
Atributes: go to Alrair SmartCore API documentation


Keep on reading to see a complete example.



SIGFOX Cloud

In this example we have one SIGFOX device that sends an aleatory value to SIGFOX Cloud. We have to set up a "callback" to forward the data to Alrair SmartCore.

Login

Enter SIGFOX Cloud backend.

  • Log in

On the top black banner, you can access functional items of your environment. In SIGFOX we have a two-level hierarchy:
- Device: Your objects
- Device type: Your objects families

Device

We have one device named "Device XXXX"

  • Device

And this is the information sent by the device

  • Messages

Callback - Introduction

SIGFOX Cloud can automatically forward some events using the "callback" system. The configuration of callbacks is done in the "Device type" page, so "callbacks" are defined by objects families.
The callbacks are triggered when a new device message is received or when a device communication loss has been detected.

Callback types

There are 3 different callback types (data, service and error). You have a set of common variables available and a set of specific variables for each type of callback. These variables are replaced by their value when a callback is called.

  • DATA

    This callback type defines the reception of a user message from a device. Specific variables:

    Variable Description
    rssi The RSSI (in dBm – Float value with two maximum fraction digits). If there is no data to be returned, then the value is null
    data data: the user data (in hexadecimal)
  • SERVICE

    This callback type defines the reception of an operational message from a device.

  • ERROR

    This callback type defines the communication loss for a device. Specific variables:

    Variable Description
    info Information on error, in case of communication loss, contains the last received message date of the device
    severity "ERROR" when it is a device problem, "WARN" when the network has experienced some issues that could cause some message loss or delay
  • Common variables

    Common variables available:

    Variable Description
    time The event timestamp (in seconds since the Unix Epoch)
    device Device identifier (in hexadecimal – 4 characters <=> 2 bytes)
    signal The signal to noise ratio (in dB – Float value with two maximum fraction digits)
    avgSignal The average signal to noise ratio computed from the last 25 messages (in dB – Float value with two maximum fraction digits) or N/A. The device must have send at least 15 messages
    station The base station identifier (in hexadecimal – 4 characters <=> 2 bytes)
    lat The latitude, rounded to the nearest integer, of the base station which received the message
    lng The longitude, rounded to the nearest integer, of the base station which received the message

If you want to send these variables, they must be enclosed in braces.
Example: {time}



Set up SIGFOX to send information to Alrair SmartCore

Create a new Callback

The first step is to create a new "callback".
To do this, go to the list of device types and select one of them.

  • Device type - List

After selecting the "device type", click on menu item "Callbacks"

  • Device type - Information

In the "callbacks" window you can create a new callback or edit an existing one. In our case we will create a new callback with the following information:

  • Type: DATA
  • Channel: URL
    (Defines the way to forward the event)
  • Send duplicate: not checked
  • Custom payload config: Empty

In this point you can pass all the parameters needed in the url (apikey, device, data...) to the special url of Alrair SmartCore or use headers and body payload and POST the message to Alrair SmartCore API.

  • All the parameters in the URL:
    Url pattern: http://sigfox.altairsmartcore.com/streamforms?apikey=YOUR SMARTCORE APIKEY&protocol=v1&at=now&device=YOUR SMARTCORE DEVICE NAME&data[value]={data}
    (You must specify between braces the SIGFOX variables you want to send)
    You can add in data field, many fields as desired. Example: data[hum]=7&data[temp]=24&data[value]={data}
  • New callback specifying parameters in the URL
  • Using headers and body payload:
    Url pattern: https://api.altairsmartcore.com/streams/
    Send SNI: checked
    Headers: send "Apikey"
    Content type: application-json
    Body: json (You must specify between braces the SIGFOX variables you want to send)
    Example:
  • New callback using Headers and Body Payload

Using either of two ways:

  • Use HTTP Method: POST

Save the new Callback



Check SIGFOX Cloud

That's it, now we just have to send data and verify that they have received it in SIGFOX. Then the callback will be executed and the information is sent to Alrair SmartCore.

Device messages

Go to "Device", select your device and click on "Messages" option

  • Device - Messages

If everything works correctly, you will see a green arrow (indicating that the callback is executed correctly) in the "Callbacks" column. When you click on it you will see the Alrair SmartCore response.

  • Callback response


Check Alrair SmartCore

Its time to test our Alrair SmartCore control panel and check if we have new streams.

Alrair SmartCore Data Streams

Log in Alrair SmartCore, go to “Data → “Data streams” and you will see your data.

  • menu option
  • new data

From here on

Enjoy all the Alrair SmartCore features and make your IoT project easily. Want to know more? visit How Alrair SmartCore works.