Measuring distance between user and the door

We have no way of measuring distance directly between the user (the phone) and the door. However, we can safely approximate the distance by querying the “strength” of the received signal of the Bluetooth communication. The term is called Bluetooth Received Signal Strength Indication (RSSI). RSSI is the relative received signal strength in arbitrary units.

In short, the closer the distance, the bigger the strength of the received signal, the bigger the RSSI numbers.

In our case, we have two ways to implement this:
<ol><li>The Rpi does the query for signal strength and responses (to command the microcontroller to unlock the door) only when the signal strength is within the safe operating range.</li><li>The App (instead of the Rpi), which initiates the connection, sends the signal (“within range” or “not within range”) along with key based on the received signal strength (Android is able to provide this automatically on each Bluetooth connection or we can use one of the public methods to query manually) of the Rpi.</li></ol><div>However, both methods relies heavily on the actual Bluetooth devices that we are using. We need to do some test on our own to approximate better (sadly we only have one Bluetooth dongle that works with Rpi at this moment).

This is one example I’ve got from the net which should give us some approximations:

          RSSI              Position
          38                   Phone touching Bluetooth dongle
          25                   Phone an inch away</div><div>          10                   Phone about 6 inch away</div><div>          0                     From 2 feet to opposite side of room</div><div>          -3                    In next room (with a wall between)</div><div>          -10                  2 walls away