Module: PWN::SDR::Decoder::APT

Defined in:
lib/pwn/sdr/decoder/apt.rb

Overview

Pure-Ruby NOAA APT (Automatic Picture Transmission) decoder for the 137 MHz polar-orbiting weather satellites (NOAA-15/18/19).

APT is a 2400 Hz AM subcarrier inside a ~34 kHz-wide FM downlink carrying two 909-pixel image channels at 2 lines/second (4160 words/line). This module envelope-demodulates the 2400 Hz carrier from GQRX's 48 kHz UDP audio, resamples to 4160 words/sec, aligns each line on the 7-pulse Sync-A pattern, and appends the resulting 8-bit greyscale rows to a Netpbm PGM (P5) file — all in Ruby. No sox, no noaa-apt.

Defined Under Namespace

Classes: Demod

Constant Summary collapse

WORDS_PER_LINE =
4160
LINES_PER_SEC =
2
WORD_RATE =

8320 Hz

WORDS_PER_LINE * LINES_PER_SEC
SYNC_A =

Sync-A: 7 cycles of 1040 Hz square = 1 1 0 0 repeated 7 times

([1, 1, 0, 0] * 7).freeze

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. support@0dayinc.com



128
129
130
# File 'lib/pwn/sdr/decoder/apt.rb', line 128

public_class_method def self.authors
  "AUTHOR(S):\n  0day Inc. <support@0dayinc.com>\n"
end

.decode(opts = {}) ⇒ Object

Supported Method Parameters

PWN::SDR::Decoder::APT.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' )



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/pwn/sdr/decoder/apt.rb', line 103

public_class_method def self.decode(opts = {})
  freq_obj = opts[:freq_obj]
  want_iq = opts[:source] || opts[:file] || freq_obj[:iq_source] || freq_obj[:iq_file]
  if want_iq
    PWN::SDR::Decoder::Base.run_iq(
      freq_obj: freq_obj,
      protocol: 'NOAA-APT',
      demod: Demod.new(out_path: opts[:out_path]),
      sample_rate: (opts[:sample_rate] || freq_obj[:iq_rate] || 48_000).to_i,
      source: opts[:source],
      file: opts[:file],
      fm_demod: true,
      note: 'NOAA APT true-air: FM-demod I/Q then 2400 Hz AM envelope → PGM.'
    )
  else
    PWN::SDR::Decoder::Base.run_native(
      freq_obj: freq_obj,
      protocol: 'NOAA-APT',
      demod: Demod.new(out_path: opts[:out_path])
    )
  end
end

.helpObject

Display Usage for this Module



134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/pwn/sdr/decoder/apt.rb', line 134

public_class_method def self.help
  puts "USAGE (ruby-native, no external binaries):
    #{self}.decode(
      freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq'
    )

    NOTE: Set GQRX to WFM (mono), ~34 kHz filter. Writes an 8-bit
          greyscale Netpbm P5 image to /tmp/apt_<ts>.pgm every 10 s
          of received pass. Both A/B channels are in one strip.

    #{self}.authors
  "
end