This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52 BLE UART + Proximity

Hi,

I am using NRF52832 to read the sensor data (BMI160 accelerometer sensor) by using I2C.

I try to send the sensor data to mobile by using BLE_UART. upto this i finished now. I need is.

1.calculate the BATTERY level without using ADC. is there any register used to read the battery?

2. need to know the paired device distance. or proximity?

Parents
  • Q1: You can measure the RSSI, see S132 SoftDevice v6.1.0: RSSI get sample and sd_ble_gap_rssi_get

    Q2: The proximity example already implements the features you are asking for, i.e alerting the connected devices are too far apart so the the connection is lost. 

    Q3: Yes, it is possible merge the proximity example with the beacon example, but I guess it would be better to just merge ble_app_uart and ble_app_proximity. 

  • thank you the tutorial. i will see that

    I diidn't understand this function in BLE_UART

    is there any tutorial or can you explain

    static void on_conn_params_evt(ble_conn_params_evt_t * p_evt)
    {
        uint32_t err_code;
    
        if (p_evt->evt_type == BLE_CONN_PARAMS_EVT_FAILED)
        {
            err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE);
            APP_ERROR_CHECK(err_code);
        }
    }
    
    
    /**@brief Function for handling errors from the Connection Parameters module.
     *
     * @param[in] nrf_error  Error code containing information about what went wrong.
     */
    static void conn_params_error_handler(uint32_t nrf_error)
    {
        APP_ERROR_HANDLER(nrf_error);
    }
    
    
    /**@brief Function for initializing the Connection Parameters module.
     */
    static void conn_params_init(void)
    {
        uint32_t               err_code;
        ble_conn_params_init_t cp_init;
    
        memset(&cp_init, 0, sizeof(cp_init));
    
        cp_init.p_conn_params                  = NULL;
        cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY;
        cp_init.next_conn_params_update_delay  = NEXT_CONN_PARAMS_UPDATE_DELAY;
        cp_init.max_conn_params_update_count   = MAX_CONN_PARAMS_UPDATE_COUNT;
        cp_init.start_on_notify_cccd_handle    = BLE_GATT_HANDLE_INVALID;
        cp_init.disconnect_on_fail             = false;
        cp_init.evt_handler                    = on_conn_params_evt;
        cp_init.error_handler                  = conn_params_error_handler;
    
        err_code = ble_conn_params_init(&cp_init);
        APP_ERROR_CHECK(err_code);
    }
    

  • If you receive the BLE_CONN_PARAMS_EVT_FAILED event, then the peripheral will disconnect as the connection parameters required by the master(Central) is incompatible with the parameters required by the slave(peripheral).

Reply Children
No Data
Related