Vigil – Offline Disaster Rescue & Survivor Detection System
1. Inspiration
When an earthquake, flood, or building collapse hits, cell towers and power grids are usually among the first infrastructure systems to go dark. Yet almost everyone trapped under rubble may still have a smartphone in their pocket with battery remaining and a working Bluetooth chip.
During search-and-rescue operations, teams lose critical minutes in the final few metres, searching blindly through concrete and debris when every hour can reduce survival chances.
We asked ourselves a simple question:
What if a smartphone could continuously communicate "I'm here, I'm alive, and this is how urgent my situation is" using nothing but Bluetooth Low Energy (BLE)?
And what if rescuers could make that phone respond with an audible alarm through the rubble?
That question became Vigil.
Our goal was to build an offline-first emergency communication and survivor-location system using hardware that people already carry in their pockets.
2. What It Does
Vigil is a dual-role offline disaster rescue system packed into a single Android application.
It requires:
No internet connection.
No cellular network.
No SIM card.
No cloud server.
Users can enable Airplane Mode, turn Bluetooth back on, and operate the entire system offline.
Vigil provides two primary experiences:
Help Me: For people trapped or in danger.
Find and Listen: For rescue teams searching for survivors.
A. Help Me – Survivor Mode
1. Instant SOS and Automatic Safety Check
Trigger an emergency SOS beacon with a single tap.
Start a 30-second safety countdown that automatically activates the beacon if the survivor cannot respond.
2. Compact 5-Byte Life-Status Telemetry
The smartphone broadcasts a highly compact BLE signal containing:
Persistent session ID.
Battery percentage.
Minutes spent motionless.
SOS status.
Automatic impact detection.
Phone posture.
Self-reported conditions such as injured, trapped, difficulty breathing, and other people nearby.
3. Remote Rescue Alarm
When a verified rescuer sends a command, the survivor's phone activates:
A 3.5 kHz acoustic alarm.
Camera flashlight strobe.
Maximum supported vibration intensity.
In Hail Mode, the alarm operates for 3 s and pauses for 5 s, allowing rescuers to listen for voices or tapping during the quiet intervals.
4. Automatic Battery Preservation
As soon as a rescue team marks the survivor as found:
The screen displays "You have been found."
The emergency beacon is disabled.
Remaining battery power is preserved.
B. Find and Listen – Rescuer Mode
1. Real-Time Survivor Urgency Triage
Rescuers can discover nearby Vigil SOS beacons.
Every detected survivor is automatically classified into:
CRITICAL
HIGH
STABLE
The application displays the reasons behind each priority level and an estimated distance range.
2. Authenticated Remote Commands
Rescuers can:
Trigger the survivor's phone alarm using Make It Ring.
Mark the survivor as Found.
Run a built-in Security Test to demonstrate rejection of forged and replayed commands.
3. Any Device – Passive Bluetooth Discovery
What happens when a trapped person has never installed Vigil?
Our Any Device feature allows rescuers to scan for nearby devices that expose detectable Bluetooth advertisements.
These may include:
Smartphones.
Smartwatches.
Wireless earbuds.
Compatible offline Find My-related advertisements.
Additional capabilities include:
Sorting detected devices by estimated proximity.
Hiding the rescue team's own devices.
Highlighting newly detected signals during search operations.
Device discovery depends on the device's Bluetooth configuration and advertising behaviour. Detecting an advertisement does not necessarily reveal the identity or location of its owner.
4. Body-Shielded Direction Finding
Vigil experiments with using the human body as a directional RF shield.
The rescuer holds the smartphone flat against their chest and rotates slowly through 360°.
The application:
Collects RSSI measurements across eight compass sectors.
Calculates median signal strength for each sector.
Applies circular kernel smoothing.
Uses parabolic interpolation to estimate the relative direction of the strongest signal.
This provides an experimental direction-finding approach for close-range searches.
5. Acoustic Knock Listener
What if the survivor's smartphone battery has completely died?
Vigil includes an acoustic listening mode that prompts:
"If you can hear me, knock three times."
The microphone captures audio and processes transient sound events to identify potential rhythmic knocking patterns against background noise.
This provides another possible way to detect survivors when electronic communication is unavailable.
3. Built to Survive on a Dying Battery
Vigil is designed to operate efficiently on smartphones with limited remaining battery power.
Its BLE advertisement frequency is:
Active SOS frequency:
f_SOS = 4 HzNormal standby frequency:
f_normal = 1 Hz
The transmission frequency is reduced further when battery drops below 30% or Android Battery Saver is enabled.
Additional optimizations include:
Hardware-batched motion sensor readings.
Reduced CPU wake-ups between sensor updates.
Automatic suspension of rescuer scanning when the application is closed.
Adaptive BLE transmission frequency.
No requirement to disable Android battery optimizations.
Our objective was to preserve battery power while maintaining essential emergency communication.
4. How We Built It – Architecture and Mathematical Models
Vigil was developed natively in Kotlin using Jetpack Compose and Material 3.
Technology Stack
| Component | Technology |
| ----------- | ----------- |
| Programming Language | Kotlin |
| UI Framework | Jetpack Compose |
| Design System | Material 3 |
| Platform | Android 8–15 |
| Communication | Bluetooth Low Energy (BLE) |
| Background Processing | Android Foreground Services |
| Audio Processing | PCM Microphone Sampling |
| Cryptography | ECDSA P-256 and SHA-256 |
The application is packaged as a single lightweight Android APK.
4.1. Bit-Packed 30-Byte BLE Advertisement Protocol
Legacy BLE advertising supports a maximum advertising data size of 31 bytes.
Vigil uses a compact advertisement structure:
3 bytes (Flags) + 18 bytes (128-bit Service UUID) + 9 bytes (Manufacturer Data) = 30 bytes
The structure consists of:
3-byte Flags AD structure.
18-byte custom 128-bit Service UUID AD structure.
9-byte Manufacturer Specific Data AD structure.
Inside the 5-byte (40-bit) telemetry payload, every bit is allocated:
Payload (40 bits) =
[ SessionID (16 bits) ]
|| [ Impact (1 bit) | Batt (7 bits) ] (8 bits)
|| [ Posture0 (1 bit) | StillMin (7 bits) ] (8 bits)
|| [ Posture1 (1 bit) | Comp (2 bits) | Cond (3 bits) | Status (2 bits) ] (8 bits)
Byte-by-byte breakdown:
Bytes 0–1 (16 bits):
SessionID (16 bits)Byte 2 (8 bits):
Impact (1 bit) || Batt (7 bits)Byte 3 (8 bits):
Posture0 (1 bit) || StillMin (7 bits)Byte 4 (8 bits):
Posture1 (1 bit) || Comp (2 bits) || Cond (3 bits) || Status (2 bits)
This compact bit-level design allows Vigil to transmit essential survivor information within a small BLE advertisement.
4.2. Time-Aware 1D Kalman Filter for RSSI Smoothing
Raw Bluetooth RSSI measurements fluctuate because of multipath reflections, obstacles, and signal absorption.
Vigil implements a one-dimensional time-aware Kalman filter to smooth RSSI measurements.
Prediction equation:
P_k⁻ = P_(k-1) + q · Δt
Kalman gain:
K_k = P_k⁻ / (P_k⁻ + R)
State update:
x̂_k = x̂_(k-1) + K_k · (z_k - x̂_(k-1))
Uncertainty update:
P_k = (1 - K_k) · P_k⁻
Parameters:
Process noise:
q = 6.0 dB²/sMeasurement noise variance:
R = 16.0 dB²Δt: Elapsed time between measurements.z_k: Newly measured RSSI.x̂_k: Filtered RSSI estimate.
This reduces short-term RSSI fluctuations and provides a more stable input for proximity estimation.
4.3. Log-Distance Path-Loss Range Estimation
Vigil uses the log-distance path-loss model to estimate the distance between a rescuer and a survivor.
The reference RSSI at one metre is:
RSSI_1m = -59.0 dBm
Alternatively, when transmit power is advertised:
RSSI_1m = TX_dBm - 41 dB
The estimated distance is:
d(n) = 10 ^ ((RSSI_1m - x̂_k) / (10 · n))
The path-loss exponent is considered within:
n ∈ [2.0, 3.0]
Where:
n = 2.0: Open-air propagation.n = 2.5: Nominal indoor propagation.n = 3.0: Dense indoor propagation assumption.
The resulting model-based distance interval is:
d_range = [ d(3.0), d(2.0) ]
Rather than displaying misleading centimetre-level precision, Vigil provides an approximate distance range based on filtered RSSI and assumed environmental conditions.
4.4. Real-Time Survivor Urgency Scoring
Every survivor's 5-byte beacon is mapped to an urgency score U.
The scoring model considers SOS status, inactivity, impact, posture, medical conditions, companion count, and remaining battery:
U = 50·I_SOS + 25·I_still + 20·I_impact + 5·I_flat
+ 30·I_breath + 20·I_injured + 20·I_trapped
+ 5·c + floor(min(m, 60) / 2) + B(b)
Where:
U: Total urgency score.I_SOS: Active SOS indicator.I_still: Prolonged inactivity indicator.I_impact: Impact detection indicator.I_flat: Flat phone posture indicator.I_breath: Breathing difficulty indicator.I_injured: Injury indicator.I_trapped: Trapped status indicator.c: Companion count.m: Minutes spent motionless.b: Remaining battery percentage.
The battery risk function B(b) is defined as:
B(b) = 25whenb < 15%B(b) = 15when15% ≤ b < 30%B(b) = 5when30% ≤ b < 50%B(b) = 0whenb ≥ 50%
Survivors are classified into three urgency tiers Tier(U):
CRITICAL:
U ≥ 60HIGH:
40 ≤ U < 60STABLE:
U < 40
This heuristic model helps rescuers prioritize survivors based on reported and detected conditions.
4.5. Body-Shielded 8-Sector Circular Convolution and Parabolic Bearing Interpolation
When a rescuer holds the phone against their chest and rotates through 360°, the human body can attenuate radio signals arriving from behind.
Vigil collects RSSI measurements across eight compass sectors, each covering 45°.
Let M_i represent the median RSSI measurement for sector i.
Circular kernel smoothing is applied:
S_i = (M_((i-1) mod 8) + 2·M_i + M_((i+1) mod 8)) / 4
The strongest sector is identified as:
k* = argmax_i (S_i)
Parabolic interpolation estimates the relative bearing within the strongest sector (clipped to [-0.5, 0.5]):
δ = (S_(k*-1) - S_(k*+1)) / (2 · (S_(k*-1) - 2·S_(k*) + S_(k*+1)))
The estimated direction is:
θ = 45° · (k* + δ) mod 360°
This approach combines human-body RF attenuation, circular smoothing, and interpolation to estimate the direction of the strongest signal.
4.6. First-Order Digital High-Pass Filter and Transient Knock Detector
Vigil's Listen engine samples microphone PCM audio at:
f_s = 16,000 Hz
Audio is divided into 10 ms frames:
N = 160 samples
A first-order high-pass filter is implemented:
y[n] = x[n] - x[n-1] + 0.97 · y[n-1]
The RMS energy is calculated as:
E_RMS = sqrt( (1 / N) · Σ_(n=0 to N-1) (y[n])² )
An impulse onset is detected when:
E_RMS > max(5.6 · N_floor, 0.003)
The adaptive noise floor is updated using:
N_floor ← 0.98 · N_floor + 0.02 · E_RMS
An impulse is considered a potential knock when:
Its energy decays below one-fourth of its peak within 120 ms.
A 150 ms refractory period is maintained between detections.
This helps isolate transient acoustic events from continuous background noise.
4.7. Offline ECDSA P-256 Command Verification and Replay Protection
Vigil uses offline cryptographic verification to protect remote commands against tampering and replay attacks.
Each GATT command packet contains:
A 1-byte opcode.
An 8-byte millisecond timestamp
t.A DER-encoded ECDSA P-256 signature.
The packet structure is:
P = cmd (1B) || t (8B) || Sig_ECDSA-P256( SHA-256(cmd || t) )
The survivor's smartphone verifies the signature locally without requiring internet connectivity.
A command is accepted only when both conditions are satisfied:
Timestamp freshness:
|t_now - t| ≤ 300,000 ms (5 minutes)
Monotonic replay protection:
t > t_last_accepted
This prevents acceptance of invalid signatures and commands that fail the configured timestamp and replay checks.
For hackathon testing, the demo APK includes a development signing key. Production deployment requires protected private keys and authenticated rescue-team key provisioning.
5. How to Try It – For Judges
You can test Vigil in approximately two minutes using an Android smartphone running Android 8 or newer.
Download Vigil-demo.apk from our GitHub Releases page and install it after allowing installation from the relevant source when prompted.
A. Testing with One Phone
Open Vigil.
Tap the top-right menu and enable Demo Mode.
Open the Find tab.
Observe three simulated survivors labelled Demo.
Select any survivor and tap Make It Ring.
Observe the real alarm, flashlight strobe, and vibration.
Tap Security Test to watch the ECDSA verifier reject a forged signature and an expired replayed command.
Open Find → Any Device to scan for nearby Bluetooth advertisements.
Open Listen to test live acoustic knock detection.
B. Testing with Two Phones
Put both Android smartphones into Airplane Mode.
Re-enable Bluetooth on both devices.
On Phone A, open Help Me → Send SOS Now.
Select Injured as the survivor condition.
On Phone B, open Find → Start Searching.
Select the detected survivor.
Press Make It Ring.
Verify that Phone A activates its alarm, flashlight, and vibration.
C. No Android Device Available?
Watch our two-minute live hardware demonstration video showing both smartphones communicating offline.
6. Challenges We Ran Into
1. The 31-Byte Wall
Fitting a custom 128-bit UUID alongside battery information, motion timers, impact flags, posture, companion count, and medical conditions into a single legacy BLE advertisement required careful bit-level protocol design.
Every bit had to earn its place.
2. Phantom Clones from MAC Rotation
Android periodically randomizes BLE hardware addresses for privacy. Initially, this caused one trapped survivor to appear as multiple devices.
We introduced a persistent 16-bit session ID to maintain survivor identity during scanning.
3. Fitting Large Cryptographic Signatures into Small BLE Pipes
An ECDSA signature requires approximately 80 bytes, while default BLE writes may be limited to 20 bytes.
We implemented automatic MTU negotiation with a fallback to multi-part GATT long writes.
4. Taming Android's GATT Error 133
We improved connection reliability by:
Enforcing
TRANSPORT_LE.Serializing GATT operations.
Implementing a clean single-retry state machine.
5. The Silent Five-Scans-in-30-Seconds Trap
Modern Android versions can silently return zero BLE scan results when an application starts and stops scanning excessively.
Vigil tracks scanning timestamps in a rolling window and displays a countdown when a rescuer attempts to scan too frequently.
6. Real-World Two-Phone Bugs
Power-saving BLE scans sometimes deliver advertisements in bursts rather than continuously.
During two-phone testing, our initial 3 s signal-loss timer triggered false dropouts. We identified the problem through hardware testing and adjusted the timing.
7. Mid-Hackathon Toolchain Curveball
The latest Android Studio toolchain introduced Java 25, forcing an emergency migration to Gradle 9.1 and Kotlin 2.2.
7. Accomplishments That We're Proud Of
1. Offline Communication on Real Hardware
Successfully demonstrated two Android smartphones communicating with Airplane Mode enabled and Bluetooth reactivated.
Phone A broadcasts an Injured + Trapped SOS, while Phone B detects the survivor and classifies the situation as Critical when the configured urgency score reaches the threshold.
2. Security That Judges Can Verify Live
Integrated a one-tap Security Test that demonstrates rejection of forged signatures and expired timestamp commands.
3. Closing the Nobody-Installed-Your-App Gap
Developed passive Bluetooth discovery and an acoustic listening mode to help search for devices and potential survivors who do not have Vigil installed.
4. Designed for High-Stress Environments
Focused on four simple application tabs, large touch targets, clear human language, and high-contrast light and dark themes instead of overwhelming rescuers with raw hexadecimal data and technical charts.
8. What We Learned
The gap between BLE specifications and real-world Android behaviour: Android background restrictions, Doze mode, scanning throttling, and power-saving behaviour make BLE implementation more challenging than theoretical specifications suggest.
Why raw RSSI numbers lie indoors: Walls, human bodies, concrete, and signal reflections affect radio propagation. Combining a Kalman filter with model-based distance intervals provides more realistic proximity guidance than claiming exact centimetre-level precision.
Why battery optimization matters: Emergency communication must remain functional even when smartphones have very limited battery power.
Why cutting features can make a crisis tool stronger: During development, we removed a GPS-based team map and survivor-to-survivor chat from the active scope. GPS can fail indoors, and trapped survivors should not be encouraged to move.
We decided to concentrate on the final-metres rescue workflow: detecting, prioritizing, and communicating with survivors when conventional infrastructure is unavailable.
9. What's Next for Vigil?
1. Multi-Hop BLE Mesh Relaying
Allow nearby survivor smartphones to relay one another's 5-byte emergency beacons, potentially extending discovery beyond a single BLE connection.
2. Barometric Floor Estimation
Use atmospheric pressure differences to estimate relative vertical displacement in multi-storey building collapses.
The approximate barometric altitude relation is:
Δh ≈ -8.43 m/hPa · ΔP
where Δh is in metres and ΔP is in hPa. This could help rescuers estimate whether a survivor is above or below their current level.
3. Offline Team Coordination Map
Develop a peer-to-peer search grid that allows rescue teams to mark cleared zones without internet connectivity.
4. Native iOS Companion Application
Explore iOS Bluetooth background capabilities and supported critical notification mechanisms to extend Vigil's functionality to Apple devices.
5. Real-World Field Testing
Collaborate with disaster-response organizations and student volunteer units to evaluate Vigil under controlled field conditions.
10. Limitations
Close-Range Operation: BLE is intended for final-stage survivor pinpointing. Vigil is not designed to replace broader search operations involving dogs, drones, or other detection equipment.
Android-First Prototype: Full two-way beacon and remote alarm functionality currently requires Android devices with Bluetooth enabled.
Physical Estimates: Distance estimation, body-shielded direction finding, and sensor-based impact detection are approximations affected by obstacles, environmental conditions, and device characteristics.
Passive Device Discovery: Bluetooth scanning depends on whether nearby devices expose detectable advertisements. It cannot guarantee discovery of every smartphone or wearable.
Prototype Key Distribution: The hackathon demo includes a development signing key. In production, private keys must be protected and exclusively controlled by authenticated rescue-team hardware.
Prototype Disclaimer: Vigil is a hackathon proof-of-concept and is not a replacement for official emergency services.
11. Credits
Technologies Used:
Kotlin
Jetpack Compose
Material 3
AndroidX
Kotlin Coroutines
Development was assisted by Claude (Anthropic) as an AI pair programmer.
Vigil – Because even when the network goes silent, the search for life must continue.
Built With
- accelerometer
- android
- android-sensors
- android-studio
- androidx
- ble
- bluetooth
- claude
- cryptography
- digital-signal-processing
- ecdsa
- gatt
- gradle
- jetpack-compose
- kalman-filter
- kotlin
- kotlin-coroutines
- material-design-3
- pcm-audio
- sha-256