How to: Sigfox Module

Sigfox module provides a simple way how to connect your kit to the Sigfox network. As any other TOWER module, Sigfox module can be controlled with the SDK.

MySigfox.com Service

How Does it Work?

  • message is sent from device

  • Sigfox network receives the message which is processed by the Backend

  • Backend sends the message to MySigfox.com

  • MySigfox.com resends the message to your server

It is pretty easy to set it all up. For more information, there is a different article.

Example

This example does nothing interesting - just sends a message containing this data “000102030405” every time button is pressed. When message is sent, LED on Core module lights up for three second. If something went wrong, LED will blink three times. This serves mainly for testing out that Sigfox module is working or that mysigfox.com does what you want it to do.

 1#include <application.h>
 2
 3twr_led_t led;
 4twr_button_t button;
 5twr_module_sigfox_t sigfox;
 6
 7static void disableLCD(void* param) {
 8    (void) param;
 9    twr_led_set_mode(&led, TWR_LED_MODE_OFF);
10}
11
12void button_event_handler(twr_button_t *self, twr_button_event_t event, void *event_param)
13{
14    if (event == TWR_BUTTON_EVENT_PRESS)
15    {
16        if (twr_module_sigfox_is_ready(&sigfox)) {
17            uint8_t buffer[6];
18            buffer[0] = 0x00;
19            buffer[1] = 0x01;
20            buffer[2] = 0x02;
21            buffer[3] = 0x03;
22            buffer[4] = 0x04;
23            buffer[5] = 0x05;
24
25            if (twr_module_sigfox_send_rf_frame(&sigfox, buffer, sizeof(buffer))) {
26                twr_led_set_mode(&led, TWR_LED_MODE_ON);
27                twr_scheduler_register(disableLCD, NULL, twr_tick_get() + 3000);
28            } else {
29                twr_led_set_mode(&led, TWR_LED_MODE_BLINK);
30                twr_scheduler_register(disableLCD, NULL, twr_tick_get() + 2000);
31            }
32        } else {
33            twr_led_set_mode(&led, TWR_LED_MODE_BLINK);
34            twr_scheduler_register(disableLCD, NULL, twr_tick_get() + 2000);
35        }
36    }
37}
38
39void application_init(void)
40{
41
42    twr_led_init(&led, TWR_GPIO_LED, false, false);
43    twr_led_set_mode(&led, TWR_LED_MODE_OFF);
44
45    twr_button_init(&button, TWR_GPIO_BUTTON, TWR_GPIO_PULL_DOWN, false);
46    twr_button_set_event_handler(&button, button_event_handler, NULL);
47
48    twr_module_sigfox_init(&sigfox, TWR_MODULE_SIGFOX_REVISION_R2);
49}