- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Want to measure distance between android cell phone and PSoC6 device (CY8CKIT-062-BLE) using RSSI value and display it on UART. In this case I will be reading RSSI value of cell phone and determine its distance from my PSoC6 device and send it over UART. Please help me if anyone had done same on PSoC6 BLE or PSoC4 BLE.
Also I had attached project to measure RSSI value of connected device but it is not working , I know there is something wrong with code but unable to find. Please rectify if possible.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello rautinst_2245351,
I see a mistake in your CY_BLE_EVT_GET_RSSI_COMPLETE event handling. The eventParam for this event is of type "cy_stc_ble_events_param_generic_t*" and the cy_stc_ble_events_param_generic_t structure has another element called "eventParams" and this is the element that contains the "cy_stc_ble_rssi_info_t*". So modifying the rssi_param line to below fixed the issue.
rssi_param = (cy_stc_ble_rssi_info_t*)(((cy_stc_ble_events_param_generic_t*) eventParam)->eventParams);
Some other notes -
1. In the CY_BLE_EVT_GAP_DEVICE_CONNECTED event, you don't have to get the address and then use GetPeerBdHandle to retrieve the bdHandle. The bdHandle member/element of "conn_param" already contains the bdHandle of the peer. So you can directly use it (conn_param->bdHandle).
2. Even though in theory RSSI gives approx. estimate of the distance from the peer. It should be noted that the environment loss can vary a lot and the distance estimated from RSSI might not give the actual distance (because of varying and lossy nature of environment). You will have to model your environment, find out the loss (again this can change) and the use it in RSSI equation to arrive at the distance. I hope you already understand this
Let me know if this helps.
Regards,
Meenakshi Sundaram R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello rautinst_2245351,
I see a mistake in your CY_BLE_EVT_GET_RSSI_COMPLETE event handling. The eventParam for this event is of type "cy_stc_ble_events_param_generic_t*" and the cy_stc_ble_events_param_generic_t structure has another element called "eventParams" and this is the element that contains the "cy_stc_ble_rssi_info_t*". So modifying the rssi_param line to below fixed the issue.
rssi_param = (cy_stc_ble_rssi_info_t*)(((cy_stc_ble_events_param_generic_t*) eventParam)->eventParams);
Some other notes -
1. In the CY_BLE_EVT_GAP_DEVICE_CONNECTED event, you don't have to get the address and then use GetPeerBdHandle to retrieve the bdHandle. The bdHandle member/element of "conn_param" already contains the bdHandle of the peer. So you can directly use it (conn_param->bdHandle).
2. Even though in theory RSSI gives approx. estimate of the distance from the peer. It should be noted that the environment loss can vary a lot and the distance estimated from RSSI might not give the actual distance (because of varying and lossy nature of environment). You will have to model your environment, find out the loss (again this can change) and the use it in RSSI equation to arrive at the distance. I hope you already understand this
Let me know if this helps.
Regards,
Meenakshi Sundaram R