Android Question Reading RSSI for Localization

Adamdam

Active Member
Licensed User
Longtime User
Dear all,

Greetings,
I need to build B4A project (or if found) that can read available Bluetooth or WiFi with value of RSSI from sender to mobile
to make mathematics to determine the mobile location, I'll create requested mathematics, Just I need B4A that can read different Bluetooth with each strength (RSSI) and I'll complete the project
Thanks in advance for any help.
Best regards
 

emexes

Expert
Licensed User
This was where I started from. Just does a scan which lists nearby devices, including RSSI, no connection required, eg:
BLE Scan Log:
Logger connected to:  HMD Global Nokia C01 Plus
--------- beginning of system
--------- beginning of main
StateChanged: 12
Button1_Click
StartScan
DeviceFound: FF:FF:00:04:CA:ED, RSSI = -55, iTAG
DeviceFound: 30:1B:97:4A:ED:AA, RSSI = -79, EIAdv 2103043250
DeviceFound: FF:FF:00:0B:76:36, RSSI = -82, iTAG
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -56, AK30
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -55, AK30
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -56, AK30
DeviceFound: FF:FF:00:0B:76:36, RSSI = -81, iTAG
DeviceFound: 30:1B:97:4A:ED:AA, RSSI = -81, EIAdv 2103043250
DeviceFound: FF:FF:00:0B:2F:39, RSSI = -52, iTAG
DeviceFound: FF:FF:00:04:CA:ED, RSSI = -52, iTAG
DeviceFound: 30:1B:97:4A:ED:AA, RSSI = -81, EIAdv 2103043250
DeviceFound: FC:58:FA:59:71:26, RSSI = -52, ITAG
DeviceFound: FC:58:FA:59:71:26, RSSI = -58, ITAG
DeviceFound: FF:FF:00:04:CA:ED, RSSI = -52, iTAG
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -57, AK30
DeviceFound: FC:58:FA:59:71:26, RSSI = -52, ITAG
DeviceFound: FC:58:FA:59:71:26, RSSI = -52, ITAG
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -60, AK30
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -59, AK30
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -54, AK30
DeviceFound: FF:FF:00:04:CA:ED, RSSI = -52, iTAG
DeviceFound: FF:FF:00:04:CA:ED, RSSI = -52, iTAG
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -61, AK30
DeviceFound: 30:1B:97:4A:ED:AA, RSSI = -79, EIAdv 2103043250
DeviceFound: FC:58:FA:59:71:26, RSSI = -53, ITAG
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -58, AK30
DeviceFound: FC:58:FA:59:71:26, RSSI = -53, ITAG
DeviceFound: 30:1B:97:4A:ED:AA, RSSI = -78, EIAdv 2103043250
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -60, AK30
DeviceFound: FF:FF:00:04:CA:ED, RSSI = -52, iTAG
DeviceFound: 30:1B:97:4A:ED:AA, RSSI = -79, EIAdv 2103043250
DeviceFound: FF:FF:11:E5:8A:8A, RSSI = -60, AK30
 

Attachments

  • BasicScanBLE.zip
    10.4 KB · Views: 25
Upvote 0

emexes

Expert
Licensed User
to make mathematics to determine the mobile location, I'll create requested mathematics, Just I need B4A that can read different Bluetooth with each strength (RSSI) and I'll complete the project

I'd be interested to hear how you go with this. The RSSI obviously depends on the transmitter power, which presumably is different for different devices. But you'd still expect that for each individual emitter there would be a relationship between RSSI and distance, ie doubling the distance should (approximately) quarter the RSSI (decrease 6dB?).

The thing that threw me is that the RSSI also varied significantly depending on whether the emitter was in front of me (clear line of sight) or behind me (blocked by my body). But my use case is finding lost keys etc, which is less demanding that trying to determine position within an area. I can tell what room the keys are in, and then stand in the middle of the room and rotate until RSSI is highest, at which point the keys are usually somewhere in front of me ±30°
 
Upvote 0

Adamdam

Active Member
Licensed User
Longtime User
Many thanks for your help.
I can't compile, I received this error :

2024/12/07 22:58:46 ERROR 2 (0x00000002) Accessing Source Directory F:\BluetoothRSSI\Shared Files\
The system cannot find the file specified.

It seem that shared fires missed, kindly, share them.
Best regards
 
Upvote 0

emexes

Expert
Licensed User
Reply #6 is a simpler solution, as long as you remember to uncomment the line if you ever use the Shared Files folder.

Turns out it's an empty directory and so it didn't get included in the zip file.

Easiest solution is to make the directory.

Press [Windows+R] key combination to bring up the run box, and run ("open") the command:

cmd /c md "F:\BluetoothRSSI\Shared Files"

then have another burl at compilation.
 
Last edited:
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
I can't compile, I received this error :
comment that line:
B4X:
#Region Shared Files
'#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…