Default
- Follow this guide to add your device to The Things Stack.
- Change the
APPEUI,DEVEUIandAPPKEYinconf/app_conf.hto the values specific to your device, which are used on The Things Stack. - Uncomment the
REGIONparameters inconf/lorawan_conf.h. These should correspond to the location that you use these devices at.
Free fall detection
- Change
ACC_FF_THRESHOLDinapp/conf.hto a value you prefer. This will determine the threshold where all axis can be from 0g (which would indicate that it is free falling) to be considered a free fall event. - Change
ACC_FF_DURATIONinapp/conf.hto a value you prefer. This will determine how many times the axis have to meet the threshold values. Note thatACC_FF_ODRin the same file also affects this. ACC_FF_SCALEinapp/conf.hcould also be changed for situations where more than 2g has to be detected.LIS2DH12.hin theLIS2DH12library lists all the options for this in the full scale section.ACC_FF_ODRinapp/conf.hcould be lowered to save power, or increased to improve performance.LIS2DH12.hin theLIS2DH12library lists all the options for this in theODRsection.
Low power
- Set
GNSE_ADVANCED_TRACER_ENALBEto0inconf/app_conf.h. This will make the device consume less power, but also disables UART. - Set
DEBUGGER_ONto0inconf/app_conf.h. - Set
ACC_FF_ODRinapp/conf.hto a lower value if the decreased performance of the free fall detection does not matter for your setup.LIS2DH12.hin theLIS2DH12library lists all the options for this.
Additionally, try to remember that:
- Setting
DEBUGGER_ONto1will consume more power. The debugger is ON by default using the macroDEBUGGER_ONinconf/app_conf.h. - Keeping peripherals (such as the sensors) off by controlling the load switches will significantly reduce the power consumption. But, of course, you can not turn the load switch connected to the accelerometer off without disabling the free fall detection as well.
LoRa extra’s
Some extra setup configurations can be done to change the behaviour of the LoRaWAN features. These include:
- Setting the activation method (OTAA or ABP) in
LORAWAN_DEFAULT_ACTIVATION_TYPEinlora_app.h. OTAA is recommended. - The data rate can be set in
lora_app.h. The default configuration uses the ADR. If you want to set your preferred data rate, setLORAWAN_ADR_STATEtoLORAMAC_HANDLER_ADR_OFFand setLORAWAN_DEFAULT_DATA_RATEto your preference. A list of the options per region are shown inRegion.hin theSTM32WLxx_LoRaWANlibrary. ACC_FF_LORA_PORTcan be changed inconf/app_conf.h, which is used to configure the transmission port. The LoRaWAN keys mentioned in the default section can be altered here as well.- Also in
conf/app_conf.h, the downlink port can be set by alteringACC_FF_DOWNLINK_PORT.
Debugger
For debugging, the firmware has to support it first. The debugger is set in the macro DEBUGGER_ON in conf/app_conf.h.