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 .