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

getting RSSI by serial communication using nrf51822

Hello,

I am using nrf51822 and I want to get RSSI values as much quick as possible(around 20 samples per second) .

Previousely I used MCP and decreased the scan interval to do that and then extracted the RSSI from the log file that MCP generates. But when using two or more sensor, it is not possible to use MCP for all of them. So how can I get the RSSI values of two or more sensor? I chose the title as serial connection beacause I think if I there is any way I can just have a serial connection for getting the RSSI values(not using MCP app on my PC) it will be possible to do that.

Any help would be appreciated. Thanks in advace.

Parents
  • Hey.

    If you flash your nrf51 with softdevice S120 or S130, you can act as a BLE central device. You can base your code on one of our example projects, for example this one.

    From there you have two options:

    • Advertise with your two sensors periodically, and scan them with the S120. Then extract the RSSI from the advertising packets.
    • Connect to both sensors, and read their RSSI from the data packets received.

    The first options is easiest to implement, but the last option is more power efficient. In addition, option 2 will allow for encryption of the data.

    When the BLE part of your application is sorted, you simply communicate with your PC using UART.

    EDIT1: Briefly how to use the S120/S130 for scanning after RSSI values

    • Start scanning
    • Handle the "BLE_GAP_EVT_ADV_REPORT"-event in the on_ble_evt() function. This is where the advertisement packets from the scanner is coming in. Find your devices in the advertisement report using either the name, UUID or address. Use the adv_report_parse() function to extract various data from the advertisement packet.
    • Read out the rssi from the p_ble_evt->evt.gap_evt.params.adv_report.rssi value.

    Take a look at this devzone case for some code snippets.

    If you are just starting out with programming of the nRF chip, this might be a small hurdle to get over. I advice you to read the tutorials here on devzone, as well as search here for any problems you encounter.

  • Thanks again. I read almost all of tutorial about three weeks ago, but I didnt find scanning code there. but the code snippets will be useful. What about the serial connection? how can I pass p_ble_evt->evt.gap_evt.params.adv_report.rssi by UART?

Reply Children
No Data
Related