Skip to main content
Associate
April 2, 2024
Question

How to make a BLE obscerver

  • April 2, 2024
  • 3 replies
  • 1239 views

I try to make an obscerver with a p-nucleo-wb55 that scan the surounding and give the adress id and the RSSI. 

I used the project P2P client as a base and add some codes :

In the app.ble.c file

in the SVCCTL_App_Notification function

i add in the case HCI_LE_ADVERTISING_REPORT_SUBEVT_CODE , the following code 

 

adv_report_data = (uint8_t*)(&le_advertising_event->Advertising_Report[0].Length_Data) + 1;

k = 0;

 

/* search AD TYPE 0x09 (Complete Local Name) */

/* search AD Type 0x02 (16 bits UUIDS) */

if (event_type == ADV_IND)

{

int8_t RSSI;

 

RSSI = (int8_t)*(uint8_t*) (adv_report_data + le_advertising_event->Advertising_Report[0].Length_Data);

 

printf(" MAC : %02x:%02x:%02x:%02x:%02x:%02x"

,le_advertising_event->Advertising_Report[0].Address[5]

,le_advertising_event->Advertising_Report[0].Address[4]

,le_advertising_event->Advertising_Report[0].Address[3]

,le_advertising_event->Advertising_Report[0].Address[2]

,le_advertising_event->Advertising_Report[0].Address[1]

,le_advertising_event->Advertising_Report[0].Address[0]);

printf("RSSI= %d\n",RSSI);

}

 

but i have no idea if it's working or not because there is no print in the debug mode

This topic has been closed for replies.

3 replies

STTwo-32
ST Technical Moderator
April 24, 2024

Hello @Xourel 

The RSSI is a parameter that may help you to estimate the distance. But, On BLE Technologie you need to have a direct Line of site to have a good estimation of the distance. I suggest you measure different distance and collect the RSSI of each distance then you can create a mathematical equation that receive the RSSI as input and calculate the distance. Then, using the triangulation Methode (3 node fixe), you can estimate the exact location of each node. The Serial Trace need to be implemented to visualize the data.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
XourelAuthor
Associate
May 7, 2024

Ok i will try to do this 

But is it possible to scan beacons that are one a whitelist only by using the advertising mode (without connection).

 

 

STTwo-32
ST Technical Moderator
May 28, 2024

Hello @Xourel 

You can use the Directed Advertising method to targets a specific device.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.