In this blog, we firstly introduce how to use Nucleo-L053R8 with S2LP Sub-1GHz for Sigfox Geolocation. It means that we use a Sigfox’s service to track locations of a device (Nucleo-L053R8 in our case). Secondly, we show some results that we got from the device in a bike trip from Munich to Andechs in Germany. Thirdly, we attach Nucleo-IDB05A1 into our device to use BLE for range/distance measurement from a phone (iOS) to the device. Finally, we modify the blinking LED to provide a DC voltage for an active buzzer to generate a beep tone to locate the device indoor. A 3-min demo video is shown to get the idea of this project: https://tinyurl.com/nhantaidatviet2019
//========================================
PART 1: S2LP Sub-1GHz and Sigfox Geolocation
We are going to use the STM32 IoT SDK and the S2LP example uploaded by the blogger disk91. He allowed me to use his code in this post. In the post of the blinking LED, we have already shown how to install the SW4STM32 IDE from AC6 (64-Bit and 32-Bit), thus we proceed directly to how we integrate disk91’s github repositories into the SW4STM32 IDE.
STEP 1: After downloading or cloning the S2LP example repository, we can easily use .Cproject and .project files in the cloned repository to import the whole project into SW4STM32.

STEP 2: After importing the project successfully, we have it in our left panel “Project Explorer”. We continue some more steps for SDK, Sigfox libraries and headers files.
Firstly, we link our project with the STM32 IoT SDK. Linking supports us to separate our project and the SDK, which means the SDK can be developed/updated independently from our project and vice versa, i.e. removing our project does not affect the SDK.

Secondly, we add Sigfox libraries with its path and file names. NOTICE: the library files must be prefixed with “lib”, however, we do not use any prefixes “lib” or suffixes “.a” when adding the files.


Finally, the project is built without any errors.

STEP 3: Let’s imagine our device (Nucleo-L053R8 with S2LP on top as an expansion board) as a node in the Sigfox Network. It means that we must register our device to be a valid node following Section 3.1 in the S2LP’s documentation (UM2169). When sending an email for the registration, be careful to remove any signature. If you do not get a response within 2-3 days, we suggest to use “ST Customer Support Portal“, which works in my situation. Do not forget to follow the documentation for your device registration on Sigfox Backend!
STEP 4: By using the Sigfox Callbacks, we receive an email notification anytime that our device successfully sends a message to the Sigfox Network.

To have this step feature, go to “Device Type” on Sigfox Backend and edit your device there by pressing “New” on the right of the Callbacks Panel. The backend website is confusing between “Device” and “Device Type”, so be careful.


//========================================
Part 2: Sigfox Geolocation in a bike trip from Munich to Andechs in Germany

The radio signal is up to 10 km, so there was wrongly located positions, e.g. we were located to be in Iffeldorf or Gilching, although we have never been there. If more Sigfox towers locate, we definitely get better results. Our idea is initialized by a blog, who did a car tour in Italy and tracked his ST device with Sigfox.
//========================================
Part 3: Nucleo-IDB05A1 for BLE range/distance measurement from a phone
STEP 1: In order to use STM32 S2LP and Nucleo-IDB05A1 together, we must modify the hardware of the boards. Time to prepare your soldering tools 😉 Following to the documentation FP-ATR-SIGFOX1, we unmount R10 and mount R19 on S2LP, as well as to unmount R1, R2 and mount R7, R8 on Nucleo-IDB05A1. Based on Nucleo-IDB05A1’s and S2LP’s schematic, we see that we unmounted 0-Ohm resistors, i.e. we can also remove such resistors and mount required connections with only solder.
STEP 2: We check the boards’ schematics to modify our firmware according to hardware changes in STEP 1.
2a) Nucleo-IDB05A1
R7 and R8 are now connected to PB6 and PC7 respectively instead of PA0 and PA1.


2b) Nucleo-S268A1 (S2LP)

In 2a), we that PB6 and PC7 are connected to CSN and IRQ respectively. We double-check in 2b) and realize that Pin 2 and 3 on CN5 are actually connected to CSN and PC7. Now, we open disk91’s project in STM32CubeMX and modify the port functionalities.

And modifying them to PC7 and PB6 respectively:
//========================================
To be continued….