Finding your position outdoors on a device is easy with GPS but indoors is another matter. I have some potential projects that might need indoor positioning so I have started researching and testing the subject. There are several ways to calculate indoor position and technologies including:
- Visible Light Communication (VLC);
- Ultra Wide Band (UWB); and
- Near Field Communication (NFC) / RFID.
I do not want to spend a fortune so the DIY route it is. VLC largely requires line of sight and regardless of speed flashing lights always concern me for migraine and epilepsy sufferers. I also want a system that could potentially be used in any environment, inside or out, light or dark. As for UWB the Decawave DWM1000 module is something I would like to play with especially when reports say accuracy down to 12cm or so. This is on the cards but considering the cost not just yet. Ideally I want a solution that works with say an Android tablet without having to modify or add external hardware. This leaves Bluetooth and WiFi. I will try both of these, starting with WiFi. The only reason I am starting with WiFi is that I have a pile of ESP8266 modules already.
So the theory is you use multiple beacons, measure the signal strength to each beacon and this allows you to calculate your position. Think of it like this, you are on a boat, you can see three lighthouses and you measure the amount of light from each. The light level allows you to estimate your position. There are a few issues, you need to know the position of each beacon for starters and then there is the calculation for position. This method is called Trilateration and is what I will use.
Rather than do it all in one go I will do this step by step. So first is to use two ESP8266’s. One will be a beacon, the other will scan for that beacon and print the RSSI value. The beacon is simply the ESP8266 setup as an Access Point (AP). A simplified formula1RSSI = -10n log d + A where n is the path loss factor, d is the distance and A is the measured power at 1m can be used.
Using a path loss coefficient of 2.9 and measured power at 1m of -49dBm along with the above formula and the RSSI a distance can be calculated. Results I have obtained shown below:
|Measured RSSI (dBm)||Actual distance (m)||Calculated distance (m)||Error (m)|
One admission, I have taken the RSSI at each distance as an average of 60 samples. The orientation of the ESP8266 module makes a difference and might account for some of the bumps in the data. This was done in an empty room with no obstructions. More testing is needed, for example with people and objects in the path, no averaging, etc.. I did notice a few blips where at say 0.4m the RSSI would suddenly indicate it was 5m away. In any case overall I was impressed with the results, they were far more accurate than I thought they would be.
This is going to be an ongoing project and there are several more steps:
- Repeat the above test but use two ESP-07’s with an external antenna.
- Repeat the above with people, objects, walls, etc.
- Extend to three beacons to allow position to be determined
- Extend to four or more beacons to allow 3d position to be determined.
- Investigate existing open source solutions (i.e. FIND, Redpin)
1 Oguejiofor O.S., Okorogu V.N., Adewale Abe, Osuesu B.O, Outdoor Localization System Using RSSI Measurement of Wireless Sensor Network, International Journal of Innovative Technology and Exploring Engineering (IJITEE) ISSN: 2278-3075, Volume – 2, Issue – 2, January 2013