Ble distance calculation using Time - bluetooth-lowenergy

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.

Related

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.

How to interpret MQ5 gas sensor readings?

I am trying to get the dangerous value of LPG leak using MQ5 Gas sensor. But I don't know the value from serial monitor that the analog reads. Is the output of gas sensor in ppm?
You need to provide more information for people to help answer the question. You need to provide a circuit schematic, how you are interfacing it to the microcontroller etc.
However, it is unlikely you are getting a PPM reading from the sensor unless you have calibrated the sensor and developed a function to convert voltage (or resistance) to a gas concentration. First of all, you typically need to calibrate the sensor by exposing it to a known concentration of the analyte (gas) and measuring the voltage / ADC reading. Second, those types of sensors usually have non-linear response to the gas concentration, therefore developing a calibration function is difficult (and you need to characterize the sensor's response to different levels of gas concentration to develop an algorithm). There are many ways to do this, but that can be an expensive and time consuming process. What compounds the problem is that different sensors typically exhibit different responses to the same gas concentrations between batches or even two sensors from the same batch. The sensors are also sensitive to temperature, relative humidity and other contaminants which can skew the readings. These sensors can be useful for generally detecting the presence of the analyte (gas), but typically aren't very useful or accurate when estimating PPM within a reasonable error margin. There are also many variables to control with that sensor such as the heater voltage, heating pulse duration, load resistance, etc. These sensors have MANY cross sensitivities and responses to other analytes (other than LPG).
If you have implemented the sensor as per the manufacturer's data sheet and have converted the resistance into a usable voltage and are reading the values from an ADC, you may be able to interpret the ADC readings as general indication of the presence of the gas (but maybe not.. you could be measuring humidity fluctuations), in any case you would likely need to calibrate the sensor and develop an algorithm to estimate the PPM.
It appears from looking at a couple websites that this sensor returns the value of Rs (sensing resistance).
Looks like you will have to calculate a ratio of Rs/Ro (Ro being the resistance of "clean" air) for which you would derive the ppm from the MQ5 datasheet graph.

estimating distance to ibeacon AVR

I want to ask about I Beacon advertising, especially Tx Power.
I used two BLE module HM10 and HM11. I make one as a ibeacon (HM10). and other one used to connect and listen to HM10 broadcasting.
I used MCU ATmega32 AVR tied with HM11 and I used scanf function to read the broadcast. I want to extract the last byte (Tx Power). I want to measure the distance with AVR programming.
Could you tell me the algorithm?
The formula Apple uses to calculate a distance estimate to an iBeacon is not published. There are a number of alternative formulas including this one, based on a best fit power curve, that we wrote for the Android Beacon Library.
Further research we have done shows that the formula above basically works, but it has two main imperfections:
It does not work well for weaker beacon transmitters. With weaker broadcasts, the distance is underestimated.
It does not account for varying signal gains in receivers. Different receivers have different antennas and receivers which measure the same signals differently.
There is an ongoing discussion of the best formula here.
A bit late but hopefully useful to others. I have given up on Apple's "Accuracy" number; as #davidyoung points out, different devices will have different signal gains. Now I am not an engineer but more of a math and statistics person, so I have gone down the route of "fingerprinting" an indoor space instead. Essentially I read all RSSI from all beacons installed in a certain "venue". Some might not be within reach and therefore I just assume, in such cases, an RSSI of -95 dBm (which seems to be the floor past which a signal is not read any more). Such constituted array has the same beacons in the same positions at all times (even across app launches). I compute a 5 seconds moving average for each beacon (so a I se 5 arrays to do that). The resulting avg array is then shifted up by 95 units and normalised so that the sum of all of its values is one. If you want to tag an an indoor "point" you collect many of these normalised average arrays on that specific spot. I go ahead and construct a database of "spots". To forecast your proximity to any spot in a database you simply compute a quadratic distance of your current reading and the all of the fingerprints in the database.
Which beacons to use? At least class 2 in power. How many? At least a couple per room (put them in two adjacent corners, on the ceiling or high up).
The last step that you need to do is match the fingerprints with an x,y coordinate on your map. I never did this step, because I am mainly interested in proximity applications and not fully fingerprint and indoor space.
Perhaps the discussion above will serve you as a guidance on a technique that is used by many indoor location companies.
Disclosure: I have recently open sourced my code doing the above calculations.

Modeling communication costs in MPI

Does anyone know of any papers that discuss communication costs in MPI programs? I am trying to predict the time taken by (say) the communication step in two phase I/O. That would depend on the no. of processes, the size and number of messages sent/received, network interconnect and architecture, etc. It would be helpful for us to come up with a formula to assess the time taken by communication alone. I have read some papers , but none of them handle the case where multiple processes are communicating at the same time.
The most critical elements in any time estimate will be the total data to be sent, and the speed of the interconnect. That should give you an effective "minimum" time for the message transfers.
After that, you can measure the actual time taken and use that to determine a rough efficiency rating for the MPI implementation. As the amount of data scales up, the time required will also scale up using the scale factor. This is a very rough way to get an estimate. Keep in mind that as the data size crosses certain interesting thresholds (e.g. page size, cache size, and so on) the scale factor will likely need to be revised.

What is relation between MCPS(million cycles per second) and power consumed

I have been working on a ARM cortex A8 board on mp3 decoder.
While doing this i have a requirement saying the mp3 decoder solution i am doing should consume 50 milli-watts of power. This generated few questions in my mind when i thought about it:-
1.) I recall that there is some relation between the Core Voltage applied(V), the clock frequency(f) of a processor and power consumed(P) as something like P is directly proportional to the voltage and frequency squared. But is the exact relation. Given operating clock Frequency, voltage of a processor, how can we calculate power consumed by it.
2.) Now if i get the power consumed from step 1.) at some clock frequency, and i am told that the decoder solution i am giving, can consume only 50 milli-watts, how can i get the maximum limit on MCPS, which will be the upper bound on the MCPS of my decoder solution running on that hardware board?
Can i deduce that if power obtained as in step 1.) say P, is consumed at frequency F, so for 50 milli-watts power, what is clock frequency frequency and calculate accordingly the frequency. And then call this frequency as my code MHz (MCPS) upper bound?
Basically how does one map(is there any equation) power consumed by a software to MCPS consumed
I hope this is relevant here, or should it go to superuser?
Thank you.
-AD.
It really depends on the architecture.
From their own page:
Core area, frequency range and power consumption are dependent on process, libraries and optimizations.
Power with cache (mW/MHz) <0.59
<0.45
Basically, it states that you can't accurately calculate the power consumption, so your best bet would be to do some measurements yourself. Try to run a full CPU-usage application and meassure the power consumption. It will give you some idea of the max-load, which will be a good start for you (to know how much you need to optimize your code and insert idle points).

Resources