I noticed there are two formula to get distance by beacon
LINK
(1)d = 10^((Measured Power - Instant RSSI)/10*N)
N is the constant for the environmental factor. It takes a value between 2-4. The measured power is the RSSI value at one meter.
This is another formulaLINK:
(2)d=A*(r/t)^B+C
r is the RSSI measured by the device and t is the reference RSSI at 1 meter. A, B, and C are constants.
Which one is the formula I should use? Or Are these two formulas equivalent?
The first formula is from physics for calculating path loss or radio waves. Use the first formula if you are making theoretical calculations for academic purposes.
The second formula is a power curve that has a similar shape. It is useful for simulating the first formula when need to do a curve fit, because it is supported by a number of statistical software packages (the first formula is generally not supported to do this). Use the second formula if you need to calculate the curve fit for measured data points of distance vs. RSSI for one or more Bluetooth receivers.
The Android Beacon library uses the second formula in order to best match distance vs. RSSI for various phone models.
Related
Assume that I have 3 beacons in a horizontal line, I want to check the distance how far away from mid point, so I want to get the positive and negative value of the area. Which mean I want to declare the right or left position of the beacon, so I can estimate the point of current location of the beacon.
This is the something looking like the google map navigation, I want to show the pointer on the circle area with horizontal line, so before that I want to know how to get the positive or negative X-axis of the Ibeacon.
There are solutions to this problem. but they are complex and we'll beyond what can be answered with a simple code snippet in a StackOverflow answer.
The primary issue is that beacon signals are omnidirectional. So if you estimate based on the beacon's signal strength that you are 3 meters away, you have no idea which direction. For the 2D axis in your question, you do not know if you are left or right.
The second problem is that once you get beyond 1-3 m, the noise on the signal measurement gets quite high, making the error on the distance estimate high as well. This makes techniques like trilateration work poorly even at such moderate distances.
For 2D indoor location, the general solution is to use RSSI fingerprinting. This requires a training data set where a vector of relative signal levels of each beacon is recorded at each point on a 2D grid. (The same would work for a 1D line.) After training, this data set is used to find the location. Create a new vector for the relative signal levels of each beacon. Then search the training set for the closest vector match. That gives you your position.
You can look up a concept known as trilateration or multilateration. Given that you know the position of at least 3 beacons, positioned in such a way that they're separate but with signal overlaps, you can solve for an arbitrary point between those beacons.
So what your mobile app needs to do is :
1) Have knowledge of the position of each beacon.(e.g x,y) before hand. These positions can be arbitrary as long as they're consistently applied for all beacons in a coordinate system
2) Scan for each beacon's advertising data which should include that beacon's RSSI. You can use that to estimate the distance of each detected beacon from your phone.
3) Knowing the position of each beacon and the distance of your phone from each, you can compute the position of the phone relative to the beacons using a multilateration function. Plenty of libraries out there that can do this, something based on non-linear least squares algorithm can work.
I've done the above on some indoor nav apps, and the quality and accuracy depends highly on your beacon positioning. You need to ensure that in any area you want to cover that there are 3 to 4 beacons positioned nearby to provide decent RSSI readings.
we are proposing a project of measuring the length and width of object using android's accelerometer and gyroscope sensors.
we plan to implement it by simply hovering the smartphone over the object, with start and stop buttons.
i know there are a lot of articles about measuring distance but there isnt an exact one about measuring lengt and width, added to the fact that measuring distance using these 2 sensors give out measurements with great error percentages and need filters like kalman.
so in this day, is it possible for us to accurately measure objects using these 2 sensors?
Both the gyro and the accelerometer measure rates of change. i.e. derivatives of distance and/or angle. Integrating these values to get distances (length) is very noisy and errors accumulate very very fast. So unless you have some additional way to correct for drift errors your measurements will quickly become irrelevant.
GPS and magnetometer, measure absolute values relative to some global frame of reference. If your distances are large enough, then you may be able to use these as absolute reference points.
I understand that there are three approaches for it
GPS Based: Add up short distances travelled (calculated using Location.distanceTo) in small time intervals (5-10 secs), but this method is prone to GPS errors and would not work indoors or in short running area (like a small park)
Double Integration of acceleration: I can do double integral of accelerometer data to calculate distance but errors due to noise in accelerometer readings may add up.
Step counting: I can detect steps by measuring spikes in accelerometer data OR using Google Fit API and then multiply the total number of steps with the average stride length. But the problem here is figuring out average stride length.
I am inclined towards using #3 as it works indoors and is not much error prone OR battery draining. But How do I get average stride length for each step, especially when runner's stride varies in length when sprinting and jogging.
Does anyone know of any combination of these methods to get the best results? OR any other totally different but efficient method?
Well it's engineering - there is no simple answer ;)
All these methods you've mentioned has their pros and cons.
GPS tracking won't sumarize errors of each measurement - it's great but on the other hand each location will be given with noticeable error. What is more you'll have problems with using your app in buildings etc.
Double integration of acceleration works great on small distances by the time error grow to big number. It is also difficult to create program which will calculate it in appropriate way. There is a lot of important issues like e.g time of sampling or rotation and translation matrix calculation that makes these application very problematic on android.
In my app I used following algorytm:
Calculate location from GPS (from Network provider or GPS provider - best precision wins)
Start using accelerometer-based algorytm.
Stop using accelerometer-based algorytm when:
GPS and accelerometer measurements are very different
Accelerometer-based algorythm finds that calculated quaternions are different from what magnetometer says.
The velocity or acceleration from measurments is bigger than given value.
Go to point 1
Hope it helps
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.
I have an app that scans for a specific UUID that another phone is broadcasting and measures the signal strength between them and tells you whether you're getting closer or further away from them. I want to add an arrow for direction. I know you can use triangulation if you have 3 points but I want to get something somewhat accurate with 2 points.
Any algorithm or suggestion that would help?
My current idea (since for this app's use case one node will be relatively still) is to have some algorithm learning as you walk. Like if you get further away the arrow knows to disregard this direction and keep refining itself as you walk different directions.
I found a bunch of research papers on the topic but I'm not an electrical engineer so it's easy to get lost. Also I read this post and understand the many pitfalls How to measure distance between two iphone devices using bluetooth?
Thanks!
Such a solution is extremely convoluted.
Getting the direction of the signal requires far more data than normal app usage can provide. The user would have to slowly rotate the phone while taking many samples of all directions.
Getting the relative distance, as you said like "getting closer" or "going farther away" is kinda possible within a 12 meter range using the formula posted below. Above 12 meters it gets very buggy. But it's quite complex and requires you to use a moving average solution with a length that you consider adequate.
You can calculate the relation between RSSI and distance using the following formula:
RSSI = -(10*n*log10(d) + A)
In this case,
n = path loss exponent, since you don't want an exact distance, just a way to check if it's closer or further, you can use 2 as a value, I found this the most realistic one in most cases.
A = the measured RSSI value at 1 meter distance, you need to measure this in advance to do your calculations, but since this varies a lot, just use a value like -60dB. Also this one is about average in most situations.
So getting a crudely guessed distance in meters can be achieved by the formula:
distance = 10 ^ ((-RSSI - 60) / (10 * 2));
This isn't very exact but will be sufficient to tell you if it is closer/farther within a limited range.