How to calculate distance from RSSI and TXPower? - bluetooth-lowenergy

I have searched lot of but could not get result or not even know is that result correct or not.
I do have BLE which sends RSSI and TXPower. Actually I am trying to find distance with value of RSSI and and TXPower but can't get correct one. I have followed this and also this as well but don't know which one is correct. What will be the correct formula to get distance from RSSI and TXPower

Related

longer distance ultrasonic LabVIEW

I'm reading the distance with Arduino ultrasonic kit. i want to show the longest distance during the session. i used shift register to have a previous value then I compared them with new the new one, but I think my algorithm is wrong.
Thanks for your help.
You should store the longest distance in the shift register, not the previous value.
Basically in your code, it should be enough to connect "Select" function output to the input of the shift register, like this:

Ble distance calculation using Time

Is it possible to calculate distance between BLE-BLE or Beacon-BLE device using Time(T) taken on packet received on receiver device with measured power or RSSI value?
Is there any formula for that?
You can get a formula for estimating distance from time of flight measurements from this paper.
However, commercially available Bluetooth chipsets do not provide accurate timers capable of measuring time of flight. Further, smartphones do not provide access to such time of flight data. As a result, such a formula is if little practical value for most use cases.

Finding distance between 2 devices

I wanted to know if there is any efficient way of finding the distance between 2 devices(a transmitter and a receiver) which is accurate to atleast the order of a couple of inches.
I am basically want to detect the movement of the transmitter from the receiver and how far it has moved from its original position.
I was thinking in terms of using a wireless hotspot/bluetooth connection. I cannot Use some form of audio/medium which can be detected by humans.
Could anybody help me with this?
To my mind, assuming there is no common synchronisation signal between the devices, there are 2 differents way to do this (not really easy):
1. Measure received power : some receivers provide RSSI (Received Signal Strength Indication). RSSI is a measure of how much power you received. If you know the transmitted power, you can estimate the transmission loss (from the transsmission channel) by taking different measure of RSSI at different distance. It will really depends on the channel (environment, frequency, throughput, ..), so don't change it for the measure. Once you got enough points, try to fit it by a curve. You can now predict distance by having RSSI.
2. Measure round trip time : this is called RADAR, and is really more difficult but is the classic way to measure distance and speed. Broadband systems (like WiFi) are better for this kind of measure. By the way you also can do the same with audio for short distances (SONAR), without being detected if you use frequencies higher than 20kHz.

Measure distance of a pulley in Arduino/Raspberry PI

I'm trying to measure the distance an object is pulled along a pulley track using arduino (or Rasp Pi) sensors. I have an object that is manually pulled, from a resting position, on a pulley system and I need to be able to track the distance it travels over one pull.
Example: The object traveled 90% (example) of the total pulley distance for 5/10 pulls.
Example: The object traveled 11.53 ft along the pulley.
See the image below for a visual diagram. I have two ideas, but I'm not an Arduino sensor expert. I'd love input on an elegant solution.
Use an arduino sensor to sense how many times the pulley rotates, and then use an equation to determine the distance.
Use a sensor that senses the distance pulled in cord, maybe each direction, and record that distance. I got this idea from pump sensors, no idea if a comparison exists.
Really just looking for advice on what sensors to use, how to implement them (general), and what type of metrics I could record.
There are at least two ways of doing this:
Use a rotary encoder, which will tell how many rotations the pulley did. There are two disadvantages: line can slip on the pulley, resulting in inaccurate measurement, and there is no way you can now at what actual position the object is. Rotary encoder will give you only position relative to the starting position (unless you only need one rotation of the pulley - then you can use absolute encoders)
Use a distance sensor (ultrasonic, or IR) to measure at what height is the object. That way you will know the exact position of the object, but you may have a problem if your object is too small, has a shape or surface that will impact the measurements, or if the space is limited and a sensor can pick up walls, or other surrounding objects. Also if the objects may swing on the rope, there will probably a problem.
Software implementation for all of these solutions should be pretty simple, just decide on type of sensors - there are plenty of tutorials for all of them.
Both task 1 and 2 can be done easily using a digital rotary encoder at very nominal cost. It can sense direction and distance of travel quite accurately.

ATmega128 microprocessor, issue regarding error when measuring distance in timer ticks?

Ok, so a laser on earth hits a mirror on the moon and bounces back. On the ATmega128 microprocessor, we use TIMER1 to capture the clock ticks when the laser shot out and the clock ticks when it returned, subtract and get a "distance" in clock ticks. (16MHz clock on ATmega128).
So we are supposed to determine how different can this measured distance be from the actual distance and what can cause it. As well as compute max error in each legal prescaler of TIMER1.
Looking at TIMER1's registers and input capture information in the ATmega128 datasheet I cannot find any kind of percentage error with the input capture. Like, this seems like a conceptual question, yet we are supposed to pull values out of the air and calculate something?
My question is if anyone knows anything of ATmega128, what values are being referred to in determining error from reading distance with timer ticks? My only guess is the error occurs when you use higher and higher prescalers because you lose preciseness when prescalers get larger. But again this is a conceptual answer and don't understand how I would calculate anything.
The counters/prescalars can be assumed to be perfect and will not cause any loss of resolution.
Your original clock source will be a predominant source of errors. If you are using an external clock with a crystal, these are usually good to 50 ppm (part per million) or better. If you are using an internal clock, the error is much higher (1% is not unreasonable for some microcontrollers).
The whole thing gets tricky if you remember your general relativity (you do have a PhD in Physics right?). The earth's rotation and gravity come into play wrt the speed of light and distance...

Resources