cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a BLE obscerver

Xourel
Associate

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

3 REPLIES 3
STTwo-32
ST Employee

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.

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).

 

 

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.