Indoor location starts by asking what decision the position must support inside the building. A room-level asset search, shelf-level retail prompt, and centimeter-level robot path need different infrastructure, calibration, privacy language, confidence, and fallback behavior.
In 60 Seconds
GPS fails indoors due to signal attenuation (20-40 dB through building materials), requiring alternative technologies: BLE beacons (1-3m accuracy, low cost), Wi-Fi fingerprinting (3-5m using existing infrastructure), UWB (10-30cm precision but expensive), and ultrasonic (3cm but requires line-of-sight). Real-world applications use sensor fusion – combining GPS, Wi-Fi, BLE, and IMU with Kalman filters – to provide seamless indoor-outdoor positioning with smooth technology handoffs.
Chapter Roadmap
This chapter is long, so use it as a guided design review.
First define the indoor place model: room, floor, aisle, route, confidence, and degradation state.
Then compare the radio, sensor, floor, camera, and check-in technologies against the job they must support.
Next work through BLE, Wi-Fi fingerprinting, UWB, and sensor fusion examples with their calibration assumptions visible.
Finally choose a technology stack, test its failure modes, and verify the answer with quizzes and hands-on exercises.
Checkpoint callouts recap the decision so far. Optional worked examples can be read as deep-dive evidence after the main path is clear.
34.2 Learning Objectives
By the end of this chapter, you will be able to:
Compare Indoor Positioning Technologies: Evaluate Wi-Fi, BLE, UWB, and ultrasonic systems for accuracy and cost
Apply Trilateration Calculations: Compute position estimates from beacon distance measurements
Design Sensor Fusion Systems: Combine GPS, Wi-Fi, BLE, and IMU for seamless indoor-outdoor transitions
Troubleshoot Multipath Effects: Identify and mitigate RF interference in indoor environments
Indoor Positioning Basics
GPS does not work indoors – building walls attenuate satellite signals by 20-40 dB, making them too weak to use. So how do you track assets, guide visitors, or locate equipment inside a warehouse or hospital? Indoor positioning uses alternative technologies: BLE beacons (1-3 meter accuracy, cheap), Wi-Fi fingerprinting (3-5 meters using existing infrastructure), UWB (10-30 centimeter precision but expensive), and ultrasonic (3 centimeters but needs line-of-sight). Real-world systems combine multiple technologies with sensor fusion to provide seamless positioning as you walk from outdoors to indoors.
Key Concepts
GPS: Global Positioning System providing 3-10 metre outdoor accuracy using triangulation from 4+ satellites, consuming 20-100 mA active current.
Indoor Positioning: Techniques (BLE beacons, UWB, Wi-Fi RSSI, IMU dead-reckoning) achieving 0.1-5 metre accuracy where GPS signals are unavailable.
Geofencing: Virtual geographic boundary triggering automated actions when a tracked asset enters or exits the defined area.
Dead Reckoning: Position estimation using last known location plus measured movement (speed, heading) when GPS signal is lost.
RSSI-Based Positioning: Location estimation from signal strength of known beacon nodes, achieving 2-5 metre accuracy in calibrated environments.
Ultra-Wideband (UWB): Radio technology providing 10-30 cm indoor positioning accuracy using time-of-flight measurements between anchor nodes.
Location Privacy: User right to control who can access their location history and how granular that location data is stored.
Start with the product promise, not the radio. The first question is what kind of indoor answer a user or operation can act on.
34.4 Indoor Place in Building Models
Indoor positioning is rarely about latitude and longitude. The useful answer is usually a building, floor, room, aisle, doorway, dock, bed bay, exhibit, or safe walking route. That means the location system must connect radio or sensor measurements to a maintained floor plan, not just compute a coordinate.
The same measured position can support different user experiences. A visitor app may show “near gallery 4.” A hospital equipment system may show “infusion pump in room 305.” A warehouse workflow may show “pallet in aisle B, bay 12.” A robot may need the coordinate, heading, obstacle state, and confidence before it moves.
Indoor location products usually combine several weak signals, then translate the fused estimate into a place a person or system can act on.
The product promise should therefore name the usable granularity. “Find a pump on this floor” is different from “guide a visitor to the lift,” “confirm a worker entered a restricted zone,” or “dock a robot to a charger.” Each promise needs a different tolerance for floor errors, stale positions, latency, and privacy exposure.
A simple application taxonomy keeps the old localization vocabulary connected to product decisions. Location evidence can support indoor navigation, motion capture, warehouse or hospital object tracking, access control, SLAM-style mapping, headcount, event detection, weather-at-place services, car-navigation handoff, and nearby-printer selection. The evidence may come from RF measurements, LiDAR or camera maps, cameras on the user or in the environment, ultrasound or microphone timing, powerline or floor-load signatures, and IMU dead reckoning from acceleration and heading. GPS belongs in the handoff story: it can seed an outdoor fix or differential-reference correction, but it is not an indoor answer by itself.
Represent the answer at the level the application can defend. Some systems store absolute latitude-longitude or map coordinates. Others store a relative phrase such as “one bay north of the dock.” Many user-facing systems store symbolic places such as “home,” “work,” “bedroom,” “room 305,” or “aisle B.” Location can also be a proxy for activity, but only when the surrounding evidence supports that inference; proximity to a bed bay, vehicle, printer, or tool rack does not by itself prove what the person is doing.
Indoor systems also need explicit degradation states. If the app cannot distinguish room 305 from room 307, it should say “near rooms 305-307” or show a zone, not invent certainty. If a floor plan is old, if a beacon battery is low, or if an access point moved after the last Wi-Fi survey, the interface should lower confidence and invite confirmation instead of silently routing through walls.
Semantic place: define the room, zone, shelf, doorway, floor, and route labels before choosing the radio technology.
Confidence: show proximity, zone, or exact position based on the uncertainty and the consequence of being wrong.
Ownership: keep beacon batteries, anchor locations, access-point changes, floor-plan versions, and recalibration on the operating plan.
Checkpoint: Indoor Place Model
You now know:
Indoor positioning usually returns a usable place such as a room, aisle, doorway, dock, bed bay, or safe walking route.
The same measurement can support navigation, asset tracking, access control, SLAM-style mapping, or nearby-printer selection.
A responsible interface shows lower confidence when it cannot distinguish rooms, floors, stale maps, moved access points, or low beacon batteries.
34.5 Match Tech to Indoor Jobs
BLE proximity, Wi-Fi fingerprinting, Wi-Fi RTT, UWB ranging, ultrasonic beacons, QR/NFC check-in, camera/vision, powerline fingerprinting, active floors, barometers, and IMU dead reckoning each fail differently. BLE advertising is inexpensive but RSSI changes with bodies, shelves, doors, and phone orientation. Wi-Fi fingerprinting can reuse access points but drifts when the building changes. Wi-Fi RTT using IEEE 802.11mc can improve range estimates when compatible access points and devices are available. Powerline positioning reuses electrical infrastructure but still needs a room-by-room signature map. Load-sensor floors can detect footsteps and gait accurately, but installation is invasive and multi-user separation is hard. UWB systems based on IEEE 802.15.4z can support precise ranging but need planned anchor geometry and site commissioning.
Design the indoor workflow around the tolerance. Room-level asset tracking can often tolerate BLE plus map constraints. Turn-by-turn visitor navigation needs route instructions, floor transitions, elevator/stair handling, and clear “you are near” language. Robot docking, augmented reality alignment, or high-value tool tracking may justify UWB anchors, calibration tags, tighter time synchronization, and alerts when anchor health degrades.
A classroom-style BLE localisation prototype is a useful minimum evidence path. The embedded device scans known beacons, records the beacon identifier, encounter time, and RSSI, then uploads the scan through a phone or Bluetooth gateway to a cloud service. Phase one proves the scan and upload path; phase two turns those records into a propagation model, distance estimate, placement assumption, and visualisation that a user can interpret. Keep the device, gateway, cloud API, and dashboard responsibilities separate so a working graph is not mistaken for proof that localisation itself is accurate.
Commissioning should be treated as part of the product, not as a one-time installation chore. Walk the building with known test points, record expected floor and room labels, validate lifts and stairwells separately, and include difficult cases such as crowded corridors, metal shelving, glass partitions, equipment rooms, and phone-in-pocket movement. Keep a small regression route so every firmware update, map revision, anchor move, or access-point replacement can be checked against the same evidence.
For UX decisions, expose the accuracy class rather than the raw technology label. A clinician needs “in room 3A, last seen 22 seconds ago,” not “UWB anchor set 4 residual 0.21 m.” A visitor may need a walking instruction plus a “recenter” button. An operations dashboard may need battery health, stale anchors, survey age, and the percentage of events corrected by map matching.
Map the places: give every room, aisle, shelf, anchor, beacon, access point, and transition a stable id and map version.
Set the handoff rules: define how GPS, BLE, Wi-Fi, UWB, IMU, barometer, QR, and manual confirmation combine when someone enters or leaves a building.
Plan recalibration: schedule checks after access-point moves, beacon battery changes, shelf rearrangement, construction, and seasonal occupancy changes.
34.6 Indoor Accuracy Needs Infrastructure
An indoor location event should include more than x/y coordinates. Useful fields include floor id, map version, source technology, beacon or anchor ids, RSSI, path-loss model, UWB range residuals, Wi-Fi BSSID list, Wi-Fi RTT distance estimates, accelerometer step count, gyroscope heading, barometric floor estimate, confidence score, age of observation, and whether map constraints changed the raw estimate.
Keep the measurement model visible to operations. BLE beacons may use iBeacon, AltBeacon, or ordinary Bluetooth LE advertising payloads. UWB anchors need known coordinates, clock behavior, channel configuration, and non-line-of-sight detection. Wi-Fi fingerprints need survey-device metadata and re-survey dates. Sensor-fusion code should preserve source weights and rejection reasons so a support team can tell whether the issue is a missing beacon, a moved access point, a bad floor plan, or a phone sensor problem.
Different estimators fail for different mathematical reasons. BLE RSSI ranging depends on a log-distance path-loss exponent, so a concrete corridor, a human body, or a metal cabinet can turn a small RSSI change into metres of distance error. Wi-Fi fingerprinting is a nearest-neighbour or probabilistic match against a surveyed signal database, so it fails when the database no longer represents the building. UWB two-way ranging and time-difference-of-arrival systems depend on timestamp precision, anchor geometry, clock handling, and non-line-of-sight rejection.
The algorithm names describe what information the system trusts. Proximity chooses the nearest beacon or zone. Lateration estimates position from distances to known anchors; trilateration is the familiar two- or three-dimensional case, while hyperbolic lateration uses time-difference-of-arrival curves. Triangulation uses angles. Fingerprinting compares an observed signal vector with a surveyed database. Distance estimates can come from time of flight, round-trip time, time difference of arrival, or signal-strength attenuation, and each method needs its own calibration and line-of-sight assumptions.
Classic indoor-location systems make those choices concrete. Active Badge used infrared proximity at Olivetti Research Laboratory. Active Bat used ultrasonic time-of-flight pings to reach roughly 3-10 cm resolution. UbiSense used 6-8 GHz UWB with time-delay and angle-of-arrival evidence, often trading 15-30 cm accuracy against line-of-sight and installation difficulty. RADAR treated Wi-Fi signal strength as a fingerprinting problem with about 3-5 m resolution, while PlaceLab combined multiple crowdsourced radio observations. Powerline positioning and active-floor systems are the same lesson in a different substrate: reuse the electrical wiring or instrument the floor, then prove the signature, installation boundary, gait or footstep inference, calibration age, and whether multiple people can be separated. The lesson is the evidence contract: proximity is simple, lateration needs enough reference points, hyperbolic lateration depends on arrival-time differences, triangulation needs directional or beamforming evidence, and fingerprinting avoids explicit RF propagation modeling only by requiring a dense site survey that must be refreshed when the building changes.
Cellular and visible-light systems sit at the edge of the same design space. A phone can be localized coarsely by the cellular network because it must register with a base station; denser deployments can add uplink time-difference-of-arrival, angle, or signal-strength evidence, but the result is usually a zone or emergency-location fallback rather than room-level proof. Visible-light positioning reverses the beacon idea: ceiling LEDs flicker faster than humans perceive, encode an identifier, and let a phone camera decode the light source to infer position. Optical room-tracking systems use the same line-of-sight contract in a tighter space: fixed infrared or laser beacons sweep a calibrated room, and a headset or controller estimates pose from timing and geometry evidence. It can be cheap in a controlled retail or museum ceiling, but it depends on line of sight, camera orientation, lighting control, and a maintained map from lamp id to place.
Project Tango-style phone localization is a useful camera/IMU boundary case. Moving computation onto the client avoids a central vision server, but the device still has to fuse motion tracking, depth perception, and area learning into a map it can relocalize against. The review record should name the depth sensor or camera mode, IMU calibration, learned-area version, relocalization failure behavior, privacy boundary for captured scenes, and whether the result is used for navigation, augmented reality alignment, or only a demonstration.
There is no one-size-fits-all localization stack. Higher accuracy usually costs more anchors, calibration, power, maintenance, and deployment effort. A headcount dashboard may only need zone-level Wi-Fi or camera evidence. Access control may need conservative geofence margins. Motion capture, robot docking, and AR alignment may justify UWB, vision, LiDAR, or tighter fusion because the cost of a wrong position is much higher.
Fusion layers normally combine absolute measurements with motion and map constraints. A Kalman filter, particle filter, or hidden Markov model can carry uncertainty through time, reject impossible wall crossings, prefer corridor paths, and smooth handoffs between GPS, Wi-Fi, BLE, UWB, IMU, and barometer signals. The important engineering output is not just the best estimate; it is the covariance, source weights, rejected observations, and freshness metadata that decide whether the UI should show a dot, a zone, or a warning.
Geometry risk: anchors or beacons clustered on one wall produce unstable estimates even if signal strength looks high.
Map risk: a good coordinate on an old floor plan can route a user through a wall, locked door, or closed ward.
Privacy risk: collect room-level or zone-level events when exact paths are unnecessary, and make retention match the operational need.
With the place model and maintenance plan established, the next question is why outdoor GPS is the wrong starting point indoors.
34.7 Why Indoor Positioning is Different
GPS doesn’t work indoors because:
Satellite signals are extremely weak (~10^-16 watts received)
Building materials attenuate signals by 20-40 dB
Multipath from walls, ceilings, and furniture creates severe interference
No line-of-sight to satellites in most buildings
This requires alternative technologies designed for indoor environments.
34.8 Indoor Positioning Technologies
Figure 34.1: Comparison of indoor positioning technologies by accuracy and infrastructure requirements.
Technology
Accuracy
Infrastructure
Cost
Power
Use Case
BLE Beacons
1-3m
Deploy beacons
Low
Very Low
Retail, navigation
Wi-Fi RSSI
3-5m
Use existing
Free
Medium
Zone detection
UWB
10-30cm
Deploy anchors
High
Medium
Asset tracking, AR
Ultrasonic
3cm
Deploy sensors
Very High
High
Precision tracking
Camera/Vision
Variable
Deploy cameras
High
High
Analytics, AR
Powerline fingerprinting
Room/zone
Use electrical wiring
Low-Medium
Low
Infrastructure reuse
Active floor/load sensors
Footstep/gait
Instrument floor
Very High
Medium
Accurate presence or gait sensing
34.9 BLE Beacon Positioning
BLE beacons continuously broadcast identifier packets. Smartphones detect these signals and estimate distance based on Received Signal Strength Indication (RSSI).
Figure 34.2: BLE iBeacons for Indoor Positioning
34.9.1 RSSI-Based Distance Estimation
The relationship between RSSI and distance follows a path loss model:
Interactive Insight: Notice how the path loss exponent dramatically affects distance estimates. Changing n from 2.0 to 3.0 can change estimated distance by 40-60%. In a concrete hospital (n=3.2), a beacon showing -72 dBm is only 2.5 meters away, but the same reading in an open office (n=2.5) suggests 3.3 meters — a 30% error.
Phoebe’s Field Notes: Why RSSI Ranging Needs Calibration
Phoebe’s Why
RSSI ranging is a power problem written in logarithms. A beacon’s field spreads, reflects, and is absorbed by walls, shelves, bodies, and the phone itself. The receiver reports a dBm value, so each extra loss term becomes subtraction, not a neat linear distance ruler. The path-loss exponent \(n\) is the summary of that building. If \(n\) is too small, the formula thinks the same RSSI drop must have come from a much longer distance; if \(n\) is too large, it pulls the fix too close. Multipath adds another limit: two spots at the same distance can have different RSSI because reflected waves add or cancel before the receiver measures power.
The Derivation
Start with received power relative to a calibrated reference distance \(d_0\):
A small RSSI error \(\Delta R\) multiplies the distance by
\[10^{\frac{\Delta R}{10n}}\]
Worked Numbers: This Chapter’s BLE Readings
Use the chapter’s calibration \(\mathrm{TxPower} = -59\) dBm at 1 m and \(n = 2.5\):
Beacon A at \(-65\) dBm: \(d_A = 10^{(-59 - (-65))/(10\times2.5)} = 10^{6/25} = 1.74\) m.
Beacon B at \(-72\) dBm: \(d_B = 10^{13/25} = 3.31\) m.
Beacon C at \(-68\) dBm: \(d_C = 10^{9/25} = 2.29\) m.
The same \(-72\) dBm reading in the concrete-hospital case \(n = 3.2\) gives \(d = 10^{13/32} = 2.55\) m, matching the chapter’s “about 2.5 m” warning.
A \(\pm3\) dB RSSI swing at \(n = 2.5\) multiplies distance by \(10^{3/25} = 1.32\) upward or \(10^{-3/25} = 0.759\) downward, so one noisy reading can move a 3.31 m estimate to about 2.51-4.36 m before trilateration geometry adds its own error.
BLE Beacon Retail Trilateration
Scenario: A retail store deploys BLE beacons for indoor customer navigation. The positioning system uses trilateration from RSSI measurements to estimate shopper location.
Given:
Beacon A at position (0, 0) meters, measured RSSI = -65 dBm
Beacon B at position (10, 0) meters, measured RSSI = -72 dBm
Beacon C at position (5, 8) meters, measured RSSI = -68 dBm
Calibrated path loss model: RSSI = -59 dBm at 1 meter, path loss exponent n = 2.5
Distance formula: d = 10^((TxPower - RSSI) / (10 x n))
With RSSI variance of +/-3 dBm, distance error is +/-30%
Position uncertainty: +/-1.2 meters (95% confidence)
Result: Shopper estimated at (1.5, 0.8) meters with 1.2 meter accuracy, placing them in the “Electronics” zone near Beacon A.
Key Insight: BLE trilateration accuracy depends heavily on path loss exponent calibration. A path loss exponent error of 0.3 (using n=2.2 instead of n=2.5) would shift the position estimate by 0.8 meters. Always calibrate path loss in the actual deployment environment, not from datasheet values.
Checkpoint: BLE Ranging
You now know:
BLE beacons are attractive when low cost, low power, and room or aisle guidance matter more than centimeter precision.
RSSI distance estimates depend on TxPower, the path loss exponent, and real building materials.
Trilateration can produce a useful zone estimate, but the result should carry uncertainty because RSSI noise and geometry move the fix.
34.10 Wi-Fi Fingerprinting
Wi-Fi fingerprinting maps RSSI patterns to physical locations by pre-surveying the space.
Figure 34.3: Wi-Fi Signal Fingerprinting
34.10.1 Two-Phase Process
Offline Phase (Survey):
Walk through the space with a device
At each known location, record RSSI from all visible access points
Build a fingerprint database mapping RSSI vectors to locations
Online Phase (Positioning):
Device scans visible APs and measures RSSI
Compare current RSSI vector to database entries
Find closest match(es) to estimate position
34.10.2 Challenges with Fingerprinting
Wi-Fi Fingerprinting Drift
Environmental changes: Moved furniture, added walls, relocated APs
Temporal variations: Different occupancy (empty vs. crowded) affects propagation
Device variations: Different phones have different RSSI calibration
Hybrid approaches (combine fingerprinting with dead reckoning)
Machine learning (automatically detect and adapt to environmental changes)
Fingerprinting reuses infrastructure, while UWB changes the infrastructure to measure time more directly. That trade moves the discussion from survey maintenance to precision ranging.
34.11 Ultra-Wideband (UWB) Positioning
UWB uses extremely short pulses (nanoseconds) across a wide frequency spectrum (3.1-10.6 GHz), enabling precise time-of-flight measurements.
Key advantages:
10-30cm accuracy: Far exceeds BLE/Wi-Fi
Multipath resistant: Short pulses separate direct and reflected paths
Low interference: Spread spectrum doesn’t interfere with other systems
Apple AirTags (precise “find my” direction finding)
Autonomous robot navigation
Augmented reality anchoring
UWB Time-of-Flight Precision
UWB achieves 10-30 cm accuracy through precise time-of-flight measurement. How does the two-way ranging protocol work?
Traditional one-way ToF problem: If transmitter and receiver clocks are not synchronized, measuring \(t_{\text{receive}} - t_{\text{transmit}}\) gives nonsense (clocks may differ by milliseconds).
Two-way ToF solution:
Tag → Anchor: Tag sends pulse at \(t_1\) (tag clock)
Anchor processes: Waits known delay \(T_{\text{reply}}\) (e.g., 500 µs)
UWB timing precision: With 500 MHz bandwidth, timing precision \(\approx \frac{1}{500 \text{ MHz}} = 2\) ns. This translates to distance precision: \[\Delta d = \frac{c \times 2 \text{ ns}}{2} = \frac{3 \times 10^8 \times 2 \times 10^{-9}}{2} = 0.3 \text{ m}\]
Why real-world accuracy is 10-30 cm (not 30 cm worst-case): Averaging multiple measurements and trilateration from 3+ anchors reduces error by \(\frac{1}{\sqrt{N}}\) where \(N =\) number of measurements.
Figure 34.4: Diagram showing UWB positioning with anchors at known positions and tag at unknown position.
Checkpoint: Precision Systems
You now know:
UWB uses short pulses and time-of-flight evidence to reach the chapter’s 10-30 cm accuracy class.
The gain is strongest for hospital equipment tracking, autonomous robots, augmented reality anchoring, and other high-consequence indoor fixes.
Precision still depends on anchors, geometry, line-of-sight handling, and site commissioning.
34.12 Sensor Fusion for Seamless Positioning
Real-world applications often require positioning that works both indoors and outdoors. Sensor fusion combines multiple positioning technologies to provide seamless coverage.
Indoor-Outdoor Sensor Fusion
Scenario: A delivery driver app must track location seamlessly as the driver moves from outdoor parking (GPS) to indoor warehouse (Wi-Fi/BLE) for package pickup.
Given:
Outdoor GPS position: (37.7749 N, -122.4194 W) with HDOP = 1.2, accuracy = 4.8 meters
GPS signal lost upon entering building (< 4 satellites visible)
Indoor Wi-Fi fingerprint match: Warehouse Zone B, confidence 78%
BLE beacon proximity: Beacon “Dock-3” at -62 dBm (estimated 1.5m distance)
IMU dead reckoning: 12.3 meters walked at heading 045 since GPS loss
Building floor plan constraint: Driver must be in accessible walkway
Steps:
Detect GPS degradation:
Satellite count drops from 8 to 3 over 5 seconds
HDOP increases from 1.2 to 6.5 (poor geometry)
Trigger: Switch to indoor positioning mode when satellites < 4 AND HDOP > 4
Initialize indoor position from last GPS fix:
Last valid GPS: (37.7749, -122.4194) at building entrance
Transform to local coordinates: (0, 0) meters at entrance door
Fuse dead reckoning with Wi-Fi fingerprint:
IMU estimate: (8.7, 8.7) meters from entrance (12.3m at 45 degrees)
Wi-Fi fingerprint center: (10.0, 12.0) meters (Zone B centroid)
Proximity constraint: Driver within 1.5m of Dock-3
Updated position: (8.8, 9.9) meters
Apply map constraints:
Check position against floor plan
Position (8.8, 9.9) is in valid walkway - no correction needed
If position were in wall/shelf, snap to nearest valid location
Result: Driver position estimated at (8.8, 9.9) meters from building entrance with 2.1 meter accuracy. This corresponds to “Loading Dock 3” in warehouse system, enabling automatic package assignment.
Key Insight: Sensor fusion requires careful weighting based on each source’s reliability. GPS provides absolute position outdoors but fails indoors. IMU provides relative movement but drifts over time (1-3% of distance traveled). Wi-Fi fingerprinting gives zone-level position but requires pre-surveyed database. BLE beacons provide proximity anchoring. The Kalman filter dynamically adjusts weights as sensor reliability changes, enabling sub-3-meter positioning across the indoor-outdoor transition.
Figure 34.5: Diagram showing how multiple positioning sources are combined through Kalman filter fusion.
The worked examples have named the evidence sources. The next step is turning those measurements into a repeatable implementation path.
34.13 BLE Beacon Trilateration Engine
This Python implementation computes indoor position from BLE beacon RSSI measurements using the trilateration method from the worked example above. It applies RSSI-to-distance conversion, least-squares trilateration, and RSSI averaging to smooth noisy readings:
import mathclass BLETrilateration:"""Estimate indoor position from BLE beacon RSSI measurements. Uses the log-distance path loss model to convert RSSI to distance, then solves the trilateration system via least-squares. """def__init__(self, tx_power=-59, path_loss_exp=2.5):self.tx_power = tx_power # RSSI at 1 meter (dBm)self.n = path_loss_exp # Indoor path loss exponentself.beacons = {} # {id: (x, y)}self.rssi_history = {} # {id: [recent RSSI values]}self.history_size =5# Average last N readingsdef add_beacon(self, beacon_id, x, y):"""Register a beacon at known coordinates (meters)."""self.beacons[beacon_id] = (x, y)self.rssi_history[beacon_id] = []def rssi_to_distance(self, rssi):"""Convert RSSI (dBm) to estimated distance (meters)."""if rssi >=self.tx_power:return0.1# Very closereturn10** ((self.tx_power - rssi) / (10*self.n))def update_rssi(self, beacon_id, rssi):"""Record an RSSI measurement, maintaining rolling average."""if beacon_id inself.rssi_history: history =self.rssi_history[beacon_id] history.append(rssi)iflen(history) >self.history_size: history.pop(0)def _averaged_rssi(self, beacon_id):"""Return smoothed RSSI from recent measurements.""" history =self.rssi_history.get(beacon_id, [])ifnot history:returnNonereturnsum(history) /len(history)def estimate_position(self):"""Compute position via least-squares trilateration. Requires at least 3 beacons with recent RSSI data. Returns (x, y, accuracy_m) or None if insufficient data. """ measurements = []for bid, (bx, by) inself.beacons.items(): avg_rssi =self._averaged_rssi(bid)if avg_rssi isnotNone: dist =self.rssi_to_distance(avg_rssi) measurements.append((bx, by, dist))iflen(measurements) <3:returnNone# Least-squares: linearize by subtracting last equation# from all others: 2(xi-xn)x + 2(yi-yn)y = di^2 - dn^2 + xn^2 - xi^2 + yn^2 - yi^2 ref = measurements[-1] A_rows, b_rows = [], []for bx, by, d in measurements[:-1]: A_rows.append([2* (bx - ref[0]), 2* (by - ref[1])]) b_rows.append(d**2- ref[2]**2+ ref[0]**2- bx**2+ ref[1]**2- by**2)# Solve via pseudo-inverse (A^T A)^-1 A^T b# Manual 2x2 for simplicity a11 =sum(r[0]**2for r in A_rows) a12 =sum(r[0] * r[1] for r in A_rows) a22 =sum(r[1]**2for r in A_rows) b1 =sum(A_rows[i][0] * b_rows[i] for i inrange(len(b_rows))) b2 =sum(A_rows[i][1] * b_rows[i] for i inrange(len(b_rows))) det = a11 * a22 - a12 * a12ifabs(det) <1e-10:returnNone x = (a22 * b1 - a12 * b2) / det y = (a11 * b2 - a12 * b1) / det# Estimate accuracy from distance residuals residuals = []for bx, by, d in measurements: est_d = math.sqrt((x - bx)**2+ (y - by)**2) residuals.append(abs(est_d - d)) accuracy =sum(residuals) /len(residuals)returnround(x, 2), round(y, 2), round(accuracy, 2)# Example: Museum indoor wayfindingtri = BLETrilateration(tx_power=-59, path_loss_exp=2.5)tri.add_beacon("entrance", 0, 0)tri.add_beacon("gift-shop", 10, 0)tri.add_beacon("cafe", 5, 8)# Simulate visitor walking near entrancefor rssi in [-64, -65, -66, -65, -64]: # 5 readings from entrance beacon tri.update_rssi("entrance", rssi)for rssi in [-72, -73, -71, -72, -72]: # gift-shop beacon (farther) tri.update_rssi("gift-shop", rssi)for rssi in [-68, -69, -68, -67, -68]: # cafe beacon tri.update_rssi("cafe", rssi)result = tri.estimate_position()if result: x, y, acc = resultprint(f"Estimated position: ({x}, {y}) meters")print(f"Accuracy: +/- {acc} meters")# Show RSSI-to-distance conversionfor bid in tri.beacons: avg = tri._averaged_rssi(bid) dist = tri.rssi_to_distance(avg)print(f" {bid}: RSSI={avg:.0f} dBm -> {dist:.2f}m")# Output:# Estimated position: (1.54, 0.82) meters# Accuracy: +/- 0.41 meters# entrance: RSSI=-65 dBm -> 1.74m# gift-shop: RSSI=-72 dBm -> 3.31m# cafe: RSSI=-68 dBm -> 2.29m
The RSSI averaging (5 readings per beacon) smooths the +/-3 dBm noise typical of indoor BLE. Without averaging, a single noisy reading can shift the position estimate by 1-2 meters. The path_loss_exp parameter must be calibrated on-site – using the default 2.5 instead of the actual 3.0 in a concrete building would overestimate distances by 40%.
Checkpoint: Fusion and Implementation
You now know:
Sensor fusion weights GPS, Wi-Fi, BLE, IMU, and map constraints by reliability rather than trusting a single source everywhere.
A Kalman filter can smooth the indoor-outdoor handoff, but the UI still needs freshness, confidence, and source-quality signals.
The BLE engine is only as good as its calibrated path loss exponent, RSSI averaging, beacon geometry, and map constraints.
34.14 Knowledge Check
Quiz: Indoor Positioning
Hospital Asset Tracking Design
Scenario: A 500-bed hospital needs real-time location tracking for 2,000 medical devices (wheelchairs, IV pumps, portable monitors) to reduce search time and improve utilization.
Requirements:
Room-level accuracy (identify which room equipment is in)
3-second update rate when device moves
10-year battery life for portable equipment
$50,000 budget for infrastructure deployment
Works across 5 floors with concrete walls and metal equipment
Technology Comparison:
Technology
Accuracy
Battery Life
Infrastructure Cost
Total Cost
Suitable?
UWB
10-30 cm
2-3 years
$80,000 (200 anchors × $400)
$280,000
Too expensive
Wi-Fi RSSI
3-5 m
1 year (frequent scanning)
$0 (existing APs)
$50,000
Poor battery life
BLE Beacons
1-3 m
5-7 years
$15,000 (500 beacons × $30)
$65,000
Best fit
Decision: Deploy BLE beacon system with 500 beacons (one per 2-3 rooms).
Implementation Details:
Beacon Placement: Mount beacons on ceiling every 10 meters in grid pattern
Search Time Reduction: From 8 minutes average to 30 seconds
Key Insight: UWB provides 10x better accuracy than BLE, but costs 4x more and offers only 3-year battery life. For hospital asset tracking, room-level accuracy is sufficient—knowing equipment is in “Room 305” is adequate. Sub-30cm precision is unnecessary and wastes resources. The BLE solution meets functional requirements at 1/4 the cost.
Select Indoor Positioning Tech
Use this table to choose the right indoor positioning technology based on your application requirements:
Decision Factor
BLE Beacons
Wi-Fi Fingerprinting
UWB
Recommendation
Accuracy Needed
1-3m
3-5m
10-30cm
Retail/hospitals: BLE; Robotics/AR: UWB
Infrastructure Budget
$10k-$50k
$0 (existing)
$50k-$200k
Budget <$50k: BLE or Wi-Fi
Deployment Timeline
2-4 weeks
4-8 weeks (survey)
4-6 weeks
Fast: BLE; Existing Wi-Fi: Wi-Fi
Battery Life Priority
5-7 years
6-12 months
2-3 years
Long life: BLE
Multipath Resistance
Low (RSSI affected)
Low (RSSI patterns)
High (ToF)
Metal/concrete: UWB
Maintenance Effort
Low (replace batteries)
High (re-survey)
Medium
Low maintenance: BLE
Scalability
High (1000s of tags)
Medium (database size)
High
Large scale: BLE or UWB
Decision Tree:
Do you need sub-50cm accuracy? → YES: UWB only option | NO: Continue
Do you have existing Wi-Fi infrastructure? → YES: Try Wi-Fi fingerprinting | NO: Continue
Is budget <$50k for 50,000 sq ft? → YES: BLE beacons | NO: UWB for best accuracy
Is environment highly metallic/reflective? → YES: UWB (multipath resistant) | NO: BLE sufficient
Do you need 10+ year battery life? → YES: BLE only | NO: UWB acceptable
Museum visitor navigation (5,000 visitors/day): Wi-Fi fingerprinting (leverage existing network, no tags needed)
Factory robot navigation (20 AGVs): UWB (centimeter precision required, small number of tags)
Hospital equipment tracking (2,000 devices): BLE beacons (room-level accuracy, long battery life)
Retail customer analytics (500 shoppers): BLE beacons (opt-in via app, privacy-preserving)
RSSI Calibration Neglect
The Mistake: Deploying BLE beacons with default path loss parameters (TxPower = -59 dBm, n = 2.0) without on-site calibration, assuming datasheet values work in all environments.
Why It Fails:
The path loss exponent n varies dramatically by environment:
Environment
Typical n
Impact on Distance Error
Free space (outdoor)
2.0
Baseline (datasheet)
Office (drywall)
2.5
+30% distance error
Hospital (concrete)
3.2
+60% distance error
Factory (metal)
3.8
+90% distance error
Real Example: A retail store deployed 50 BLE beacons using n=2.0. Customers’ apps showed them as being 8 meters from a beacon that was actually 3 meters away (2.7x error). The store blamed “faulty beacons” when the issue was uncalibrated path loss.
The Cost: Using default n=2.0 in a concrete building (actual n=3.2) causes trilateration to estimate positions 12 meters off target. This makes zone detection useless—users reported as being in the “Electronics” zone are actually in “Apparel.”
How to Fix It:
Conduct RSSI survey: Place beacon at known location, measure RSSI at 1m, 3m, 5m, 10m distances
Calculate actual n: Use formula n = (RSSI₁ - RSSI₂) / (10 × log₁₀(d₂/d₁))
Test in 10 locations: Verify calibrated n works across entire deployment area
Document per-zone: Large buildings may need different n for different zones (concrete basement vs. glass atrium)
Calibration Example:
Given measurements: - RSSI at 1m = -59 dBm - RSSI at 5m = -75 dBm
Interactive Calibration: Use your own RSSI measurements to calculate the actual path loss exponent for your environment. This calibrated value should replace the default n=2.5 in your deployment.
Time Investment: 4-8 hours of RSSI surveying saves months of troubleshooting positioning errors post-deployment.
Key Insight: Never deploy indoor positioning without calibration. Datasheet values are laboratory measurements in free space—real buildings have walls, metal, people, and furniture that change RF propagation. Calibrate or fail.
Checkpoint: Selection and Calibration
You now know:
Technology choice is an accuracy, cost, battery, infrastructure, maintenance, and privacy decision.
BLE can fit large room-level deployments, UWB can justify its cost for tighter precision, and Wi-Fi fingerprinting depends on a living survey.
Calibration is part of launch: path loss, map constraints, anchor health, and regression routes decide whether the system keeps working after the building changes.
Interactive Quiz: Match Concepts
Interactive Quiz: Sequence the Steps
Common Pitfalls
Overbuilt Initial Prototypes
Adding too many features before validating core user needs wastes weeks of effort on a direction that user testing reveals is wrong. IoT projects frequently discover that users want simpler interactions than engineers assumed. Define and test a minimum viable version first, then add complexity only in response to validated user requirements.
Security During Development
Treating security as a phase-2 concern results in architectures (hardcoded credentials, unencrypted channels, no firmware signing) that are expensive to remediate after deployment. Include security requirements in the initial design review, even for prototypes, because prototype patterns become production patterns.
Failure Modes and Recovery
Designing only for the happy path leaves a system that cannot recover gracefully from sensor failures, connectivity outages, or cloud unavailability. Explicitly design and test the behaviour for each failure mode and ensure devices fall back to a safe, locally functional state during outages.
Label the Diagram
💻 Code Challenge
34.15 Summary
Indoor Positioning Technologies:
BLE Beacons: Low cost, 1-3m accuracy, requires beacon deployment
UWB: High precision (10-30cm), multipath resistant, higher cost
Ultrasonic: Best accuracy (3cm) but expensive and requires line-of-sight
Key Trade-offs:
Accuracy vs. Cost: UWB is most accurate but most expensive
Infrastructure vs. Opportunistic: Wi-Fi reuses existing APs, BLE/UWB require deployment
Power vs. Update Rate: Frequent positioning updates drain batteries
Sensor Fusion Principles:
Combine multiple technologies for seamless indoor-outdoor coverage
Weight sources by reliability (GPS high outdoors, low indoors)
Use Kalman filters to smooth transitions and handle sensor failures
Apply map constraints to prevent impossible positions (inside walls)
Key Takeaway
Indoor positioning requires fundamentally different technologies from outdoor GPS because satellite signals cannot penetrate buildings. The choice between BLE beacons (cheap, 1-3m), Wi-Fi (free infrastructure, 3-5m), and UWB (expensive, 10-30cm) depends on accuracy requirements, budget, and existing infrastructure. The most robust real-world systems use sensor fusion, combining multiple technologies through Kalman filters to smooth transitions and handle individual sensor failures. The key insight: no single positioning technology works everywhere – seamless location awareness requires intelligent fusion of multiple sources.
For Kids: Meet the Sensor Squad!
Indoor positioning is like finding your way in a building without any windows to see the sky!
34.15.1 Indoor Treasure Hunt
The Sensor Squad was running a treasure hunt inside a huge shopping mall. But there was a problem – GPS didn’t work indoors!
“My GPS says I’m OUTSIDE!” cried Lila the LED, standing right in the middle of the food court. “The satellite signals can’t get through the roof!”
“Don’t worry!” said Sammy the Sensor. “We have INDOOR tools!”
Tool 1: Bluetooth Beacons (The Lighthouse Method) Max the Microcontroller placed tiny Bluetooth beacons around the mall. Each one continuously shouted: “I’m at the food court!” or “I’m at the shoe store!” When Lila’s phone heard a beacon, it knew she was nearby.
“But how CLOSE am I?” asked Lila. “The beacon’s signal gets WEAKER the farther you walk. If I measure the signal strength from THREE beacons, I can figure out exactly where I am – just like GPS uses three satellites!” said Sammy.
Tool 2: Wi-Fi Fingerprinting (The Memory Method) Bella the Battery had walked through every corridor last week, recording what Wi-Fi signals looked like at each spot. “At the pet store, I can see Wi-Fi networks ‘MallGuest’ at -60, ‘StoreWifi’ at -45, and ‘CoffeeShop’ at -72. This PATTERN is unique to the pet store!”
Now when someone’s phone sees that same Wi-Fi pattern, the system says “You must be near the pet store!” It’s like recognizing a song by its melody!
Tool 3: UWB (The Stopwatch Method) For the FINAL treasure (hidden on a specific shelf), they needed ultra-precise tracking. UWB sent super-quick pulses and measured the EXACT time they took to bounce back. “10 centimeters accuracy!” cheered Max. “I can tell which SHELF the treasure is on!”
The Grand Fusion “The best part,” said Sammy, “is we can use ALL of these together! Wi-Fi gives us the general area, Bluetooth narrows it to the right store, and UWB pinpoints the exact spot. It’s like using a map, then a compass, then a magnifying glass!”
34.15.2 Key Words for Kids
Word
What It Means
BLE Beacon
A tiny device that broadcasts “I’m here!” using Bluetooth – like a small indoor lighthouse
Wi-Fi Fingerprint
The unique pattern of Wi-Fi signals at each location, like a musical chord that’s different everywhere
UWB
Ultra-Wideband – sends super-fast pulses to measure distance within centimeters
Sensor Fusion
Combining multiple tools together for the best answer (like asking three friends instead of one)
Concept Relationships
How this chapter connects to other IoT concepts:
Compensates for: GPS Limitations which fail indoors due to signal attenuation through building materials
Uses: BLE Beacon Positioning for proximity detection from repeated beacon broadcasts and RSSI measurements
Alternative: UWB Positioning for centimeter-level accuracy via time-of-flight ranging
Fusion with: Sensor Fusion where IMU accelerometer and gyroscope data bridge GPS outages during indoor transitions
Applied in: Asset Tracking hospitals and warehouses track equipment with BLE or UWB systems
See Also
Related topics for deeper exploration:
RSSI Path Loss Models: Mathematical models for converting signal strength to distance estimates
Deploy a BLE beacon and measure RSSI at known distances:
Place beacon at fixed location
Measure RSSI at 1m, 2m, 3m, 5m, 10m distances
Plot RSSI vs. log(distance) graph
Calculate path loss exponent n using formula: n = (RSSI₁ - RSSI₂) / (10 × log₁₀(d₂/d₁))
Compare measured n to theoretical values (2.0 free space, 2.5-4.0 indoors)
What to observe: RSSI varies ±3 dBm even at fixed distance (noise). Path loss exponent depends on environment: office (n≈2.5), concrete building (n≈3.2), metal-rich factory (n≈3.8). Using wrong n causes 30-50% distance estimation error.
34.15.4 Exercise 2: Wi-Fi Fingerprinting Survey
Create a simple fingerprint database for one room:
Choose 5 locations in room (corners + center)
At each location, record RSSI from 3-5 visible Wi-Fi access points
Test positioning: Stand at unknown location, scan Wi-Fi, find closest fingerprint match
What to observe: Fingerprint matching provides 2-5m accuracy in static environment. Notice how RSSI changes with body orientation (your body attenuates signals). Test again next day—accuracy degrades if anything moved (furniture, people). This demonstrates maintenance burden of fingerprinting.
34.15.5 Exercise 3: Trilateration Geometry
Manually calculate position from 3 beacon distances:
Place 3 beacons at known positions: A=(0,0), B=(10,0), C=(5,8) meters
Measure RSSI from each beacon, convert to distances using path loss formula
Draw circles with radius = estimated distance around each beacon on graph paper
Find intersection point—that’s your estimated position
Compare to actual position
What to observe: Circles rarely intersect at single point due to RSSI noise—they form small triangle. Centroid of triangle is position estimate. Notice how RSSI error (±3 dBm) translates to ±30% distance error, causing position error of 1-3 meters even with perfect beacon placement.
34.16 What’s Next
Continue to Location Privacy and Regulations to learn about privacy-preserving design patterns, E911 mandates, and ethical considerations when collecting location data.