BLE Range Estimator on the Nordic nRF52840

This blog is to demonstrate how to show difference physical codec such as 1Mbps and Coded PHY125Kbps with difference TX power. I would show the RSSI and Packet Success Rate on the LCD display (Adafruit 1947). It can use to estimate the range with difference configurations.

Bluetooth Range Estimator

Recently, Bluetooth SIG launches the online range estimator.

( https://www.bluetooth.com/bluetooth-technology/range/#estimator )

By selecting difference configuration, it can roughly estimate the range.

In order to prove such estimated range, I created the example on nRF52840 DK x 2 and lets the users select difference Bluetooth PHY and TX Power (0, 4, 8dBm).

HW Requirement

I am using two nRF52840 DK board with 2 Adafruit display

( https://www.adafruit.com/product/1947).

Get on the RSSI value

uint32_t sd_ble_gap_rssi_start(uint16_t conn_handle,
uint8_t threshold_dbm,
uint8_t skip_count 
)

Start reporting the received signal strength to the application.

A new event is reported whenever the RSSI value changes, until @ref sd_ble_gap_rssi_stop is called.

Events generated

BLE_GAP_EVT_RSSI_CHANGEDNew RSSI data available. How often the event is generated is dependent on the settings of the threshold_dbm and skip_count input parameters.
msc_inline_mscgraph_10

How to get the RSSI value

// On the connection event

uint32_t err_code;  
m_conn_handle  = p_ble_evt->evt.gap_evt.conn_handle;  
err_code = sd_ble_gap_rssi_start(m_conn_handle, 10, 0);   
APP_ERROR_CHECK(err_code); 


static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
        ret_code_t err_code;
        ble_gap_evt_t const * p_gap_evt = &p_ble_evt->evt.gap_evt;

        switch (p_ble_evt->header.evt_id)
        {
        case BLE_GAP_EVT_RSSI_CHANGED:
             rssi = p_ble_evt->evt.gap_evt.params.rssi_changed.rssi;
             break;

All the source code can be found at https://github.com/jimmywong2003/nrf52-ble-range-estimator .

4 thoughts on “BLE Range Estimator on the Nordic nRF52840

  1. Thanks for your marvelous posting! I quite enjoyed reading it, you are a great author.I will always bookmark your blog and will come back later in life. I want to encourage you to ultimately continue your great writing, have a nice day!

    Like

  2. Nice project! When the link is in long range mode (Coded) is this using 500kbps or 125kbps throughput? I notice there is a throughput button, but this looks like it’s not coded to do anything? Is there anyway to change this?

    Like

    1. The range estimator is purpose to show the distance with RSSI and PSR only.
      It is not target to show the throughput with S8 codec.
      Note: the S140 doesn’t support the S2 (500kbps) option.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.