SigfoxTracker: Difference between revisions
m (→data advanced) |
|||
(26 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
* how to interact with the sigfox backend | * how to interact with the sigfox backend | ||
* ultimately, help develop a sigfox tracker for tracking small animals, like bats | * ultimately, help develop a sigfox tracker for tracking small animals, like bats | ||
Scope limits for now: | |||
* focus on *one* use case, toward a super-light-weight tag for bats: no GPS, location fix comes from the network (on the order of 1 km) | |||
* focus on *one* wireless technology, sigfox for the tracker on this page | |||
* focus on getting position fixes, the only other interesting property is | |||
** air pressure, to estimate flight altitude: look up local sea level air pressure, calculate theoretical altitude-above-sealevel | |||
* for bat tracking, solar panels are no good, bats generally avoid daylight | |||
* battery powered, not use some magical yet-to-be-invented power source (kinetic, moonlight, tiny windmill, radioactive?) | |||
* use something that has a well-defined radio interface, not re-invent (D)BPSK, just use a radio that has native BPSK support | |||
* try to use a chip-antenna, for miniaturisation and more isotropic/omni-directional radio behaviour | |||
Next steps: | |||
* get the STM32WL55 board working again (e.g. re-flash my arduino program to it, or simply erase it over SWD). | |||
== Investigation == | == Investigation == | ||
Line 25: | Line 38: | ||
* https://www.disk91.com/2019/news/sigfox-news/i-held-the-first-1-sigfox-iot-device/ | * https://www.disk91.com/2019/news/sigfox-news/i-held-the-first-1-sigfox-iot-device/ | ||
* https://www.disk91.com/2018/technology/sigfox/create-a-5-autonomous-tracker-with-esp8266-and-sigfox/ | * https://www.disk91.com/2018/technology/sigfox/create-a-5-autonomous-tracker-with-esp8266-and-sigfox/ | ||
How to get the keys: | |||
* https://www.disk91.com/2019/technology/sigfox/murata-abz-sigfox-connectivity/ | * https://www.disk91.com/2019/technology/sigfox/murata-abz-sigfox-connectivity/ | ||
Line 30: | Line 45: | ||
[[File:sigfox_coverage_1.png|right|thumb|Sigfox coverage, bike trip Gouda-Leidschendam]] | [[File:sigfox_coverage_1.png|right|thumb|Sigfox coverage, bike trip Gouda-Leidschendam]] | ||
=== Existing | === Existing hardware === | ||
==== LWT-100 ==== | ==== LWT-100 ==== | ||
This is a tracker made by Invoxia, features: | This is a tracker made by Invoxia, features: | ||
* sends positions using sigfox, configured via bluetooth | * sends GPS positions using sigfox, configured via bluetooth | ||
* fcc id ZVS-LWT1: https://fccid.io/ZVS-LWT1/Internal-Photos/Internal-Photos-3734578 | * fcc id ZVS-LWT1: https://fccid.io/ZVS-LWT1/Internal-Photos/Internal-Photos-3734578 | ||
* ESP-8285 chip, this is a microcontroller similar to ESP-8266, | * ESP-8285 chip, this is a microcontroller similar to ESP-8266, used as a 'WiFi coprocessor'? | ||
* NXP-QN9080, Ultra low power Bluetooth 5 system-on-chip solution, see https://www.nxp.com/docs/en/nxp/data-sheets/QN908x.pdf | * NXP-QN9080, Ultra low power Bluetooth 5 system-on-chip solution, probably the 'main controller', see https://www.nxp.com/docs/en/nxp/data-sheets/QN908x.pdf | ||
* U-blox M8030-CT, GNSS chip,see https://www.u-blox.com/en/product/ubx-m8030-series | * U-blox M8030-CT, GNSS chip,see https://www.u-blox.com/en/product/ubx-m8030-series | ||
* Semtech SX1272, LoRa chip | * Semtech SX1272, LoRa chip | ||
Line 44: | Line 59: | ||
Apparently this was originally a LoRa tracker, contains a LoRa transceiver, but now uses SigFox! | Apparently this was originally a LoRa tracker, contains a LoRa transceiver, but now uses SigFox! | ||
The radio waveform is created by the SX1272, not by a specialized Sigfox chip. | |||
=== BRKWS01 === | |||
This is a stand-alone module that can be controlled through "AT" commands to perform sigfox communication: | |||
https://partners.sigfox.com/products/sigfox-breakout-board-brkws01 | |||
The module is controlled over a 9600 bps serial port connection. | |||
Further it requires a 3.3V + GND power connection. | |||
==== registration ==== | |||
This module comes with a piece of paper containing the device id and the PAC, 2 of the 3 components needed to communicate over the Sigfox network. | |||
You can register the module using just this information. The third component (key) is known at the backend and is contained in the module itself, | |||
registered before you bought the development kit, so you never really get to (or need to) see this as end user. | |||
==== Callbacks ==== | |||
I'm using the 'uplink' and 'data advanced' HTTP callbacks to receive the data from the sigfox network: | |||
===== uplink ===== | |||
* Log in to backend.sigfox.com | |||
* Under 'Device types', select a device type and select 'edit' | |||
* Open 'Callbacks' (left hand menu), add a new callback using 'new' (top-right) | |||
* Add an 'uplink' callback: | |||
** Type: DATA / UPLINK | |||
** Channel: URL, URL pattern: http://stofradar.nl:9001/sigfox/uplink | |||
** Use HTTP method: POST | |||
** Headers: -, Content-type: application/json | |||
** Body: | |||
<pre> | |||
{ | |||
"device":"{device}", | |||
"time":{time}, | |||
"data":"{data}", | |||
"seqNumber":{seqNumber}, | |||
"deviceTypeId":"{deviceTypeId}" | |||
} | |||
</pre> | |||
===== data advanced ===== | |||
* Add an 'data advanced' callback: | |||
** (see also https://support.sigfox.com/docs/data-advanced) | |||
** Type: SERVICE / ADVANCED | |||
** Channel: URL, URL pattern: http://stofradar.nl:9001/sigfox/advanced | |||
** Use HTTP method: POST | |||
** Headers: -, Content-type: application/json | |||
** Body: | |||
<pre> | |||
{ | |||
"device": "{device}", | |||
"time": {time}, | |||
"data": "{data}", | |||
"seqNumber": {seqNumber}, | |||
"lqi": "{lqi}", | |||
"linkQuality": {linkQuality}, | |||
"fixedLat": {fixedLat}, | |||
"fixedLng": {fixedLng}, | |||
"operatorName": "{operatorName}", | |||
"countryCode": {countryCode}, | |||
"deviceTypeId": "{deviceTypeId}", | |||
"computedLocation": {computedLocation} | |||
} | |||
</pre> | |||
===== status ===== | |||
The 'status' callback notifies out-of-band messages: | |||
* Type: SERVICE / STATUS | |||
* URL pattern: http://stofradar.nl:9001/sigfox/status | |||
* User HTTP method: POST | |||
* Headers: -, Content-type: application/json | |||
* Body: | |||
<pre> | |||
{ | |||
"device": "{device}", | |||
"time": {time}, | |||
"seqNumber": {seqNumber}, | |||
"batt": "{batt}", | |||
"temp": "{temp}" | |||
} | |||
</pre> | |||
== Software == | |||
The ST package 'STM32Cube_FW_WL_V1.0.0' has examples for Sigfox: | |||
https://www.st.com/en/embedded-software/stm32cubewl.html | |||
In directory XX you can find the following examples: | |||
* Sigfox_AT_Slave | |||
* Sigfox_AT_Slave_DualCore | |||
* Sigfox_PushButton | |||
* Sigfox_PushButton_DualCore | |||
It appears that, typically, you should edit a file sigfox_data.h to enter the sigfox credentials (device id, pac and key) | |||
The Sigfox credentials can be retrieved from a STM32WL chip as follows: | |||
* install STM32 cube programmer (I used v2.8.0) | |||
* connect the STM32WL chip through a STLINK2 | |||
* select the sigfox logo in the left of the screen | |||
* there is a button "copy chip certificate" and "open sigfox page" that sends you to https://my.st.com/sfxp | |||
* on that page you can submit the chip certificate data and get a zip in return containing the dev id, pac and key | |||
== Arduino tracker == | |||
[[File:sigfox_coverage_2.jpg|right|thumb|Sigfox coverage, bike trip around Gouda]] | |||
For investigation purposes, I've created a simple tracker consisting of: | |||
* a Wemos WROOM-02 board with ESP8266 and an 18650 battery | |||
* a BRKWS01 sigfox breakout | |||
* a GPS module | |||
It sends the GPS location fix every minute (so you can do one 140 minute tracking session per day). | |||
Payload consists of: | |||
* latitude in 1E-6 degrees, encoded as 4-bytes signed big endian | |||
* longitude in 1E-6 degrees, encoded as 4-bytes signed big endian | |||
* altitude in 0.1m, encoded as 2-bytes signed big endian | |||
* number of satellites, encoded as 1 -byte unsigned | |||
Arduino software: https://github.com/bertrik/SigfoxTracker | |||
Backend logger: https://github.com/bertrik/sigfox-receiver |
Latest revision as of 16:26, 16 June 2022
Project SigfoxTracker | |
---|---|
Investigating sigfox location trackers | |
Status | Initializing |
Contact | bertrik |
Last Update | 2022-06-16 |
What
This page is about investigation of Sigfox location trackers, e.g.:
- how existing trackers work
- coverage of the sigfox network
- how to interact with the sigfox backend
- ultimately, help develop a sigfox tracker for tracking small animals, like bats
Scope limits for now:
- focus on *one* use case, toward a super-light-weight tag for bats: no GPS, location fix comes from the network (on the order of 1 km)
- focus on *one* wireless technology, sigfox for the tracker on this page
- focus on getting position fixes, the only other interesting property is
- air pressure, to estimate flight altitude: look up local sea level air pressure, calculate theoretical altitude-above-sealevel
- for bat tracking, solar panels are no good, bats generally avoid daylight
- battery powered, not use some magical yet-to-be-invented power source (kinetic, moonlight, tiny windmill, radioactive?)
- use something that has a well-defined radio interface, not re-invent (D)BPSK, just use a radio that has native BPSK support
- try to use a chip-antenna, for miniaturisation and more isotropic/omni-directional radio behaviour
Next steps:
- get the STM32WL55 board working again (e.g. re-flash my arduino program to it, or simply erase it over SWD).
Investigation
- great page at disk91 about sigfox, part from reverse engineering
- coverage map https://www.sigfox.com/en/coverage
- modulation is D-BPSK, frequency range is 192 kHz is in the 868 MHz band
- a packet consists of max 26 bytes, of which 12 bytes are user payload
Interesting reading:
- https://www.disk91.com/2019/technology/sigfox/make-you-own-1-sigfox-iot-device/
- https://www.disk91.com/2019/news/sigfox-news/i-held-the-first-1-sigfox-iot-device/
- https://www.disk91.com/2018/technology/sigfox/create-a-5-autonomous-tracker-with-esp8266-and-sigfox/
How to get the keys:
coverage
Existing hardware
LWT-100
This is a tracker made by Invoxia, features:
- sends GPS positions using sigfox, configured via bluetooth
- fcc id ZVS-LWT1: https://fccid.io/ZVS-LWT1/Internal-Photos/Internal-Photos-3734578
- ESP-8285 chip, this is a microcontroller similar to ESP-8266, used as a 'WiFi coprocessor'?
- NXP-QN9080, Ultra low power Bluetooth 5 system-on-chip solution, probably the 'main controller', see https://www.nxp.com/docs/en/nxp/data-sheets/QN908x.pdf
- U-blox M8030-CT, GNSS chip,see https://www.u-blox.com/en/product/ubx-m8030-series
- Semtech SX1272, LoRa chip
- LiPo battery, 352044 300 mAh 3.7V
- chip antenna for LoRa/Sigfox, 11x5.5mm
- chip antenna for wifi/bluetooth/gps, 10x3 mm
Apparently this was originally a LoRa tracker, contains a LoRa transceiver, but now uses SigFox! The radio waveform is created by the SX1272, not by a specialized Sigfox chip.
BRKWS01
This is a stand-alone module that can be controlled through "AT" commands to perform sigfox communication: https://partners.sigfox.com/products/sigfox-breakout-board-brkws01
The module is controlled over a 9600 bps serial port connection. Further it requires a 3.3V + GND power connection.
registration
This module comes with a piece of paper containing the device id and the PAC, 2 of the 3 components needed to communicate over the Sigfox network. You can register the module using just this information. The third component (key) is known at the backend and is contained in the module itself, registered before you bought the development kit, so you never really get to (or need to) see this as end user.
Callbacks
I'm using the 'uplink' and 'data advanced' HTTP callbacks to receive the data from the sigfox network:
uplink
- Log in to backend.sigfox.com
- Under 'Device types', select a device type and select 'edit'
- Open 'Callbacks' (left hand menu), add a new callback using 'new' (top-right)
- Add an 'uplink' callback:
- Type: DATA / UPLINK
- Channel: URL, URL pattern: http://stofradar.nl:9001/sigfox/uplink
- Use HTTP method: POST
- Headers: -, Content-type: application/json
- Body:
{ "device":"{device}", "time":{time}, "data":"{data}", "seqNumber":{seqNumber}, "deviceTypeId":"{deviceTypeId}" }
data advanced
- Add an 'data advanced' callback:
- (see also https://support.sigfox.com/docs/data-advanced)
- Type: SERVICE / ADVANCED
- Channel: URL, URL pattern: http://stofradar.nl:9001/sigfox/advanced
- Use HTTP method: POST
- Headers: -, Content-type: application/json
- Body:
{ "device": "{device}", "time": {time}, "data": "{data}", "seqNumber": {seqNumber}, "lqi": "{lqi}", "linkQuality": {linkQuality}, "fixedLat": {fixedLat}, "fixedLng": {fixedLng}, "operatorName": "{operatorName}", "countryCode": {countryCode}, "deviceTypeId": "{deviceTypeId}", "computedLocation": {computedLocation} }
status
The 'status' callback notifies out-of-band messages:
- Type: SERVICE / STATUS
- URL pattern: http://stofradar.nl:9001/sigfox/status
- User HTTP method: POST
- Headers: -, Content-type: application/json
- Body:
{ "device": "{device}", "time": {time}, "seqNumber": {seqNumber}, "batt": "{batt}", "temp": "{temp}" }
Software
The ST package 'STM32Cube_FW_WL_V1.0.0' has examples for Sigfox: https://www.st.com/en/embedded-software/stm32cubewl.html
In directory XX you can find the following examples:
- Sigfox_AT_Slave
- Sigfox_AT_Slave_DualCore
- Sigfox_PushButton
- Sigfox_PushButton_DualCore
It appears that, typically, you should edit a file sigfox_data.h to enter the sigfox credentials (device id, pac and key)
The Sigfox credentials can be retrieved from a STM32WL chip as follows:
- install STM32 cube programmer (I used v2.8.0)
- connect the STM32WL chip through a STLINK2
- select the sigfox logo in the left of the screen
- there is a button "copy chip certificate" and "open sigfox page" that sends you to https://my.st.com/sfxp
- on that page you can submit the chip certificate data and get a zip in return containing the dev id, pac and key
Arduino tracker
For investigation purposes, I've created a simple tracker consisting of:
- a Wemos WROOM-02 board with ESP8266 and an 18650 battery
- a BRKWS01 sigfox breakout
- a GPS module
It sends the GPS location fix every minute (so you can do one 140 minute tracking session per day). Payload consists of:
- latitude in 1E-6 degrees, encoded as 4-bytes signed big endian
- longitude in 1E-6 degrees, encoded as 4-bytes signed big endian
- altitude in 0.1m, encoded as 2-bytes signed big endian
- number of satellites, encoded as 1 -byte unsigned
Arduino software: https://github.com/bertrik/SigfoxTracker Backend logger: https://github.com/bertrik/sigfox-receiver