ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
SigfoxUplink - send a tiny reading over the Sigfox 0G network

Layer: Foundation ยท Build flags: PROTOCORE_ENABLE_SIGFOX

What this example teaches

The one radio that runs the opposite direction from the gateway examples. Instead of bridging a southbound radio northbound, the device itself uplinks a tiny message (<= 12 bytes, ~140 per day) over the Sigfox 0G network straight to the cloud - ultra-low-power telemetry from places with no Wi-Fi. A Wisol / Murata Sigfox modem is driven by AT commands over UART; the only hardware-specific code is the UART carry.

reading --protocore_sigfox_build_uplink()--> "AT$SF=<hex>" --UART--> modem --> Sigfox cloud
modem reply --> protocore_sigfox_parse_response()

services/sigfox is a pure AT-command codec:

uint8_t payload[4] = { ... }; // your reading, <= 12 bytes
char cmd[32];
uint16_t n = protocore_sigfox_build_uplink(payload, sizeof(payload), cmd, sizeof(cmd));
Serial2.write(cmd, n); // "AT$SF=xxxxxxxx\r\n"
// then, over the modem reply:
protocore_sigfox_result r = protocore_sigfox_parse_response(buf, len); // SIGFOX_OK / _ERROR / _PENDING
protocore_sigfox_result protocore_sigfox_parse_response(uint8_t *work, const char *buf, uint16_t len)
Classify a modem reply (scans buf for "OK" / "ERROR").
uint16_t protocore_sigfox_build_uplink(uint8_t *work, const uint8_t *payload, uint8_t len, char *out, uint16_t cap)
Format an AT$SF=<hex>\r\n uplink command for payload into out (a .
enum PROTO_ENUM_PACKED protocore_sigfox_result
Classification of a Sigfox modem response line.

The payload is hex-encoded (uppercase, two nibbles per byte), and the response is classified as OK, ERROR, or still pending. The codec is host-tested in test/test_sigfox.

Wiring (ESP32 <-> Sigfox modem)

Modem ESP32
TX GPIO 16 (RX)
RX GPIO 17 (TX)
VCC 3V3
GND GND

9600 8N1. Needs a Sigfox modem and an active Sigfox subscription for the region to actually transmit.

Build-flag note

The flag must reach the library build, so pass it as a build flag:

pio ci --board=esp32dev --project-option="framework=arduino" \
--project-option="build_flags=-DPROTOCORE_ENABLE_SIGFOX=1" \
--lib="." examples/Drivers/SigfoxUplink/SigfoxUplink.ino