Implementing LPWAN Sigfox Geolocation with ESP32 IoT

Sigfox, a Low-Power Wide-Area Network (LPWAN) technology, is widely used for IoT applications due to its low power consumptionZigbee Green Power: Ultra-Low-Power Energy Harvesting SolutionsZigbee Green Power: Ultra-Low-Power Energy Harvesting SolutionsDiscover how ZGP enables battery-free IoT devices through energy harvesting with ESP32 integrations, supporting smart home and industrial applications., long-range communication, and simplicity. One of its unique features is geolocation, which allows devices to estimate their position without GPS. This article explores SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies. geolocation and how to implement Monarchical and Atlas Tracking using the ESP32Setting Up ESP32 as a Wi-Fi Access PointSetting Up ESP32 as a Wi-Fi Access PointMaster ESP32 AP configuration with our step-by-step guide. Set up a secure, local IoT network using practical code examples and optimization tips..

Table of Contents🔗

What is Sigfox Geolocation?🔗

Sigfox geolocation estimates the location of a device by analyzing the signals it sends to multiple Sigfox base stations. Unlike GPS, which relies on satellites, SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies. geolocation leverages Time Difference of Arrival (TDOA) and Received Signal Strength Indication (RSSI). This method is ideal for low-power IoT devices that cannot afford the energy consumptionQuick Comparison: Range, power consumption, costs, and complexity of each technologyQuick Comparison: Range, power consumption, costs, and complexity of each technologyDiscover the ideal wireless solution for your ESP32 IoT project by analyzing range, power, cost, and complexity. Optimize connectivity now. of GPS modules.

Key Points:

Monarchical Geolocation🔗

Monarchical geolocation is SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies.’s native service, estimating a device's position based on the RSSI values of messages received by at least three base stations. Its accuracy depends on the density of SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies. base stations in the area.

How It Works:

1. The device sends a message to the Sigfox networkIntegrating Sigfox Wisol Modules (SFM10Rx) with ESP32Integrating Sigfox Wisol Modules (SFM10Rx) with ESP32Learn to connect ESP32 to Sigfox via Wisol modules in this detailed guide. Optimize power consumption and deploy low-energy IoT sensor nodes effectively..

2. The message is received by multiple base stations.

3. The SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies. cloud calculates the device's position using the RSSI values.

4. The estimated location is provided via the SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies. backend or API.

Accuracy:

Atlas Geolocation🔗

Atlas geolocation is an advanced service that combines Wi-FiArquitetura ESP32: SoC dual-core, subsistemas RF integradosArquitetura ESP32: SoC dual-core, subsistemas RF integradosDiscover the ESP32’s dual-core prowess and integrated RF subsystems for efficient, innovative IoT applications—from smart homes to industrial sensors. and Bluetooth scanning data with SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies.’s radio-based geolocation. This hybrid approach significantly improves accuracy, especially in urban environments.

How It Works:

1. The device scans for nearby Wi-Fi access pointsSetting Up ESP32 as a Wi-Fi Access PointSetting Up ESP32 as a Wi-Fi Access PointMaster ESP32 AP configuration with our step-by-step guide. Set up a secure, local IoT network using practical code examples and optimization tips. and Bluetooth beacons.

2. The scan results are sent to the Sigfox networkIntegrating Sigfox Wisol Modules (SFM10Rx) with ESP32Integrating Sigfox Wisol Modules (SFM10Rx) with ESP32Learn to connect ESP32 to Sigfox via Wisol modules in this detailed guide. Optimize power consumption and deploy low-energy IoT sensor nodes effectively. along with the device’s Sigfox messages.

3. The Sigfox cloud combines the Wi-Fi/Bluetooth data with the SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies. TDOA/RSSI data to estimate the device's location.

Accuracy:

Implementing Sigfox Geolocation with ESP32🔗

To implement SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies. geolocation with the ESP32, you’ll need:

Step 1: Hardware Setup

Connect the Sigfox module to the ESP32 via UART or SPI. Use the following wiring for UART communicationInterfacing ESP32 with Zigbee3.0 Devices (Xiaomi, Philips Hue)Interfacing ESP32 with Zigbee3.0 Devices (Xiaomi, Philips Hue)Unlock seamless smart home integration by following our detailed guide on bridging ESP32 with external Zigbee modules for reliable IoT solutions.:

// Wiring: ESP32 to Wisol SFM10Rx (UART)
#define SIGFOX_RX 16
#define SIGFOX_TX 17
SoftwareSerial sigfoxSerial(SIGFOX_RX, SIGFOX_TX);
void setup() {
  Serial.begin(115200);
  sigfoxSerial.begin(9600); // Wisol default baud rate
}

Antenna Tip: Use a 868 MHz antenna (EU) or 902 MHz (US) for optimal signal reception.

Step 2: Send Messages with Geolocation

Enable geolocation by sending a message with the geoloc flag:

Monarchical:

void sendMonarchicalMessage() {
  String payload = "A1B2"; // Example sensor data
  sigfoxSerial.print("AT$SS=1A"); // 1A = Geolocation enabled
  sigfoxSerial.print(payload);
  sigfoxSerial.print("\r");
}

Atlas:

void sendAtlasMessage() {
  sigfoxSerial.print("AT$SS=2A"); // 2A = Request Atlas downlink
  sigfoxSerial.print("C3D4"); // Payload
  sigfoxSerial.print("\r");
}

Step 3: Retrieve Geolocation Data

Use the SigfoxSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsSigfox Message Encoding: Packing Sensor Data into 12-byte PayloadsLearn efficient data encoding techniques for Sigfox's constrained 12-byte payloads. Discover bitwise operations, structured encoding & CBOR strategies. backend or API to retrieve the geolocation data. Example API call:

curl -X GET "https://api.sigfox.com/v2/devices/{deviceID}/locations" \
  • H "Authorization: Basic {base64_encoded_credentials}"

The API response will include latitude and longitude values. Example JSON response:

{
  "locations": [
    {
      "lat": 48.8566,
      "lng": 2.3522,
      "radius": 500, // Accuracy radius in meters
      "time": 1697040000
    }
  ]
}

Step 4: Parse and Use the Data

Use ESP32’sCombining Wi-Fi with Deep Sleep for Low-Power ApplicationsCombining Wi-Fi with Deep Sleep for Low-Power ApplicationsLearn how to integrate Wi-Fi and deep sleep on ESP32 to maximize battery life in IoT devices. This guide offers practical tips and step-by-step instructions. HTTP client to fetch and process location data:

#include <WiFiClientSecure.h>
void getLocation() {
  WiFiClient client;
  client.connect("your-server.com", 80);
  client.println("GET /location-endpoint HTTP/1.1");
  while (client.available()) {
    String line = client.readStringUntil('\n');
    if (line.startsWith("\"lat\":")) {
      float lat = line.substring(7, line.length()-1).toFloat();
      // Store or process latitude
    }
  }
}

Accuracy Optimization Techniques🔗

Practical Use Cases🔗

1. Asset Tracking: Track vehicles, containers, or equipment across large areas.

2. Livestock Monitoring: Monitor the location of animals in remote farms.

3. Smart Cities: Track waste bins, streetlights, or other municipal assets.

4. Fleet Management: Monitor the location of delivery vehicles or drones.

Challenges and Limitations🔗

1. Accuracy: Varies with base station density and environmental factors.

2. Latency: Location updates may not be real-time due to message frequency limits.

3. Urban vs. Rural Performance: Atlas geolocation works better in urban areas with Wi-FiArquitetura ESP32: SoC dual-core, subsistemas RF integradosArquitetura ESP32: SoC dual-core, subsistemas RF integradosDiscover the ESP32’s dual-core prowess and integrated RF subsystems for efficient, innovative IoT applications—from smart homes to industrial sensors./Bluetooth infrastructure.

4. CostQuick Comparison: Range, power consumption, costs, and complexity of each technologyQuick Comparison: Range, power consumption, costs, and complexity of each technologyDiscover the ideal wireless solution for your ESP32 IoT project by analyzing range, power, cost, and complexity. Optimize connectivity now.: Advanced geolocation services like Atlas may incur additional fees.

Troubleshooting Common Issues🔗

IssueSolution
No Geolocation DataVerify backend callback configuration
High Position Error (>5 km)Check antenna placement and tower density
Atlas Downlink Not ReceivedEnsure device is in multi-tower coverage

By leveraging Sigfox geolocation with the ESP32, you can build cost-effective and energy-efficient tracking solutions for a wide range of IoT applicationsConnecting ESP32 to Cloud Services via Wi-FiConnecting ESP32 to Cloud Services via Wi-FiDiscover how to connect your ESP32 to AWS, Azure, and Google Cloud using secure Wi-Fi. This guide covers setup, error handling, and low power strategies.. Whether you choose Monarchical or Atlas geolocation depends on your accuracy requirements and deployment environment. Experiment with custom payloads and hybrid strategies to maximize the potential of Sigfox geolocation in your projects.

Author: Marcelo V. Souza - Engenheiro de Sistemas e Entusiasta em IoT e Desenvolvimento de Software, com foco em inovação tecnológica.

References🔗

Share article

Related Articles