I'm trying to use RSSI values to create a positioning system in my home.
I'm using the neXenio library as a base, the only changes I have made from this have been implementing logging to a database:
https://github.com/neXenio/BLE-Indoor-Positioning
I'm using 4 Minew I7's for the beacons and they are currently set to broadcast just iBeacon type adverts at 300ms. They are positioned in a square shaped room and a cross type layout and each beacon is around 2.2m apart. There are no obvious obstructions other than normal living room furntiure. For each test run I do I place my phone in the centre of the room and gather data for around 10-15 minutes at a time. Data gets sent to a database for me to look at after.
The issue I'm having is the singal strength fluctuates massively all the time, to the point the data is basically unusable.
Graphs from a typical test run.
Should there be that much difference when the phone is completely still ? I'd expect there to be some slight differences from just the nature of signal propagation but not this much.
Is this to be expected or can these be improved upon somehow ? If this is expected then I will have to look at combining some other sensor data to help improve accuracy.
Thanks
Edit:
After running some more tests, I compared values over time (I had previously only compared rssi,distance and mac address). This has led to find a consitant osscilation pattern Newest test run.
This has also led me to this overstack question:
Is there an explanation for the regular oscillation experienced in Bluetooth RSSI
If I am only advertising iBeacon type adverts then this wouldn't apply? But it seems strange how it matches me issue.
RSSI values fluctuate a lot and there is not much you can do about that. That's why the new features in Bluetooth 5.1 were created that use other techniques than signal strength for positioning. Unfortunately the adoption has been slow.
You can't do much with currently used devices. Even if you stabilize the signal statically, there will be a lot of noise during movement. You can try to:
thicken the signal to 100 ms. Urfotunately, this will affect battery consumption,
BLE transmits packets on 3 channels (37, 38, 39). The antenna probalby isn't tuned to all 3 the same. If you have the option to change the advertising channels, try to test on different settings.
if you have option of soldering or connecting an external anntena, direcational antennas may be helpful for indoor positioning system.
There are many methods to stabilize the rssi signal. If you are interested in this topic, I recommend looking at the articles:
https://scholar.google.com/scholar?hl=pl&as_sdt=0%2C5&q=stabilization+rssi+method&btnG=
In my opinion, this mothod will be most useful to you:
https://www.wouterbulten.nl/blog/tech/kalman-filters-explained-removing-noise-from-rssi-signals/
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5461075/
AoA and AoD methods may also interest you:
https://www.bluetooth.com/blog/new-aoa-aod-bluetooth-capabilities/
I hope this will be useful
Its practice approach, I tried and implemented.I got the proper results, so that`s why writing the solution. If possible try the same.
I implemented it on one BLE router and one Beacon tag.
I need to do the calculation for up to 3 meter means 3*3.2 foot.
I minimized the fluctuation with out using the kalman filter.
For above implementation we need to go through the steps as follows,
Step 1. Keep Beacon tag at 1M of distance and take 10 [Max] number of readings of rssi & store it in one excel.
Step 2. Keep Beacon tag at 2M of distance and take 10 [Max] number of readings of rssi & store it in second excel.
Step 3. Keep Beacon tag at 3M of distance and take 10 [Max] number of readings of rssi & store it in third excel.
Now you have 3 excel.
Take one excel and observe the rssi value, compute the median for the same.
Same thing need to calculate for other two excels.
My Becon tag freq is 4 dbm.
I got the readings of RSSI from above excel as listed below:
From one excel: -58
From two excel: -64
From third excel: -70
As you see, there is difference of 6 as I change the meter.
Now I written logic by using above results like if value is fluctuating between -58 to -64 then it is represented as 1 m. same for 2m & 3m.
But this is not the proper way to do the calculation.
So I used the log for the
calculation like for the value between -58 to -64
result = log(rssi*-1,58). i.e 58 as base.
actual distance = result *1(meter)*3.2(ft)
Same for 2 meter, but for 2 m base of log is 64
result = log(rssi*-1,64). i.e 64 as base.
actual distance = result *2(meter)*3.2(ft)
Same for 3 meter, but for 3 m base of log is 70
result = log(rssi*-1,70). i.e 70 as base.
actual distance = result *3(meter)*3.2(ft)
This can be done by programming. I got the proper results with stability of rssi signal.
Related
I'm detecting if a person enters or exits a room using iBeacon. The implementation is as follows:
1. Two beacons are placed per room. One in the door and the other is inside near the door.
2. To detect entry, the user must pass the door beacon then the one inside the room. For exit, it's the other way around.
Issue:
In case that there are rooms that are too adjacent with each other, an overlap will occur causing an error in the detection
Planned Solution:
Use RSSI to detect which one is the last nearest beacon when the inside room is detected. I'm thinking of checking the skewness of the distribution of the RSSI on a given time, say around 1 to 2 seconds since the user detected an inside beacon.
Is there other statistical analysis or any data analysis that can be used to determine or check with a probability which room the user entered?
Unless the rooms are very large (which it sounds like they are not based on the troubles you are having) I think any technique you find will have a high error rate. You might be able to get this error rate down far enough to be acceptable by recognizing cases where you simply cannot make a determination and refusing to do so in these cases to avoid false determinations.
Your best bet is to sample multiple RSSI measurements from different beacon packets (a minimum of 10 to filter out noise), then average them, perhaps throwing out the highest and lowest value before doing so. If this average RSSI is strong enough, say < -80 dB (and it is the strongest signal you have seen from all beacons) there is a high probability you are in the room indicated by the beacon.
The RSSI may drop off if you go far away from the beacon in the room so just because the criteria above are not met does not mean you are not in the room.
Keep in mind that it is impossible to determine which beacon is closest if all signals are weak -- noise becomes more important than signal. So make no conclusions unless one beacon has RSSI stronger than, say -85 dBm.
Make sure your beacons are transmitting as strongly as possible and advertising as often as possible. The latter will ensure that you get enough RSSI samples in a short time.
Finally, keep in mind that different Android phones have different Bluetooth antennas and receive the same beacon packets more or less strongly. A Huawei P9 Lite detects BLE signals at an RSSI 20 dB weaker than a similarly placed Moto G4+. Regardless of this, phones typically do not detect beacon signals weaker that -100 dBm and below -90 dBm the measurement is so weak as to become almost useless for relative distance determination.
I have 10 beacon device and 10 room. Consider 1/Room and i want to know currently where i am?
For this : already use mBeconManager.setRangeNotifier and arrange beacon list in desc order on "Distance" basic.
And display room as per less distance.
But the process is very slow.
Beacon : eddystone Beacon
Platform: android
Lib: Altbeacon
Is there any other best way for this scenario or example? Can i use mBeconManager.addMonitorNotifier method?
Thanks in advance?
In general, it sounds like you are taking the right approach by sorting the results of didRangeBeaconsInRegion callback.
However, you should be aware that the beacon.distance estimate is are based on a running average of all the RSSI readings received in the past 30 seconds, which may be too long of an averaging time for your use case. You can make the distance estimates be based on a shorter 5 second averaging interval with code like below:
RunningAverageRssiFilter.setSampleExpirationMilliseconds(5000l);
However, if you do this, be warned that this will increase the "noise" on your distance estimates. To counteract this as much as possible, configure your beacons to advertise as much as you can, at least at 10Hz.
Read more here.
I'm using my iPhone as an iBeacon device, and on the other side I have an Android 4.4.2 device scanning for the Bluetooth LE iBeacon signal from the iPhone. I searched for a good and easy way to calculate the distance between iBeacons and my Android phone, but I couldn't find anything that can help me with this.
Could you help me on this matter?
It's impossible to measure beacon distance accurately, I'm afraid, which is why Apple's own code just says "Immediate", "Near", "Far" and "Unknown". The best you can do is set up a reconstruction of the conditions you expect then do trial and error tests to map signal strength to probable distance. Trust me: I've spent a lot of time trying to do beacon distance measurement using a range of hardware.
Remember that the LE in Bluetooth LE means "Low Energy" – this stuff really is designed to use as little power as possible. That means the signal from iBeacons gets interrupted by people, walls and other objects. So, if I'm holding a beacon in my hand and put my phone next to it, I'll get a strong signal. If I move the beacon behind my back, the signal strength will collapse. If I just turn around, that has the same effect (for the same reason).
If you want to go down the "best you can do" approach, you effectively have to recreate at least partially the environment where your app will be used. So, if your app will be used in an office, find an office and place some beacons around there. Same for being in a shop.
Then get your app out and measure beacon strength at various distances to the beacon, potentially with obstacles in the way. With some averaging, you end up with something like "at 1 metre my signal strength was X, at 5 metres it was Y, at 10 metres it was Z", etc, and you then feed that into your distance calculation. It is, effectively, an educated guess.
If you find any library that claims to do beacon distancing for you, it just means they've taken their own educated guess based on their own signal strength testing.
One tip: if you're able to, stick your beacons to the ceiling. This minimises the chance of obstacles (read: people) getting between your beacon and your app.
We built a distance estimation formula into the Android Beacon Library of the form: d=A*(r/t)^B+C, where d is the distance in meters, r is the RSSI measured by the device and t is the reference RSSI at 1 meter. A, B, and C are constants. You can read more about it here. To use it with the library, you range for a beacon and then simply call:
beacon.getDistance();
This returns a distance estimate in meters. The library code is open source, so if you don't want to use the library you can copy the formula and use it directly.
As #TwoStraws notes, distance estimates are pretty rough guesses of how far a beacon is away, and the results you get vary with lots of factors:
The gain of the antenna on the receiving device. (Every Android device model is slightly different)
The noise on the A/D converter inside the phone that measures bluetooth signal strength.
The radio noise in the room.
Any obstructions between the transmitter and receiver.
Any surfaces (especially metal) that reflect radio signals.
Just be sure you set your expectations properly. Distance estimates are good for deciding if a beacon is close or far, or whether one beacon is closer than another. But they are less useful for measuring absolute distance.
Recently we purchased a set of 6 beacons from Kontakt. For some reason the values of RSSI averaged over a period of time do not appear consistent. Could someone help me improve my understanding on the following questions?
If TxPower of a beacon is -77, what would be the standard deviation in the RSSI value returned by getRSSI() in an iPhone 5 at 1m from the beacon?
Would 2 beacons give more or less identical RSSI value, provided that they are placed in same orientation, same configuration(power level & advertising rate), same distance, same relative location from the same phone?
Would 2 beacons give same value for getProximity(), provided the above said similar conditions?
Moreover the batteries are draining at different rates even though all of these beacons are having similar settings for TxPower and Advertising Rate.
Thanks again.
In theory, you should get similar results with identical beacon transmitters configured the same way. RSSI will vary with radio noise, multipath and obstructions. If you can keep the physical environment identical between tests, you can eliminate multipath and obstructions from the equation, leaving only radio noise.
I don't have a standard deviation value, but if you are seeing an average RSSI of -77dBm at 1 m (that's what the TxPower calibration value means) then in practice you may see this number vary by about +/- 10dBm.
The radio noise means that nothing is ever perfectly repeatable (questions 2 and 3), but averaged over long periods of time, you should get similar results.
You can read more about beacon ranging here: http://developer.radiusnetworks.com/2014/12/04/fundamentals-of-beacon-ranging.html
Of course, it is also possible that your multiple beacons are not behaving the same way. I have no special knowledge of Kontakt beacons, so I cannot speak to that possibility.
For my project I need to estimate the distance between a Smartphone and a bluetooth module. The Estimation doesn't have to be very precise. I only need to determine the distance with a margin of error of about 50cm.
I did test the RSSI of two bluetooth modules at distance-steps of 10 cm. I measured the RSSI 5 times for each step and got the average of the 5 measurements. The averages are shown in the graph below:
The red and blue lines resemble the two Bluetooth modules. You can see that the results are not very linear. One of the reasons for this is interference, so i searched for ways to tackle the interference issue. Two ways i found are:
Signal Noise Ratio(SNR): Understanding ibeacon distancing
ratio of the iBeacon signal strength (rssi) over the calibrated transmitter power (txPower). The txPower is the known measured signal strength in rssi at 1 meter away: http://www.princeton.edu/~achaney/tmve/wiki100k/docs/Signal-to-noise_ratio.html
However i don't really understand how the above techniques would be used to get more accuracy. For SNR i need the Noise value, how do i even get the Noise value?
For ratio rssi/txPower, I can get the txPower by simply measuring the rssi at 1 meter from the module. So I know all the needed values. But I don't know what to do from here on out. How do i use these values to get a more accurate distance estimations?
Are there any other techniques i can use to improve accuracy?
You are running into the practical limitations on this technology. Getting estimation accuracy of +/- 50 cm may be possible under ideal conditions at short distances (under 2 meters) not at long distances of over 10 meters.
I wrote a longer blog post about the limits here: http://developer.radiusnetworks.com/2014/12/04/fundamentals-of-beacon-ranging.html
To answer your specific questions:
No, there is no practical way to know what part of a single RSSI measurement comes from signal and what part comes from noise. You can take an average over many samples, which partially removes noise if the transmitter and receiver are stationary over the sample interval.
The techniques you ask about do work to give you distance estimate, but they have the limitations of the technology described above.