Skip to content

BLE Beacon Example

Description

The Beacon Example implements a transmitter beacon that broadcasts information to all compatible devices in its range as Manufacturer Specific Data in the advertisement packets.

This information includes:

  • A 128-bit UUID to identify the beacon's provider.
  • An arbitrary Major value for coarse differentiation between beacons.
  • An arbitrary Minor value for fine differentiation between beacons.
  • The RSSI value of the beacon measured at 1 meter distance, which can be used for estimating the distance from the beacon.

Tip

Before you start building, remember to set up the nRF5 SDK development environment first. See Setup the nRF5 SDK for details.

Building the example

You can find the source code and the project file of the example in the following folder: examples/nrf5-sdk/ble_app_beacon.

Open terminal and navigate to the directory with the example Makefile:

cd ./examples/nrf5-sdk/ble_app_beacon/armgcc

Run make merge to build the application and merge with the Softdevice:

make merge

Programming the firmware

If compiled successfully, the firmware is located in ble_app_beacon/armgcc/_build with the name nrf52840_xxaa_s140.hex.

Connect the debugger USB port to your PC using the provided USB-C Cable. A disk drive called M2-DOCK will be automatically detected by the computer.

Run the following command in ble_app_beacon/armgcc to program the board:

make flash_all

Tip

See Programming section for details about how to program the nRF52840 M.2 Module.

Testing

Test the Beacon Example with nRF Connect by performing the following steps:

  1. After application starts, observe that GREEN LED is blinking. This indicates that the beacon is advertising.

  2. After starting discovery in nRF Connect, observe that the beacon is advertising with its Bluetooth device address without a Device Name.

  3. Tap the device to view the full advertisement data.

Reference

Create an Issue

Interested in contributing to this project? Want to report a bug? Feel free to click here: