Nucleo-L053R8 S2LP Sub-1GHz (Sigfox Geolocation) and BLE Mobile App

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.

1_Import_Project
Import the STM32 S2LP Project

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.

2_Link_Folder_to_IoT_SDK.JPG
Link the SDK into Our Project

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.

3_Add_Sigfox_Library_Path
Adding our Sigfox Library Path under “C/C++ General >> Paths and Symbols”
4_Add_Sigfox_Libraries
Adding our Sigfox Library Files under “C/C++ General >> Paths and Symbols”

Finally, the project is built without any errors.

6_Build_Project_without_Errors
Build the Project Successfully after adding the SDK, Header Files, and Sigfox Libraries

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.

Sigfox-Callbacks
Sigfox Mail Notification

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.

7_Setup_Sigfox_Callbacks
Add a New Callback to Receive Email Notifications
7_Settings_Sigfox_Callbacks.JPG
Settings of Sigfox Callback for Mail Notification (you can contact me as well)

//========================================

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

Munich-Andechs_Sept2019
Sigfox Geolocation from Munich to Andechs (Blue Lines and Blue Symbols: Departure Route, Orange Lines and Purple Symbols: Arrival Route)

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.

Nucleo_IDB05A1_Port_Modification
Nucleo_IDB05A1_Port_Modification
Nucleo_IDB05A1_Port_Modification2
Relation of PB6 and PC7 with the main board Nucleo-L053R8

2b) Nucleo-S268A1 (S2LP)

Nucleo_S2868A1_Port_Modification
Nucleo_S2868A1_Port_Modification

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.

STM32CubeMX_Unmodified_PA0_PA1
Before our modification, PA0 and PA1 are respectively set to S2LP_GP0 and S2LP_CSn

And modifying them to PC7 and PB6 respectively:

STM32F4 External interrupts tutorial

//========================================

To be continued….

Published by

pikanotes

Saigonese @TUM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s