Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 3 months ago.
BLE_Observer to get distance estimate?
Hi to everyone! I'm using the BLE_Oberver to detect the presence of iBeacons and it works great but now I need to estimate the distance to my iBeacon. Can I use the TxPower and the RSSI? Or there is another way to do that?
Thank you!
2 Answers
9 years, 3 months ago.
Yes. So you can do that by reading the transmit data. The beacon transmits the following: a UUID, Major, Minor and TX Power. The TX power is used for the RSSI.
Read this article: http://www.warski.org/blog/2014/01/how-ibeacons-work/"
It will tell you about the attributes of an ibeacon and how to get distance. I know it answered a lot my questions and what the different parts to the address mean.
Yes.. so you can print out those values by running through a for loop for the length of advertisingDataLen
so:
Printing Advertising Data
void advertisementCallback(const Gap::AdvertisementCallbackParams_t *params) { if(params->advertisingDataLen == 30) { for (unsigned index = 0; index < params->advertisingDataLen; index++) { pc.printf("%02x", params->advertisingData[index]); //print the advertising data by byte } } pc.printf("\r\n"); //write next transmission on new line
The last byte is the TX data. I used a ibeacon app from the app store that can simulate an ibeacon, and you can change your values and play with the TX data by simulating it.
posted by 24 Nov 20158 years, 9 months ago.
Hello,
I used the published example BLE_Observer_Nucleo and tried to print out the advertising data as well as the RSSI- value. However when I ran the programm the RSSI-value as well as the advertising data was empty or zero.
https://developer.mbed.org/users/vcoubard/code/BLE_Observer_Nucleo/
Do you know of any other funktions to read out mayor/minor and the RSSI-Value or do you see any possible mistakes?
Thank you!