RF_SENTINEL

rf_sentinel / hardware / internals

How the external hardware works

What RF Sentinel does with each radio you plug in, down to sample rates, frame formats and thresholds. Every number here is a constant in the public source; file names point at the Kotlin classes under app/src/main/java/com/rfsentinel/app/. Which hardware to buy is on External hardware.

  1. Ground rules
  2. SDR basics
  3. RTL-SDR driver
  4. HackRF One
  5. Network SDR (rtl_tcp)
  6. Modes, turns and the waterfall
  7. Radio activity sweep
  8. Cellular uplink
  9. TETRA bursts
  10. P25 control channel
  11. P25 voice (experimental)
  12. ADS-B aircraft
  13. USB WiFi monitor mode
  14. USB Bluetooth
  15. ESP32 boards over USB
  16. OUI-Spy over Bluetooth
  17. V2X emergency vehicles
  18. Sentinel Link and Meshtastic
  19. Limits
  20. Questions

Ground rules

SDR basics

An SDR (software-defined radio) is a tuner plus an analogue-to-digital converter: it hands the app a stream of I/Q samples, pairs of numbers that describe the amplitude and phase of everything within a slice of spectrum around the tuned frequency. The app does all filtering and decoding in software (sdr/SdrRadio.kt).

SettingValue
Sample rate2.048 MS/s (2 MS/s for ADS-B), so each tune sees about 2 MHz of spectrum
GainFixed 29.7 dB for sweeps and P25; 49.6 dB (the tuner's maximum) for ADS-B. No AGC, so levels are comparable over time
USB read16 KB (8192 complex samples), about 4 ms of signal each; 8 reads per tuned chunk (16 for TETRA, to see whole frames)
Stalled streamAfter 8 empty chunks the stream is reset, as librtlsdr's reset_buffer does
Unplug detectionThe device is checked every couple of seconds; a USB SDR plugged in takes over from a network SDR

Driver messages go into each piece of hardware's own log (Settings › External hardware › Export a hardware log, or Export all hardware logs for one file), without positions.

RTL-SDR driver

sdr/RtlSdr.kt is a Kotlin port of osmocom's librtlsdr (GPL-2.0-or-later) for the RTL2832U demodulator chip with an R820T, R820T2, R860 or R828D tuner.

HackRF One

sdr/HackRf.kt speaks libhackrf's USB vendor requests, receive only: amplifier off, antenna port power off, sample rate 2 to 20 MS/s. The HackRF sends signed 8-bit I/Q; it is converted to the RTL-SDR's unsigned format so the rest of the code is shared. About 48 KB of samples still in flight after a retune are dropped, so they don't land in the wrong channel.

Network SDR (rtl_tcp)

Settings › RTL-SDR radio › Network SDR reads an RTL-SDR plugged into another device on your WiFi, such as a computer running rtl_tcp (default port 1234 if left out) (sdr/RtlTcp.kt).

Modes, turns and the waterfall

Settings › RTL-SDR radio has four uses: radio sweep, ADS-B, P25 and pagers. One dongle can only listen to one frequency range at a time, so with more than one ticked the SDR takes turns: 60 s each by default, 30 to 300 s per scan.

The live waterfall (Tools › Radio waterfall, sdr/SdrWaterfall.kt) shows each sweep as one row. Zoom in on a few channels and it switches to a tuned view (4 reads per row, up to about 25 rows per second); the sweep and ADS-B pause while you look. Tune › Listen demodulates the zoomed frequency (AM for aircraft, wide FM for broadcast, narrow FM otherwise) to the media speaker.

Find a remote's frequency hops ten centres where remotes send (300, 303.875, 310, 315, 318, 390, 418, 433.92, 868.35 and 915 MHz), about 60 ms each. A peak counts when it stands 15 dB above the median noise in at least 2 of the look's 15 spectra; peaks within 30 kHz are one signal. The first two rounds, before you press, learn the signals already on the air (sensors, data) and those are never shown. The strongest signal stays on screen for 3 s.

Radio activity sweep

sdr/RadioWatch.kt answers one question: is someone transmitting on a public-safety channel near me? It measures energy only. Nothing is demodulated, unless Play voice transmissions is on: then the first new transmission of a chunk is tuned to (its spectrum peak, not the 12.5 kHz grid) and played, as narrow FM with a squelch, or as P25 voice when the identification listen heard P25. Back to the sweep after 1.5 s of closed squelch (P25: the call's end) or 60 s.

  1. The tuner steps across each band. Every chunk is cut into 1024-point FFTs with a Hann window, averaged and shifted so 0 Hz is in the middle.
  2. Only the middle ±800 kHz of each 2 MHz chunk is used (the edges are filtered off), and ±15 kHz around the centre is ignored for DC leakage.
  3. The spectrum is grouped into 12.5 kHz channels. The noise floor is the median of the chunk; a channel's SNR is its peak above that median.
  4. A channel at or above the sensitivity (default 30 dB, settable 6 to 50 dB) is a candidate; 12 dB counts as "active" for learning.
  5. Splatter: a strong transmitter spills into its neighbours, so candidates within 37.5 kHz of each other are merged and only the strongest is kept.
  6. Busy-channel learning: the last 32 visits of every channel are kept. A channel active on 40 % or more of them (after at least 6 visits) is a busy local channel (a repeater, a paging tower, data) and is never reported. No alerts during the first 6 sweeps, while it learns.
  7. The same channel alerts again only after 120 s.
BandRangeNote
700 MHz public safety799-805 MHzNarrowband public-safety channels
800 MHz806-813.9 MHzMobile and portable transmit side
VHF high150.8-174 MHzShared with business and other users
UHF450-470 MHzShared with business and other users

Always skipped: MURS, marine VHF, railroad, NOAA weather, FRS / GMRS and paging frequencies, and any range you exclude. Frequencies you add as targets skip the learning and alert straight away. A hit is "a radio transmitted nearby", not "police": VHF and UHF are shared, which is why the default sensitivity is high.

Cellular uplink

Detect cellular transmitters (experimental, off by default). Phones transmit on the uplink half of each LTE band; a sudden crowd of uplink energy around you (many phones, or a vehicle's modem) can be measured without decoding anything. The same sweep looks at about 1.6 MHz slices of the uplink bands 71, 12/17, 13, 14 (FirstNet), 5/26 and part of 4/66, learns each slice's quiet level (a slow average, alpha 0.1) and flags a rise of 8 dB or more. Downlinks (towers) are left out on purpose: they are always on.

TETRA bursts

TETRA (used by police in Europe and elsewhere) is TDMA: a handset transmits in one 14.17 ms slot of a 56.67 ms frame. On the 380-385 MHz handset band (the 390-395 MHz base stations are left out), the app reads 16 USB blocks per tune, measures energy in 2 ms steps and calls a channel TDMA when it is on for runs of 0.5 to 2 slots, quiet at least a third of the time and on no more than 60 %. That rhythm is TETRA's fingerprint; the content is never decoded.

P25 control channel

A P25 trunked system has one control channel that tells radios which voice channel to use for each call. RF Sentinel decodes that signalling (experimental), which shows which talkgroups are active, without listening to calls. The chain follows TIA-102.BAAA and the open-source OP25 project.

  1. Hunt (sdr/P25Hunt.kt): sweeps the 769-775 and 851-869 MHz downlinks, tries the strongest channels first and keeps the first one whose messages pass their CRC. No ppm calibration is needed: the demodulator's frequency loop follows the dongle's drift. If nothing is found it tries again after 30 s.
  2. Demodulate (sdr/P25Demod.kt): mixes the 12.5 kHz channel to 0 Hz, decimates by integrate-and-dump to 48 kS/s, low-pass filters, then an FM discriminator gives the C4FM signal (4 levels, 4800 symbols/s, 2 bits each). The 48-bit frame sync 0x5575F5FF77FF (24 symbols) sets symbol timing, the ±3 level and the DC offset.
  3. Frame (sdr/P25Frame.kt): removes the status symbol after every 35 data symbols, corrects the Network ID with BCH(63,16,23) (up to 11 bit errors), then takes each TSBK block (98 symbols), de-interleaves it, decodes the rate-1/2 trellis code with a Viterbi decoder and checks its CRC.
  4. Messages (sdr/P25Tsbk.kt): standard (MFID 0) messages only.
OpcodeMessageUsed for
0x00Group voice channel grantA talkgroup got a voice channel: the log entry
0x02Grant updateCalls still running
0x28Group affiliation responseA radio joined a talkgroup
0x3D, 0x34Identifier updateTurns channel numbers into frequencies
0x3A, 0x3BRFSS / network statusSite and system identity
0x3CAdjacent siteNeighbour sites

Input check: 400 ms after a grant, at most every 5 s, the app tunes for about 70 ms to the voice channel's input (the frequency the radios transmit on). Energy there means a radio transmitting close to you, not just somewhere on the system.

Talkgroup names (optional, off by default, US only, sdr/RadioReference.kt): with your own RadioReference Premium login and developer key (stored encrypted on the phone), the app looks up the FCC-licensed system around you. It sends a position rounded to about 1 km, at most once a day per area.

P25 voice (experimental)

With Listen to P25 voice (Off, Watched talkgroups or All clear calls), the app follows a clear (unencrypted) call's grant to the voice channel (sdr/P25Follow.kt), one call at a time, and misses control-channel messages meanwhile. It gives up if no voice frame arrives in 1.5 s, ends after 1 s of quiet and stops at 120 s.

Frame layout and tables from DSD and mbelib (ISC). IMBE is a voice coding method of Digital Voice Systems, Inc. Listening to radio voice traffic is illegal in some places: check the law where you are.

ADS-B aircraft

Aircraft broadcast their position on 1090 MHz. sdr/ModeS.kt decodes it at 2 MS/s:

sdr/AdsbTracker.kt turns an even and an odd CPR message into a position, then decodes later ones locally against the aircraft's last position and drops anything beyond 450 km. The aircraft list goes to the police-aircraft check every 2 s, with no internet needed.

USB WiFi monitor mode

In monitor mode an adapter hands over every 802.11 frame it hears, not just its own network's. The app's userspace drivers (usb/, ported from the Linux drivers, Wardrive Go, devourer and mt76; see NOTICE.md) bring the chip up, tune it and read the frames. They follow the Linux drivers' initialisation order.

ChipChannels hoppedDwell per channel
AR92712.4 GHz, 1, 6, 11 first500 ms
RT3070, RTL81872.4 GHz 1-13350 ms
RTL8811AU / 8821AU, RTL8812AU1-13, 36-48, 149-165350 ms
RTL8814AU1-13, 36-48, 149-165125 ms
RTL8812BU / 8822BU1-13, 36-48, 149-165, DFS 52-144200 ms
MT7612U1-13, 36-165 including DFS125 ms
MT7921AU2.4 + 5 GHz and the 6 GHz preferred scanning channels (5, 21, 37 ... 229), visited less often unless active150 ms

USB Bluetooth

A USB Bluetooth dongle, or the Bluetooth side of a MT7921AU / Realtek combo adapter, becomes a second Bluetooth LE scanner (usb/HciUsb.kt), as Linux's btusb drives it: HCI commands as class requests on endpoint 0, events read from the interrupt endpoint. No data (ACL / SCO) channels are opened.

ESP32 boards over USB

esp/SerialPort.kt opens the board's USB serial port at 115200 baud, 8N1:

esp/EspReader.kt then works out which firmware is talking, in this order, and only sends read-only commands:

FirmwareHow it is recognised and read
OUI-Spy / Flock YouStreams JSON lines by itself ({"event":"detection",...}, Sky Spy drone lines); the app may ask CMD:VERSION and CMD:DUMP_LIVE
V2X2MAPIts binary ITS5 stream (see V2X)
GhostESPhelp, then its scan and list commands
ESP32 Marauderhelp, then sniffbeacon / sniffprobe; also through a Flipper Zero's USB-UART bridge
FREE-WiLi 2The console's WiFi menu keys and its AP scan only

OUI-Spy over Bluetooth

The OUI-SPY App-Controlled firmware is driven over Bluetooth GATT (esp/OuiSpyBle.kt): a 128-bit service ending -0a15-4b70-ba00-c010ae1ba01c, MTU 247, reconnect every 8 s if lost. The app turns on the engines it needs (Detector, Flock BLE, Flock WiFi, Sky Spy, survey) and sends DISABLE_ALL (0x0F) when you stop. With relaying on, its survey engine sends standard WiFi probe requests. Detections the board saved while offline arrive as spooled frames (0xFF ... 0xFE). Its attack-style engines (UniPwn, PCAP, Foxhunter) are never used.

V2X emergency vehicles

An ESP32-C5 running V2X2MAP (MIT) listens to 5.9 GHz vehicle-to-everything messages (ETSI ITS-G5). Its USB stream is "ITS5", seconds (u32), microseconds (u32), length (u16), then the raw 802.11 frame, little-endian. esp/V2x.kt finds the GeoNetworking ethertype 0x8947, decodes CAM and DENM messages (ETSI EN 302 637-2 / -3) and lists only emergency vehicles: light bar or siren on, or a DENM warning. The stream has no signal strength, so a nominal −70 dBm is shown.

Limits

Questions

Does the radio sweep listen to police radio?

Not by default in RF Sentinel. The sweep measures how much energy each 12.5 kHz channel carries. Only the experimental options decode audio: Play voice transmissions (the sweep's new transmissions, analog or unencrypted P25) and Listen to P25 voice (unencrypted trunked calls).

Which SDR should I buy?

For RF Sentinel, an RTL-SDR with an R820T2 or R828D tuner, such as the RTL-SDR Blog V3 or V4. A HackRF One works too but costs more and gives nothing extra here. For ADS-B, a 1090 MHz antenna helps a lot.

Do I need to calibrate the dongle's ppm error?

No. RF Sentinel's sweep works on 12.5 kHz channels wide enough for a dongle's drift, and the P25 demodulator's frequency loop follows the drift itself.

Can I use an SDR that is plugged into my computer?

Yes, RF Sentinel can use one over WiFi: run rtl_tcp -a 0.0.0.0 on the computer and enter its address under Settings › RTL-SDR radio › Network SDR. It needs a fast, trusted local network.

Can the USB WiFi drivers deauth or capture handshakes?

No. In RF Sentinel's USB WiFi drivers every transmit path, and the handshake / PMKID capture of the original drivers, was removed. They only listen.

Sources

Full credits and licences: usb/NOTICE.md and sdr/NOTICE.md.

Join the DiscordHelp, ideas, new signatures, field captures and ESP32 builds. CIS-C0/RFSentinel on GitHubSource code, releases, issues. A star helps others find it.