Project 7: The Satellite Eye (NOAA APT Image Decoder)

Decode NOAA APT weather satellite transmissions into grayscale images with correct line sync and Doppler correction.

Quick Reference

Attribute Value
Difficulty Advanced
Time Estimate 3-4 weeks
Main Programming Language Python (Alternatives: C, Rust)
Alternative Programming Languages C++
Coolness Level Very High
Business Potential Medium (weather monitoring)
Prerequisites FM demod, filtering, basic image processing
Key Topics APT demodulation, sync pulse detection, Doppler correction

1. Learning Objectives

By completing this project, you will:

  1. Demodulate NOAA APT FM signals into baseband audio.
  2. Extract the 2.4 kHz APT subcarrier envelope.
  3. Detect sync pulses and align image lines.
  4. Correct for Doppler shifts during satellite passes.
  5. Build a full image from line-scanned data.

2. All Theory Needed (Per-Concept Breakdown)

2.1 APT Demodulation and Subcarrier Envelope Extraction

Fundamentals

NOAA APT (Automatic Picture Transmission) is an analog image transmission system. The satellite transmits an FM carrier around 137 MHz. The information is in a 2.4 kHz amplitude-modulated subcarrier. That subcarrier’s amplitude encodes pixel brightness as the satellite scans the Earth line by line. To decode APT, you must first FM demodulate the RF signal to audio, then extract the envelope of the 2.4 kHz subcarrier. The result is a stream of pixel values.

Deep Dive into the Concept

The APT signal structure is: RF FM carrier -> baseband audio -> 2.4 kHz subcarrier -> AM envelope = image. The FM demod is similar to broadcast FM but with a narrower deviation. A typical channel bandwidth of ~40 kHz is sufficient. After demodulation, you have an audio signal containing the 2.4 kHz subcarrier and sync pulses around 1040 Hz. The 2.4 kHz subcarrier is amplitude modulated by the image brightness. To recover brightness, you band-pass filter around 2.4 kHz, then compute the envelope (magnitude or absolute value after Hilbert transform). This is analogous to AM demodulation.

The envelope must then be resampled to a fixed line rate. Each APT line is 0.5 seconds long and contains 2080 pixels, yielding a pixel rate of 4160 samples per second. Your decoder must resample to this exact rate, otherwise the image will be stretched or compressed. This is where precise timing and resampling come in. If the satellite pass has Doppler shifts, the apparent subcarrier frequency changes slightly, which can distort the envelope if not corrected. A narrow band-pass filter centered at 2.4 kHz helps but must track Doppler.

Another issue is noise and fading during the pass. You may see lines with dropouts. A decoder can apply simple smoothing or interpolation to reduce noise, but you should still preserve raw information for correctness. A simple low-pass filter on the envelope can reduce high-frequency noise without blurring the image too much.

How this fits on projects

  • Implement in §5.10 and verify in §6.
  • Envelope extraction is similar to P02 (AM) and P03 (FM audio chain).

Definitions & key terms

  • APT: Automatic Picture Transmission.
  • Subcarrier: 2.4 kHz AM signal that encodes pixel brightness.
  • Envelope: Amplitude of the subcarrier representing grayscale.
  • Line rate: 2 lines per second (0.5 s per line).

Mental model diagram (ASCII)

FM IQ -> FM demod -> BPF(2.4k) -> Envelope -> Pixels

How it works (step-by-step, with invariants and failure modes)

  1. Tune to NOAA frequency and FM demod.
  2. Band-pass filter around 2.4 kHz.
  3. Extract envelope to get brightness.
  4. Resample to pixel rate.

Failure modes:

  • Incorrect resampling -> stretched image.
  • Poor SNR -> noisy image.

Minimal concrete example

bpf = firwin(numtaps, [2000, 2800], fs=audio_fs, pass_zero=False)
sub = lfilter(bpf, 1.0, audio)
img = np.abs(sub)

Common misconceptions

  • “APT is digital.” It is an analog image signal.
  • “Any sample rate works.” You must resample to line rate.

Check-your-understanding questions

  1. Where is the image information encoded in APT?
  2. Why do you need envelope detection?
  3. What happens if you resample at the wrong rate?

Check-your-understanding answers

  1. In the amplitude of the 2.4 kHz subcarrier.
  2. Because the subcarrier is AM-modulated by the image.
  3. The image will be stretched or compressed.

Real-world applications

  • Weather satellite image reception.
  • Educational Earth observation.

Where you’ll apply it

  • This project: §3.4, §5.10.
  • Also used in: P02 AM.

References

  • “Practical SDR” Ch. 12
  • NOAA APT documentation

Key insights

APT decoding is FM demod plus AM envelope extraction at 2.4 kHz.

Summary

You learned how to demodulate NOAA APT and extract image brightness.

Homework/Exercises to practice the concept

  1. Simulate AM on a 2.4 kHz tone and recover the envelope.
  2. Test different BPF widths and observe noise.
  3. Resample to line rate and plot a single line.

Solutions to the homework/exercises

  1. Envelope matches the simulated brightness pattern.
  2. Narrower BPF reduces noise but may distort if too narrow.
  3. Correct line length is 2080 pixels.

2.2 Sync Pulse Detection and Doppler Correction

Fundamentals

APT images are transmitted line by line with sync pulses that mark line boundaries. Each line begins with a distinctive sync pattern at about 1040 Hz. To reconstruct the image, you must detect these sync pulses and align lines accordingly. During a satellite pass, Doppler shifts the received frequency by a few kHz. This shifts the subcarrier and can affect both envelope extraction and timing. A decoder must compensate for Doppler to keep sync stable.

Deep Dive into the Concept

The APT sync signal consists of a sequence of black and white levels that creates a recognizable pattern in the envelope. Commonly, there is a 1040 Hz sync pulse followed by a calibration pattern. You can detect sync by correlating a known pattern or by thresholding the envelope to detect a strong black-to-white transition. A practical approach is to compute a sliding correlation with a template of the sync sequence. When correlation peaks, you align a new line.

Doppler shift is caused by the satellite’s relative velocity, up to around ±4 kHz in the 137 MHz band. This shifts the FM carrier, which after demodulation can shift the 2.4 kHz subcarrier slightly. If your BPF is too narrow, the subcarrier may drift out of band during the pass. A wider filter tolerates Doppler but increases noise. Another strategy is to correct Doppler by dynamically adjusting the center frequency based on predicted satellite pass or by estimating the instantaneous frequency and adjusting your tuning in software.

Doppler correction can be approximate: you can track the mean frequency of the subcarrier or the sync pulse tone and re-center your filter accordingly. If you implement a small frequency tracking loop that estimates the subcarrier frequency, you can update the BPF or re-mix the audio to keep the subcarrier centered at 2.4 kHz.

Line alignment is sensitive to timing errors. If you mis-detect a sync pulse, the image shifts and becomes slanted. To stabilize, you can enforce a minimum time between sync detections (0.5 s) and reject candidates that are too close. You can also use a phase-locked loop on the line rate to smooth out jitter.

How this fits on projects

  • Implement sync detection and Doppler correction in §5.10.
  • Doppler handling concepts appear in P10 (GPS Doppler search).

Definitions & key terms

  • Sync pulse: Known pattern marking line start.
  • Line rate: 2 lines per second.
  • Doppler shift: Frequency shift due to relative motion.
  • Correlation: Similarity measure for pattern detection.

Mental model diagram (ASCII)

Envelope -> Sync detector -> Line boundaries -> Image assembly
          ^
          |
      Doppler tracking

How it works (step-by-step, with invariants and failure modes)

  1. Compute envelope.
  2. Slide a sync template and detect peaks.
  3. Enforce expected line spacing (~0.5 s).
  4. Adjust filter center for Doppler.

Failure modes:

  • False sync -> slanted image.
  • Doppler drift -> subcarrier fades.

Minimal concrete example

# simple sync detection
corr = np.convolve(envelope, sync_template[::-1], mode="valid")
line_starts = peaks(corr, threshold=0.8)

Common misconceptions

  • “Sync pulses are always clean.” They are often noisy.
  • “Doppler only shifts RF.” It shifts the entire baseband.

Check-your-understanding questions

  1. Why must line alignment be precise?
  2. How does Doppler affect the 2.4 kHz subcarrier?
  3. What prevents false sync detections?

Check-your-understanding answers

  1. Small timing errors accumulate into slanted images.
  2. It shifts the subcarrier frequency and may reduce filter alignment.
  3. Correlation thresholds and line-rate constraints.

Real-world applications

  • Satellite imaging and telemetry systems.

Where you’ll apply it

  • This project: §3.7, §5.10.
  • Also used in: P10 GPS.

References

  • NOAA APT guides and community references

Key insights

Stable APT images require both accurate sync detection and Doppler-aware filtering.

Summary

You learned how to detect sync pulses, enforce line timing, and compensate for Doppler.

Homework/Exercises to practice the concept

  1. Correlate a sync pattern in a noisy envelope and measure detection rate.
  2. Simulate Doppler drift and test tracking.
  3. Reconstruct an image with and without sync constraints.

Solutions to the homework/exercises

  1. Peaks should appear near true line starts.
  2. Tracking reduces drift and improves image stability.
  3. Without constraints, lines drift and skew.

3. Project Specification

3.1 What You Will Build

A NOAA APT decoder that outputs a grayscale PNG image from a recorded IQ file or live capture.

3.2 Functional Requirements

  1. Tune NOAA APT frequency and FM demod.
  2. Extract 2.4 kHz subcarrier envelope.
  3. Detect sync pulses and align lines.
  4. Resample to 2080 pixels per line.
  5. Output a PNG image with correct aspect ratio.

3.3 Non-Functional Requirements

  • Performance: Process a 10-minute capture in under 1 minute offline.
  • Reliability: Stable line sync across full pass.
  • Usability: CLI options for frequency and Doppler tracking.

3.4 Example Usage / Output

$ python noaa_apt.py --input noaa15.iq --fs 2.4e6 --freq 137.620e6
[INFO] Sync pulses detected: 720 lines
[INFO] Image saved: noaa15.png

3.5 Data Formats / Schemas / Protocols

  • Output PNG grayscale (8-bit).
  • Optional raw line data file for debugging.

3.6 Edge Cases

  • Weak pass with missing sync pulses.
  • Doppler drift causing subcarrier shift.
  • Incorrect line length causing skew.

3.7 Real World Outcome

A recognizable NOAA weather image with land/sea contrast and cloud patterns.

3.7.1 How to Run (Copy/Paste)

python noaa_apt.py --input noaa15.iq --fs 2400000 --freq 137620000 \
  --doppler-track --output noaa15.png

3.7.2 Golden Path Demo (Deterministic)

Use a known NOAA APT capture. Expected: clean image with aligned lines and readable calibration bars.

3.7.3 CLI Transcript (Exact)

$ python noaa_apt.py --input test_noaa.iq --fs 2400000
[INFO] Lines decoded: 540
[OK] Wrote test_noaa.png

3.7.4 Failure Demo

$ python noaa_apt.py --input weak_pass.iq --fs 2400000
[WARN] Sync pulses inconsistent; image may be skewed
[EXIT] code=3

4. Solution Architecture

4.1 High-Level Design

IQ -> FM demod -> BPF(2.4k) -> Envelope -> Sync -> Resample -> Image

4.2 Key Components

| Component | Responsibility | Key Decisions | |———–|—————-|—————| | Demod | FM discriminator | Channel width | | Envelope | AM detection | Method (abs vs Hilbert) | | Sync Detector | Line alignment | Correlation vs threshold | | Resampler | Line rate | 2080 px per line |

4.3 Data Structures (No Full Code)

class AptImage:
    lines: list[np.ndarray]

4.4 Algorithm Overview

Key Algorithm: APT Line Reconstruction

  1. Demod FM and extract envelope.
  2. Detect sync pulses.
  3. Slice each 0.5s segment into a line.
  4. Resample to 2080 pixels.

Complexity Analysis:

  • Time: O(N)
  • Space: O(lines * 2080)

5. Implementation Guide

5.1 Development Environment Setup

pip install numpy scipy pillow

5.2 Project Structure

noaa-apt/
├── src/
│   ├── main.py
│   ├── demod.py
│   ├── envelope.py
│   ├── sync.py
│   └── image.py
└── tests/

5.3 The Core Question You’re Answering

“How do you turn a noisy FM subcarrier into a line-scanned image?”

5.4 Concepts You Must Understand First

  1. Envelope extraction (§2.1)
  2. Sync detection and Doppler correction (§2.2)

5.5 Questions to Guide Your Design

  1. How will you detect sync pulses reliably?
  2. What line rate will you enforce?
  3. How will you correct Doppler shifts?

5.6 Thinking Exercise

Draw one APT line with sync and image pixels. Mark where you expect the sync to appear.

5.7 The Interview Questions They’ll Ask

  1. Why is APT considered analog?
  2. Why is Doppler significant for LEO satellites?
  3. How do you align lines without metadata?

5.8 Hints in Layers

  1. FM demod to audio.
  2. Band-pass around 2.4 kHz and take envelope.
  3. Correlate with sync template.
  4. Resample each line to 2080 pixels.

5.9 Books That Will Help

| Topic | Book | Chapter | |——-|——|———| | FM demod | Lyons | Ch. 13 | | Signal processing | Smith | Ch. 23 |

5.10 Implementation Phases

Phase 1: Foundation (5-7 days)

Goals: Demod and envelope extraction. Checkpoint: Plot envelope and see sync pulses.

Phase 2: Core Functionality (7-10 days)

Goals: Sync detection and line assembly. Checkpoint: Image lines aligned.

Phase 3: Polish & Edge Cases (5-7 days)

Goals: Doppler tracking and noise handling. Checkpoint: Clean image across full pass.

5.11 Key Implementation Decisions

| Decision | Options | Recommendation | Rationale | |———-|———|—————-|———–| | Envelope method | abs vs Hilbert | abs | Simple and sufficient | | Sync detection | threshold vs correlation | correlation | Robust to noise |


6. Testing Strategy

6.1 Test Categories

| Category | Purpose | Examples | |———|———|———-| | Unit | Sync detection | Known template | | Integration | Full decode | Public NOAA IQ file | | Edge | Weak pass | Missing lines |

6.2 Critical Test Cases

  1. Known capture yields aligned image.
  2. Doppler shift simulation still decodes.
  3. Missing sync produces warning but continues.

6.3 Test Data

Use public NOAA APT IQ samples.

7. Common Pitfalls & Debugging

7.1 Frequent Mistakes

| Pitfall | Symptom | Solution | |———|———|———-| | Wrong line rate | Skewed image | Resample to 2080 px | | No Doppler correction | Fading subcarrier | Track frequency | | Weak sync detection | Slanted lines | Use correlation |

7.2 Debugging Strategies

  • Plot correlation peaks for sync.
  • Compare line length distribution.

7.3 Performance Traps

  • Processing entire pass with heavy filters at full rate.

8. Extensions & Challenges

8.1 Beginner Extensions

  • Add contrast stretching for better visibility.

8.2 Intermediate Extensions

  • Overlay map or coastline grid.

8.3 Advanced Extensions

  • Automatically schedule passes and decode live.

9. Real-World Connections

9.1 Industry Applications

  • Weather satellite data reception.
  • wxtoimg and forks.
  • noaa-apt decoders.

9.3 Interview Relevance

  • Demonstrates DSP to image pipeline skills.

10. Resources

10.1 Essential Reading

  • NOAA APT user guides
  • Practical SDR Ch. 12

10.2 Video Resources

  • NOAA APT decoding tutorials

10.3 Tools & Documentation

  • satnogs tools for reference

11. Self-Assessment Checklist

11.1 Understanding

  • I can explain how APT encodes images.
  • I can detect and align sync pulses.

11.2 Implementation

  • I can decode a full NOAA image.
  • Image is not skewed.

11.3 Growth

  • I can handle Doppler correction.

12. Submission / Completion Criteria

Minimum Viable Completion:

  • Decode a NOAA APT image from a recorded file.

Full Completion:

  • Stable decode across full pass with correct alignment.

Excellence (Going Above & Beyond):

  • Automated live decoding with Doppler prediction.