Skip to content

HumphreySun98/Deep-Learning-for-BLE-Sensing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoBleSen: LoRa Channel Recovery from BLE RSSI via Deep Learning

Recovering high-bandwidth LoRa chirp channel responses from low-rate BLE RSSI measurements using neural frequency unfolding.

Problem

A BLE receiver samples the ambient 2.4 GHz spectrum at ~25 kHz via RSSI, while a LoRa transmitter sends chirps with 203.125 kHz bandwidth. The BLE sampling rate is far below the Nyquist rate, causing severe frequency aliasing. This project investigates whether deep learning can recover the original chirp waveform from the aliased BLE RSSI signal, using co-located USRP SDR captures as ground truth.

Approach

Data Collection

Synchronized capture of BLE RSSI (25 kHz, via TI CC2652R7) and USRP IQ (1 MHz) while a LoRa node transmits continuous chirps. Hand-cover power-cycle events serve as sync markers for temporal alignment.

  • rssi_reader.py — BLE RSSI streaming over UART
  • build_training_set.py — Sync detection, chirp segmentation, and training set construction
  • build_1mhz_set.py — Hierarchical multi-resolution training set (25 kHz to 1 MHz)

Deep Learning Models

1. Neural Frequency Unfolding (chirp_unfold.py)

  • 2-stage hierarchical bandwidth expansion: 25 kHz → 50 kHz → 100 kHz (4x)
  • Sub-pixel convolution (pixel shuffle 1D) for learnable upsampling
  • Spectral refinement via frequency-domain convolution
  • Inspired by Wang et al., IMWUT 2021

2. 40x Neural Upsampling (chirp_unfold_1mhz.py)

  • 4-stage progressive upsampling: 504 → 2520 → 5040 → 10080 → 20160 samples
  • Recovers full 1 MHz resolution from 25 kHz BLE input

3. Physics-Informed DL (pi_chirp_recovery.py)

  • 1D CNN encoder + bidirectional GRU for temporal context
  • Multi-target output: H_power, H_amplitude, H_dc
  • Physics-informed loss: MSE + temporal smoothness + monotonic correlation

4. DL Ground-Truth Experiment (dl_gt_recovery.py)

  • Key A/B test separating two questions:
    • Exp A: Can DL unfold from true aliased data? (USRP naive-decimated → USRP full-rate)
    • Exp B: Does BLE RSSI contain the aliased beat? (BLE → USRP full-rate)
  • If A succeeds but B fails → BLE hardware destroys the aliased structure

Mathematical Baselines (LoFiSen)

  • lofisen_section4.py — Exact implementation of LoFiSen Section 4 alias recovery
  • lofisen_unfold_ble.py — Segment-based and phase-based mathematical unfolding
  • section4_comparison.py — Side-by-side math recovery on USRP-decimated vs. BLE
  • reproduce_fig9.py — LoFiSen Figure 9 reproduction with BLE data

Verification

  • respire_ble_verify.py — Breathing-band (0.1–0.5 Hz) correlation between BLE features and USRP channel response
  • quantization_test.py — Effect of BLE RSSI quantization on recovery quality

Trained Models

File Description Size
chirp_unfold_best.pt 4x unfolding network (25 kHz → 100 kHz) 1.8 MB
chirp_unfold_1mhz_best.pt 40x upsampling network (25 kHz → 1 MHz) 700 KB
pi_model.pt Physics-informed channel recovery 2.1 MB
dl_gt_A.pt Exp A: USRP-decimated → USRP (oracle baseline) 1.3 MB
dl_gt_B.pt Exp B: BLE RSSI → USRP (main experiment) 1.3 MB

Key Results

DL Ground-Truth Recovery

DL GT Waveforms DL GT Training

Math vs. DL Comparison

Math vs DL Summary

1 MHz Full-Resolution Recovery

1MHz Results

Physics-Informed DL

PI-DL Results

Requirements

  • Python 3.8+
  • PyTorch
  • NumPy, SciPy, Matplotlib
  • (For data collection) UHD / USRP, TI CC2652R7 BLE board

Usage

# 1. Collect synchronized data
python rssi_reader.py --port COM10 --seconds 150 --fs 25000
python usrp_rx_paired.py --duration 150

# 2. Build training set
python build_training_set.py --usrp usrp_paired.npz --ble rssi_data.npz

# 3. Train neural frequency unfolding (4x)
python chirp_unfold.py --data training_set.npz --epochs 300

# 4. Train 40x upsampling
python build_1mhz_set.py --usrp usrp_paired.npz --ble rssi_data.npz
python chirp_unfold_1mhz.py --data training_set_1mhz.npz --epochs 300

# 5. Train physics-informed model
python pi_chirp_recovery.py --data training_set.npz --epochs 200

# 6. Run DL ground-truth experiment
python dl_gt_recovery.py --data training_set.npz --epochs 300

LoRa Parameters

Parameter Value
Spreading Factor (SF) 12
Bandwidth (BW) 203.125 kHz
Chirp Duration 20.16 ms
BLE Sampling Rate 25 kHz
USRP Sampling Rate 1 MHz

References

  • Wang et al., "Audio Keyword Reconstruction from On-Device Motion Sensor Signals via Neural Frequency Unfolding," IMWUT 2021
  • LoFiSen (low-fidelity sensing via chirp aliasing recovery)

About

End-to-end super-resolution pipeline recovering wideband LoRa channel responses from narrowband BLE RSSI via progressive sub-pixel convolution and physics-informed loss

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors