Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

BASIC BLE BEACON IMPLEMENTATION

Dear Nordic Team,

Hope you all are doing fine.

I have the NRF52-DK based on the NRF52832 BLE IC from Nordic. I wanted to implement a basic BLE Beacon that broadcasts continuously  when powered. 

I need to use it to test the BLE device on my robot.

I wanted to know the easiest way I can implement it. Like is there any application software with which I can program the device, set any parameters (if required, not mandatory) and set it up on the EVK. 

The range is not much of a concern. A short range, typical 5-10m, is sufficient. 

Please let me know if you need any information from my end. 

Looking forward to hearing from you all ASAP.

  • Hi 

    Yes, you can use the ble_app_beacon example from the nRF5 SDK for this:
    \nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_beacon

    Once you flash it into your board the device will start sending advertise (beacon) packets at regular intervals, and you can use something like the nRF Connect mobile app to receive them. 

    Best regards
    Torbjørn

  • Hello,

    I tired it on the NRF52-DK I  have and it works. Thanks for your help!

    The NRF Beacon is visible in the NRF Connect APP.

    I just need some small changes. 

    1. Need to rename the device to: MIKO 3-BLE-BEACON
    2. The device UUID should be: 5fe468df-8bab-41e3-ba48-10c5b3a2bafa

    Also, it is important that the UUID is displayed in the same format and not in inverted format in the App. (I had tried implementing it via Espressif's ESP32 device which displayed the above UUID inverted in the NRF Connect App)

    The device has to continuously broadcast the data and should not go to sleep for any duration.
    The device will be powered via a 5V USB Adaptor.

    Can you please confirm the basic steps and guide me on how can I do it?

    Looking forward to hearing from you ASAP. 

    Thanks for your help!

  • Hi 

    All the beacon data, such as the company ID and UUID, is configured from the defines at the top of main.c:

    #define APP_BEACON_INFO_LENGTH          0x17                               /**< Total length of information advertised by the Beacon. */
    #define APP_ADV_DATA_LENGTH             0x15                               /**< Length of manufacturer specific data in the advertisement. */
    #define APP_DEVICE_TYPE                 0x02                               /**< 0x02 refers to Beacon. */
    #define APP_MEASURED_RSSI               0xC3                               /**< The Beacon's measured RSSI at 1 meter distance in dBm. */
    #define APP_COMPANY_IDENTIFIER          0x0059                             /**< Company identifier for Nordic Semiconductor ASA. as per www.bluetooth.org. */
    #define APP_MAJOR_VALUE                 0x01, 0x02                         /**< Major value used to identify Beacons. */
    #define APP_MINOR_VALUE                 0x03, 0x04                         /**< Minor value used to identify Beacons. */
    #define APP_BEACON_UUID                 0x01, 0x12, 0x23, 0x34, \
                                            0x45, 0x56, 0x67, 0x78, \
                                            0x89, 0x9a, 0xab, 0xbc, \
                                            0xcd, 0xde, 0xef, 0xf0            /**< Proprietary UUID for Beacon. */

    UUID's are often displayed in reverse order on the application side, compared to how it is actually stored in memory on the embedded device. 

    In order for the UUID to be correct you might need to reverse the bytes when you configure it on the nRF side, compared to how it will be displayed in the application. 

    The standard beacon payload doesn't contain a name field, and in order to make room for a name you need to configure an additional advertising payload, called the scan response field. 

    The scan response packet allows you to set up a second advertise payload that will be picked up by a so called active scanner (a scanner device that is configured to request scan response packets from advertisers). 

    Phones typically do this automatically. 

    I can provide instructions on how to modify the beacon example to configure a local name tomorrow. 

    Best regards
    Torbjørn

Related