|
| 1 | +# BLE camera |
| 2 | + |
| 3 | +Select Bluetooth LE advertisers and display their arrival directions over a |
| 4 | +live camera image. The video capture, alignment controls and overlay shader |
| 5 | +are shared with the WiFi and IQ camera demos. |
| 6 | + |
| 7 | +From the repository root, with the demo dependencies installed: |
| 8 | + |
| 9 | +```sh |
| 10 | +python demos/ble/camera/main.py -s 192.168.0.234 |
| 11 | +``` |
| 12 | + |
| 13 | +Use `--no-camera` (or `-o app.camera.enable=false`) for an overlay on black. To select advertisers on startup: |
| 14 | + |
| 15 | +```sh |
| 16 | +python demos/ble/camera/main.py -s 192.168.0.234 -o app.camera.enable=false \ |
| 17 | + -o 'app.receiver.advertisers=["c8:12:0b:62:de:49"]' |
| 18 | +``` |
| 19 | + |
| 20 | +The compact overlay lists MAC addresses, packet counts and seconds since the |
| 21 | +most recent packet. Check one or more advertisers to show their |
| 22 | +spatial spectra. Unselected advertisers remain discoverable. Old observations |
| 23 | +fade and disappear after one second. The list is bounded to 128 advertisers, |
| 24 | +with selected rows retained when older unselected rows are replaced. |
| 25 | + |
| 26 | +Open RX for receiver settings and App for the shared camera controls, including |
| 27 | +Camera or Beamspace display. Both drawers stay closed until opened. |
| 28 | + |
| 29 | +The receiver listens on one channel at a time. RX exposes all 40 channels, |
| 30 | +LE 1M and LE 2M, automatic or fixed gain, sample rate and capture size. |
| 31 | +Settings apply immediately. Channel, PHY and expert gain changes |
| 32 | +invalidate calibration. Feed, ordinary gain, sample rate and capture length |
| 33 | +changes preserve it. The highlighted Trigger Calibration |
| 34 | +button in RX acquires a fresh reference when needed. |
| 35 | +First polarization and automatic gain are the defaults. The manual gain slider |
| 36 | +also sets the fixed gain used briefly for reference calibration. |
| 37 | + |
| 38 | +RF input offers Iso, both antenna polarizations, Random and Ref. Random chooses |
| 39 | +an antenna input independently for every sensor capture. The firmware reports |
| 40 | +the effective input, and the camera combines the two polarizations' spatial |
| 41 | +powers separately to avoid mixing their unknown signal phases. |
| 42 | + |
| 43 | +Beamspace mode shows the shared azimuth and elevation coordinate diagram, |
| 44 | +with angle labels and the visible hemisphere boundary. |
| 45 | + |
| 46 | +## Reference calibration |
| 47 | + |
| 48 | +Calibration runs on startup. In the array's web interface, set BLE Reference |
| 49 | +Generation to During Calibration or Always, with the internal reference source. |
| 50 | +The demo briefly selects REF, averages eight complete observations from the reference advertiser, |
| 51 | +then returns to the antenna input. Calibration also corrects the PCB reference-path delays. It does not change persistent reference |
| 52 | +settings. If calibration fails, advertiser discovery continues and the |
| 53 | +Trigger Calibration button in RX retries it. No direction overlay is displayed without a |
| 54 | +successful calibration. |
| 55 | + |
| 56 | +The demo requires API 5 controller firmware and BLQ5 sensor captures. It |
| 57 | +currently supports one eight-sensor array. Direction estimation supports LE 1M |
| 58 | +and LE 2M with either automatic or fixed gain. LE Coded is unsupported. |
| 59 | +LE 2M calibration needs |
| 60 | +an external reference because the controller generates LE 1M only. Set its |
| 61 | +advertiser address with `-o 'app.receiver.reference_address="aa:bb:cc:dd:ee:ff"'`. |
| 62 | +Other advertisers are excluded from calibration even if their packets leak into REF. Each spatial |
| 63 | +observation requires all eight antennas. At least one sensor must report a |
| 64 | +valid packet CRC. Other sensors may contribute only after a unique, coherent |
| 65 | +waveform match. Scan requests and connection requests are excluded because |
| 66 | +their transmitters are not the advertiser named in the request. |
| 67 | + |
| 68 | +App settings offer Bartlett, MUSIC and Root-MUSIC. MUSIC uses a spatial |
| 69 | +spectrum, while Root-MUSIC shows estimated direction markers. With Multipath enabled, both use forward/backward spatial smoothing, |
| 70 | +and Root-MUSIC estimates multiple significant paths per advertiser. Smoothing |
| 71 | +uses overlapping 2×3 subarrays, trading angular resolution for robustness to |
| 72 | +coherent reflections. A reported path is not necessarily the direct path. The BLE backlog defaults to at most 16 observations |
| 73 | +and 250 ms, whichever limit is reached first. Packets from different advertisers |
| 74 | +never share a covariance. Measured amplitudes are retained for multipath |
| 75 | +processing instead of reducing every sensor to unit magnitude. A single complete |
| 76 | +fixed-feed observation can already provide a spatial covariance, which keeps |
| 77 | +slow advertisers usable. Without polarization reconstruction, Random contributes |
| 78 | +only same-feed pairs. MUSIC waits until the backlog covers all sensor pairs. |
| 79 | + |
| 80 | +Live processing keeps only the newest pending observation per selected advertiser. |
| 81 | +Phase fitting does not block packet assembly or the UI, and unselected advertisers |
| 82 | +are discovered without computing their directions. All three beamformers use the selected packet history and the full usable |
| 83 | +packet IQ covariance. Independent packet phases are combined incoherently. |
| 84 | + |
| 85 | +Feed and gain changes retain reference calibration. Measured per-packet gain |
| 86 | +corrects phase and amplitude under AGC. Firmware must support BLQ5 gain metadata. |
| 87 | +An observation with a changing/unknown gain is skipped without dropping the |
| 88 | +advertiser or invalidating calibration. |
| 89 | +Channel, PHY and expert gain changes require calibration. |
| 90 | + |
| 91 | +Directions use narrowband spatial processing. Multipath can produce |
| 92 | +strong reflected directions, and the short vertical aperture limits elevation |
| 93 | +resolution. A planar array has front/back ambiguity. Calibrate the camera's |
| 94 | +field of view and mounting offsets in App using known transmitter positions. |
| 95 | +No CTE is required. The demo does not follow connections or channel hopping. |
| 96 | + |
| 97 | +On normal exit, the demo restores the previous controller role, per-sensor |
| 98 | +modes and BLE receiver settings, and releases its stream. An interrupted process |
| 99 | +cannot restore hardware settings. |
| 100 | + |
| 101 | +The demo uses the public `board.ble` and `pool.ble` APIs. Packet discovery, raw |
| 102 | +captures, event association, phase estimation and reference calibration are |
| 103 | +available independently of Qt and this camera. See `docs/ble-reception.rst` |
| 104 | +and `docs/measurement-architecture.rst` for other consumers and extension points. |
| 105 | + |
| 106 | +## Polarization and multiple targets |
| 107 | + |
| 108 | +Select any number of advertisers in the overlay. Each keeps an independent |
| 109 | +short backlog, spatial result and MAC-labeled markers. Multiple markers with |
| 110 | +the same MAC are candidate paths from one advertiser, not extra transmitters. |
| 111 | + |
| 112 | +App → Polarization offers Ignore, Incorporate and Show. Incorporate uses both |
| 113 | +feeds and the shared frequency-dependent antenna Jones model before beamforming. |
| 114 | +Show additionally displays the same animated H/V polarization ellipses as WiFi. |
| 115 | +Selecting either enables Random RF input. Automatic gain is supported. |
| 116 | + |
| 117 | +BLE packet RMS amplitudes are normalized for measured gain and retained |
| 118 | +alongside calibrated phases. Mixed-feed |
| 119 | +observations connect both feed domains across packets, removing each packet's |
| 120 | +unknown common complex scale. Results require connected coverage of all feeds |
| 121 | +within the bounded backlog. While coverage is incomplete, ordinary same-feed |
| 122 | +beamforming remains available. A recent polarization estimate survives a short |
| 123 | +coverage gap, but expires after the configured backlog age. Missing or fully |
| 124 | +unpolarized estimates do not draw stationary dots. Alternating |
| 125 | +the entire array between fixed feeds |
| 126 | +cannot establish their relative phase and is deliberately rejected. Increase |
| 127 | +the backlog age only if a slow advertiser does not provide enough observations. |
| 128 | + |
| 129 | +Polarization is an estimate under a locally stable channel and the supplied |
| 130 | +antenna model, not a separate amplitude-calibrated polarization measurement. |
| 131 | +Independent advertisers are combined as coherency matrices for visualization, |
| 132 | +never by adding their complex fields. Overlapping mixed polarizations reduce |
| 133 | +the displayed polarization degree. |
| 134 | + |
| 135 | +MUSIC and Root-MUSIC allow different arbitrary complex H/V polarizations for |
| 136 | +resolved paths. Their path polarizations are fitted jointly after estimating |
| 137 | +directions, so a dot does not inherit another path's Bartlett sidelobes. |
| 138 | +The display keeps each ellipse's arbitrary common phase continuous across |
| 139 | +frames. This avoids animation jumps when H and V have nearly equal magnitude. |
| 140 | +The finite array aperture and antenna response model still limit accuracy. |
| 141 | + |
| 142 | +In Random mode, firmware chooses an antenna feed after each qualified packet, |
| 143 | +after storing that packet's metadata. Noise candidates retain the current feed. |
| 144 | +The wire record carries the |
| 145 | +actual feed used for that capture (2 or 3), separately from the requested Random |
| 146 | +mode (4). A random choice can repeat the previous feed. This is not forced |
| 147 | +alternation of the whole array. |
| 148 | + |
| 149 | +Fresh spectra use automatic exposure like the WiFi camera. Age opacity is |
| 150 | +applied after display contrast, with a 200 ms grace period for normal packet |
| 151 | +and UI scheduling gaps. A newer measurement replaces the previous direction |
| 152 | +immediately. Once a source has a polarization-corrected estimate, temporary |
| 153 | +feed-coverage gaps do not substitute an uncorrected spectrum with a different |
| 154 | +intensity and spatial response. The last valid result instead ages out normally. |
| 155 | + |
| 156 | +When polarization is set to Show, Grid spacing and Phasor speed control the dots. |
| 157 | +Zero speed pauses the animation. These controls share their implementation with |
| 158 | +the WiFi camera and do not reset the measurement backlog. |
| 159 | + |
| 160 | +Both MUSIC methods restrict automatic source selection to covariance modes |
| 161 | +within 10 dB of the strongest signal mode. This prevents weak calibration and |
| 162 | +random-feed reconstruction errors from consuming the noise subspace. It also |
| 163 | +limits the ability to distinguish much weaker reflected paths. Random-feed |
| 164 | +polarization still needs sufficient recent coverage of both feeds on every |
| 165 | +sensor. An undersized or very short backlog can produce gaps in that estimate. |
0 commit comments