sigfox_comm – a SigFox tool for Linux systems

Do you like Linux/Embedded Linux? Do you like IoT? What about using SigFox in your Linux IoT projects?

Categories: Beginner

Introduction

SigFox is one of the most popular and reliable LPWANs in the world. With good network coverage across the world, SigFox is used everywhere: agriculture, smart cities, manufacturing, supply chain & logistics, utilities and energy and so on. Therefore, if you want to build / develop an IoT project, you probably would consider using SigFox in your solution.

As many of the recent IoT projects and products uses embedded Linux operational systems, it makes sense to have a way to interact with SigFox modems in Linux systems, right? This is what this post / article will present to you:
sigfox_comm
, a Linux / embedded Linux tool to send data from your Linux environment to SigFox Cloud, considering WSSFM11R2D SigFox modem.

Tests executed

This tool has been tested in the following Linux / Embedded Linux systems so far:


Generic notebook, running Ubuntu 16.04LTS Linux Operational System, using a 3.3V USB-Serial converter

Pocket Beaglebone board, running Debian GNU/Linux 9 (stretch) Linux Operational System

Raspberry Pi Zero W board, running Raspbian GNU/Linux 10 (buster) Linux Operational System, using a 3.3V USB-Serial converter

Raspberry Pi 3B board, running Raspbian GNU/Linux 9 (stretch) Linux Operational System, using a 3.3V USB-Serial converter

What is needed to use this tool?

Of course, you’ll need a WSSFM11R2D SigFox modem. Also, you’ll need a Single-Board Computer running an embedded Linux distro (Raspberry Pi, Beaglebone Black, Pocket Beaglebone and so on) with one UART available or a USB connection (USB device) available to plug a 3.3V USB-UART converter. In my case, I bought a SigBOT board, a SigFox board containing a WSSFM11R2D SigFox modem and that uses XBee form factor (what allows its usage in any XBee shield or dongle). This board is shown in figure 1.

Figure 1 - SigBot Board

You can buy it from EngeBOT company, a Brazilian IoT devices and hardware company. Link:
https://www.hackster.io/engebot-technology2/products/sigbot-sigfox/specs

Then, all you need is to:

Wire 3.3V of your Single-Board Computer (or 3.3V USB-UART converter) to VCC of WSSFM11R2D SigFox modem;

Wire GND of your Single-Board Computer (or 3.3V USB-UART converter) to GND of WSSFM11R2D SigFox modem;

Wire TX of a UART of your Single-Board Computer (or 3.3V USB-UART converter) to RX of WSSFM11R2D SigFox modem;

Wire RX of a UART of your Single-Board Computer (or 3.3V USB-UART converter) to TX of WSSFM11R2D SigFox modem;
Impotant:
DO NOT use 5V voltage level to power-source SIgFox modem or UART voltage level. It’ll permanently dmage your SigFox modem.

Installing and compiling sigfox_comm tool

To install and compile sigfox_comm tool, follow these steps:

1- First of all, access your Single-Board Computer by a terminal (using SSH, for instance).2- In this terminal session, clone Github tool repository into your Single-Board Computer by doing the following :

git clone https://github.com/phfbertoleti/sigfox_comm.git

3- After cloning repository, enter in "sigfox_comm" folder and "source_code" sub-folder by doing:

cd sigfox_comm

cd source_code

4- Compile the tool executing the command below. This tool requires only GCC compiler (as it uses only standard libraries it has no other dependences).

make

5- That’s it! After some seconds you’ll have sigfox_comm tool compiled and ready for use.

How to use the tool?

The sigfox_comm tool is used in terminal / command line interface to send data to SigFox Cloud. The tool also wakes-up SigFox modem and ensures the micro and macro channels needed for data transmition are on.

The sigfox_comm tool takes only two arguments:

First argument –
Path to UART file in your Linux / Embedded Linux system (/dev/ttyUSB0, for instance)
Second argument –
Data to be sent to SigFox Cloud. Regarding second argument, this data must be formatted as a Hex-String (010203, for instance). In this format, each byte is represented by two ASCII characters (for example: 0x01 byte in Hex-String format is represented by "01"). SigFox limits the payload size (data to be sent) in 12 bytes maximum, what means the Hex-String should be 24 characters ( = 24 bytes) long at maximum. If a longer Hex-String is passed as this argument, it’ll be truncated to a 24 characters Hex-String and the remaining part of Hex-String will be ignored.

Also, I’d like to recommend you execute the tool as super user. Otherwise, you’ll probably face permission issues to open, send and receive data from/to UART in Linux.

Example of use

First, go to the folder you’ve compiled the tool (in this article / post: sigfox_comm/source_code).

Then, suposing your WSSFM11R2D SigFox modem UART is wired to /dev/ttyO4 UART in your Single-Board Computer and data to be sent (in Hex-String format) is 010203040506070809101112, the command to send this data to SigFox Cloud using sigfox_comm tool is shown below:

sudo ./sigfox_comm /dev/ttyO4 010203040506070809101112

In this example, the output should like as shown in figure 2.

Figure 2 - sigfox_comm tool output (example of use)

After that, "010203040506070809101112" data will be sent to SigFox Cloud and will be available in SigFox Backend.

More examples of use

More examples of use are available in examples Github repository folder (
https://github.com/phfbertoleti/sigfox_comm/tree/master/examples
). These examples are written in shell script, what means any Linux / Embedded Linux distro with sigfox_comm compiled can run these examples.

Comments are not currently available for this post.