Provisioning

Registering the device

In VS Code open your folder with the latest firmware and other files.

Step 1

In "config.yml" define the application ID in line 2 and firmware to upload in line 6 (name.dfu).

Step 2

To get the access code for TTN Console open "main.py" and ctrl+click on the link in line 18.

The Things Network Console

Step 3

Copy the access code in yellow.

Step 4

In VS Code open new Terminal and type or copy the following line with the access code and press enter.

python main.py --type abp --key "TTNCTL ACCESS CODE" --dtc 4 --ads_calib 1

If you want to manually provision the device with OTAA, use the following line with correct values

python main.py --type otaa-manual --appkey "KEY" --deveui "DEV" --appeui "APP"

Step 5

Connect STM32 Nucleo to Tag connect programmer adapter.

Enter device name to register and wait for the process to finish.

Device name can NOT be changed in The Things Network Console.

Testing the device

Step 6

In The Things Network Console go to device overview to change settings.

Applications -> "Application ID" -> Devices -> Device name

Send confirmed payload with settings to port 3. Under payload choose "fields" and copy the following settings.

GPS active (interval 1min)

{"system_status_interval": 1, "system_functions": {"accelerometer_enabled": false, "light_enabled": false, "temperature_enabled": false, "humidity_enabled": false, "charging_enabled": true}, "lorawan_datarate_adr": {"datarate": 3, "confirmed_uplink": false, "adr": false}, "gps_periodic_interval": 1, "gps_triggered_interval": 0, "gps_triggered_threshold": 10, "gps_triggered_duration": 10, "gps_cold_fix_timeout": 200, "gps_hot_fix_timeout": 60, "gps_min_fix_time": 1, "gps_min_ehpe": 50, "gps_hot_fix_retry": 5, "gps_cold_fix_retry": 20, "gps_fail_retry": 0, "gps_settings": {"d3_fix": true, "fail_backoff": false, "hot_fix": true, "fully_resolved": false}, "system_voltage_interval": 1, "gps_charge_min": 2500, "system_charge_min": 3450, "system_charge_max": 4000, "system_input_charge_min": 10000, "pulse_threshold": 3, "pulse_on_timeout": 60, "pulse_min_interval": 1, "gps_accel_z_threshold": 0}

Go to Application Data. Wait for settings to be applied (green checkmark and "confirmed ack") and check the next message on port 12 for any errors.

To speed up the process of applying settings you can manually reset the device.

Step 7

To test the GPS function put the device outside. GPS antenna should face upside as seen on the following image.

Device sleep

Step 8

When you are happy with the results, change settings to save battery. Repeat step 6 with following settings

Device sleep:

{"system_status_interval": 30, "system_functions": {"accelerometer_enabled": false, "light_enabled": false, "temperature_enabled": false, "humidity_enabled": false, "charging_enabled": true}, "lorawan_datarate_adr": {"datarate": 3, "confirmed_uplink": false, "adr": false}, "gps_periodic_interval": 0, "gps_triggered_interval": 0, "gps_triggered_threshold": 10, "gps_triggered_duration": 10, "gps_cold_fix_timeout": 200, "gps_hot_fix_timeout": 60, "gps_min_fix_time": 1, "gps_min_ehpe": 50, "gps_hot_fix_retry": 5, "gps_cold_fix_retry": 20, "gps_fail_retry": 0, "gps_settings": {"d3_fix": true, "fail_backoff": false, "hot_fix": true, "fully_resolved": false}, "system_voltage_interval": 30, "gps_charge_min": 2500, "system_charge_min": 3450, "system_charge_max": 4000, "system_input_charge_min": 10000, "pulse_threshold": 3, "pulse_on_timeout": 60, "pulse_min_interval": 1, "gps_accel_z_threshold": 0}

Next message on port 3 should show values 30 for "system_status_interval" and "system_voltage_interval".

Initial provisioning

Last updated