Bluetooth Low Energy based beacon implementation with sensors for the nRF52. Works with the nRF52 (tested), but is likely to work for the nRF51 as well (not tested). Power performance is, however, not expected to be as good for the nRF51.
This project demonstrates the good power performance of the nRF5x Series and the nRF52 Series in particular. The project is not a part of the official Nordic Semiconductor SDK. Developers are anyway welcome to contribute and provide feedback.
The project file for the sensor beacon firmware is located in the sensor_beacon/pca20014/arm4 directory, and is used to generate the firmware so that it can be loaded into the nRF52 of the sensor beacon hardware.
The nRF Master Control Panel is available from Google Play and can be used to observe the beacon (temperature and pressure) once the firmware has been loaded and the solar panel is facing light at about 500 LUX.
To run the beacon, just compile the project located in the sensor_beacon/pca20014/arm4 directory and use the debugger to load the firmware by pressing the load button in the Keil uVision IDE.
After the initial setup, the firmware will continuously repeat the following steps:
-
Every 10th advertising event and also before the very first advertising event:
-
Power up the sensor and the two-wire interface (TWI).
-
Read the sensors.
-
Power down the sensor and the TWI.
-
-
Switch on the external crystal.
-
Send beacon packets (once for each advertising channel index (37, 38 & 39))
-
Switch off the external crystal.
The initial setup contains the following steps:
-
Standard Nordic MDK system startup for nRF52 Series.
-
Initialize drivers for accessing the sensor chip.
-
Initialize the beacon PDU (Protocol Data Unit).
-
Set the advertiser address of the PDU.
-
Reset the sensor data fields of the PDU.
-
Reset the radio hardware configuration to operate in BLE DD (Bluetooth Low Energy Device Discovery) mode.
-
Start the RTC (Real Time Counter) peripheral.