2024-04-02 08:15 AM - last edited on 2024-04-03 12:24 AM by Peter BENSCH
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
2024-04-23 11:22 PM
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.
2024-05-07 06:11 AM
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).
2024-05-28 06:46 AM
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.