Skip to content

Commit 2ae3c4a

Browse files
Add ATSC Channel Scanner for Digital TV Broadcasts (#221)
* Initial plan * Add ATSC channel scanner utilities and components Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> * Add tests and integrate ATSC scanner into Scanner page Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> * Add comprehensive ATSC Scanner documentation Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> * Fix linting issues in ATSC scanner implementation Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> * Address PR review comments: Fix IndexedDB keyPath, add input validation, fix pause/resume, improve cleanup, and enhance accessibility Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> * Address second round of PR review comments: Use storage functions, add validation, optimize memory, extract download utility Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> * Address third round of PR review comments: Fix DOM manipulation, add JSDoc, explicit type construction, improve comments, move functions outside component Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> * Address fourth round of PR review: Use type assertion after validation, optimize array operations with chunked push Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> * Fix Scanner test by mocking useATSCScanner hook and ATSCScanner component Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexthemitchell <5687158+alexthemitchell@users.noreply.github.com>
1 parent 4d4ff0b commit 2ae3c4a

File tree

12 files changed

+3329
-6
lines changed

12 files changed

+3329
-6
lines changed

docs/features/ATSC-Scanner.md

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# ATSC Channel Scanner
2+
3+
The ATSC Channel Scanner is a comprehensive tool for discovering and monitoring ATSC (Advanced Television Systems Committee) digital television broadcasts across VHF and UHF frequencies.
4+
5+
## Features
6+
7+
### Channel Scanning
8+
9+
- **VHF-Low Band (Channels 2-6)**: 54-88 MHz
10+
- **VHF-High Band (Channels 7-13)**: 174-216 MHz
11+
- **UHF Band (Channels 14-36)**: 470-608 MHz (post-repack)
12+
13+
### Detection Capabilities
14+
15+
- **Pilot Tone Detection**: Identifies ATSC pilot tone at 309.44 kHz offset from lower band edge
16+
- **Sync Lock Detection**: Validates segment and field sync patterns using ATSC 8-VSB demodulator
17+
- **Signal Quality Measurement**:
18+
- Signal-to-Noise Ratio (SNR)
19+
- Modulation Error Ratio (MER)
20+
- Signal strength (0-100% scale)
21+
22+
### Storage & Export
23+
24+
- **IndexedDB Persistence**: Found channels are automatically saved to browser storage
25+
- **Export/Import**: Download channel lists as JSON for backup or sharing
26+
- **Channel Management**: Clear, view, and organize discovered channels
27+
28+
## Usage
29+
30+
### Accessing the Scanner
31+
32+
1. Navigate to the Scanner page in rad.io
33+
2. Select "ATSC" from the signal type selector
34+
3. Configure your scan parameters
35+
36+
### Scan Configuration
37+
38+
#### Bands to Scan
39+
40+
Choose which frequency bands to scan:
41+
42+
- ☑ VHF-Low (Ch 2-6): Lower VHF television channels
43+
- ☑ VHF-High (Ch 7-13): Upper VHF television channels
44+
- ☑ UHF (Ch 14-36): UHF television channels (post-repack)
45+
46+
#### Detection Settings
47+
48+
- **Threshold**: Signal detection threshold in dB above noise floor (5-30 dB)
49+
- Default: 15 dB
50+
- Higher values reduce false positives but may miss weak signals
51+
- **Dwell Time**: Time spent analyzing each channel (100-2000 ms)
52+
- Default: 500 ms
53+
- Longer dwell times improve sync detection accuracy
54+
- **Require Pilot Tone**: Only report channels with detected ATSC pilot
55+
- Recommended: Enabled
56+
- Ensures detected signals are actually ATSC broadcasts
57+
- **Require Sync Lock**: Only report channels where demodulator achieves sync
58+
- Default: Disabled (slower but more accurate when enabled)
59+
- Enable for highest confidence in signal validity
60+
61+
### Scanning Process
62+
63+
1. **Configure Bands**: Select which frequency bands to scan
64+
2. **Set Detection Parameters**: Adjust threshold and dwell time as needed
65+
3. **Start Scan**: Click "Start Scan" to begin
66+
4. **Monitor Progress**: Watch real-time progress and current channel
67+
5. **Review Results**: View found channels sorted by signal strength
68+
69+
### Found Channels
70+
71+
Each discovered channel displays:
72+
73+
- **Channel Number**: Physical RF channel (2-36)
74+
- **Frequency**: Center frequency in MHz
75+
- **Band**: VHF-Low, VHF-High, or UHF
76+
- **Strength**: Signal strength as percentage
77+
- **SNR**: Signal-to-Noise Ratio in dB
78+
- **Quality**: Pilot detection, sync lock, and MER (if available)
79+
- **Discovered**: Timestamp when channel was first found
80+
81+
### Actions
82+
83+
- **Tune**: Navigate to Live Monitor with selected channel frequency
84+
- **Export**: Download channel list as JSON file
85+
- **Clear**: Remove all found channels from storage
86+
87+
## Technical Details
88+
89+
### ATSC Standard
90+
91+
ATSC (Advanced Television Systems Committee) is the digital television standard used primarily in North America. The scanner implements:
92+
93+
- **8-VSB Modulation**: 8-level Vestigial Sideband
94+
- **6 MHz Channel Bandwidth**: Standard TV channel spacing
95+
- **Pilot Tone**: 309.44 kHz offset for carrier recovery
96+
- **Symbol Rate**: 10.76 Msymbols/sec
97+
98+
### Detection Algorithm
99+
100+
1. **Tune to Channel**: Set SDR to channel center frequency
101+
2. **Collect IQ Samples**: Gather samples for FFT analysis
102+
3. **FFT Analysis**: Compute power spectrum
103+
4. **Peak Detection**: Find spectral peaks above threshold
104+
5. **Pilot Detection**: Verify pilot tone at expected offset
105+
6. **Demodulation**: Run ATSC 8-VSB demodulator
106+
7. **Sync Detection**: Check for segment and field sync patterns
107+
8. **Quality Metrics**: Calculate SNR and MER
108+
109+
### Storage Format
110+
111+
Channels are stored in IndexedDB with the following schema:
112+
113+
```typescript
114+
{
115+
channel: {
116+
channel: number, // Physical channel number
117+
frequency: number, // Center frequency (Hz)
118+
lowerEdge: number, // Lower band edge (Hz)
119+
upperEdge: number, // Upper band edge (Hz)
120+
pilotFrequency: number, // Pilot tone frequency (Hz)
121+
band: string // "VHF-Low" | "VHF-High" | "UHF"
122+
},
123+
strength: number, // 0-1 signal strength
124+
snr: number, // SNR in dB
125+
mer?: number, // MER in dB (optional)
126+
pilotDetected: boolean, // Pilot tone present
127+
syncLocked: boolean, // Sync achieved
128+
segmentSyncCount: number,// Number of segment syncs
129+
fieldSyncCount: number, // Number of field syncs
130+
discoveredAt: Date, // First scan timestamp
131+
lastScanned: Date, // Most recent scan
132+
scanCount: number // Total scan count
133+
}
134+
```
135+
136+
## Best Practices
137+
138+
### Optimal Settings
139+
140+
- **Urban Areas**: Use higher threshold (20 dB) to reduce interference
141+
- **Rural Areas**: Use lower threshold (10-12 dB) to find distant signals
142+
- **Quick Scan**: Disable sync lock requirement, use 200-300ms dwell
143+
- **Thorough Scan**: Enable sync lock, use 1000ms+ dwell time
144+
145+
### Troubleshooting
146+
147+
**No channels found:**
148+
149+
- Ensure SDR device is connected and antenna is attached
150+
- Lower detection threshold
151+
- Increase dwell time
152+
- Check that selected bands are appropriate for your location
153+
154+
**Many false positives:**
155+
156+
- Increase detection threshold
157+
- Enable "Require Pilot Tone"
158+
- Enable "Require Sync Lock"
159+
160+
**Scan is slow:**
161+
162+
- Reduce dwell time
163+
- Disable sync lock requirement
164+
- Scan fewer bands
165+
166+
## Architecture
167+
168+
### Component Structure
169+
170+
```
171+
ATSCScanner (UI Component)
172+
173+
useATSCScanner (Business Logic Hook)
174+
175+
├── ATSC8VSBDemodulator (Signal Processing)
176+
├── atscChannels (Frequency Plan)
177+
└── atscChannelStorage (IndexedDB Persistence)
178+
```
179+
180+
### Data Flow
181+
182+
1. User configures scan parameters in `ATSCScanner` component
183+
2. Component calls `useATSCScanner` hook methods
184+
3. Hook manages device, demodulator, and scanning state
185+
4. For each channel:
186+
- Tune device to frequency
187+
- Collect IQ samples
188+
- Perform FFT analysis
189+
- Detect pilot tone
190+
- Run demodulator for sync
191+
- Calculate quality metrics
192+
5. Found channels saved to IndexedDB
193+
6. UI updates with results
194+
195+
## Future Enhancements
196+
197+
Potential improvements for future versions:
198+
199+
- **PSIP Decoding**: Extract virtual channel numbers and station names
200+
- **Program Guide**: Parse EPG data from broadcast stream
201+
- **Closed Captions**: Decode and display CC data
202+
- **Multi-Program Detection**: Identify sub-channels within a channel
203+
- **Signal Logging**: Track signal quality over time
204+
- **Geolocation Integration**: Map channels to tower locations
205+
- **Spectrum Visualization**: Real-time spectrum display during scan
206+
207+
## References
208+
209+
- [ATSC Standard A/53](https://www.atsc.org/atsc-documents/a53-atsc-digital-television-standard/)
210+
- [FCC TV Channel Repack](https://www.fcc.gov/about-fcc/fcc-initiatives/incentive-auctions)
211+
- [ATSC 8-VSB Demodulator Documentation](../plugins/demodulators/ATSC8VSBDemodulator.md)
212+
213+
## License
214+
215+
Part of the rad.io project. See project LICENSE for details.

0 commit comments

Comments
 (0)