Visualize Android Bluetooth Signal Strength

1k Views Asked by At

I can get the Dbm of the bluetooth, but I want to visualize the signal strength. I guess if anyone can help with the following:

  1. Max/Min RSSI Value
  2. RSSI (dbm) to Percentage
  3. Simple Visual Representation (Horizontal). (Currently I am using a ProgressBar for simplicity, though might be nice to make it look a little more substantial and professional).

I did find the following code, which might help:

public static int calculateSignalLevel(int rssi, int numLevels) {
   if (rssi <= MIN_RSSI){return 0;}
   else if (rssi >= MAX_RSSI){return numLevels - 1;} 
   else { 
      int partitionSize = (MAX_RSSI - MIN_RSSI) / (numLevels - 1);
      return (rssi - MIN_RSSI) / partitionSize;
   }      
}

Edit: Beside my laptop I get about -60 to -70 (perhaps that might be about the closest?)

1

There are 1 best solutions below

0
On

For my Android app: "b and l bluetooth le scanner", I use constantly updating progress bars, with a range of -120 to -40 for rssi. I also provide settings to limit the min rssi, and the total count of LE devices, so that the app won't attempt to update too many progress bars for each LE scan. Apparantly, you cannot delay the LeScanCallback function for more than a few hundred milliseconds, or you may not see all devices, in a scan. For efficiency, you could skip visual updates for rssi levels that have not changed, by a certain amount.