13 WSPR Message Coding
Sebastian edited this page 2021-05-08 17:41:53 +00:00

Message types

Reverse engineered from the original wqdecode fortran routine.

With msg as the 50 message bits, msg_type = (msg % 128) - 64 and nu = msg_type % 10:

  1. msg_type > 0 && (nu == 0 || nu == 3 || nu == 7)
    • Standard message.
    • 6 Character call
    • 4 Character Locator
    • power is msg_type
  2. msg_type > 0 && !(nu == 0 || nu == 3 || nu == 7)
    • Message with a prefixed call sign
    • No locator
    • Power is msg_type - (if nu > 7 { nu - 7 } else if nu > 3 { nu - 3 } else { nu })
  3. msg_type < 0
    • Message with a 15bit hash call sign
    • 6 Character locator
    • Power is -msg_type - 1

Three common use cases:

  1. Only Standard messages. Easy to implement. Call sign, rough locator (worst case about 50km off), power, all neatly packed into one message.
  2. Alternating between standard messages and messages with extended locators. Usually used to give a more precise position e.g. for moving mobile stations.
  3. Alternating between message with prefixed call signs and messages with extended locators. If you have to use prefix, this is the only way to transmit your full call sign and a locator. The prefix will also be part of the hash so your messages can be matched.

Standard Message

Explained quite well in The WSPR Coding Process by G4JNT.

Basically a large 50bit number with differntly weightened digits.

Data Possible Values Weight Comment
Call letter/digit 0 37 36 * 10 * 27 * 27 * 27 * 2^22 Digit, Letter or space
Call letter/digit 1 36 10 * 27 * 27 * 27 * 2^22 Digit or letter
Call digit 2 10 27 * 27 * 27 * 2^22 Has to be a digit
Call letter 3 27 27 * 27 * 2^22 Letter or space
Call letter 4 27 27 * 2^22 Letter or space
Call letter 5 27 2^22 Letter or space
Locator latitude 180 180 * 128 Lattidue from locator 0-179 in 1° steps
Locator longitude 180 128 Longitude from locator 0-358 in 2° steps
Power and Type 128 1 Tranmission power and message type

There is discontinuity between the last position of the call sign an the locator because the original WSPR code seems to be intended for 32bit machines. All possible callsign representations fit into 28bit, but neither the locator nor the power fits easily in the reamining 4bit. Therefore they had to be assembled in in a different 32bit word. There are 128*180*180 = 4147200 possible combinations of locators and power, which is close enough to 2^22 = 4194304, to waste a few values by aussiming the callsign is shifted by 22bit, when combining the values.

Prefixed Callsign Message

TODO

Exetended Locator Message

Hash function use for the call sign is hashlittle from lookup3.c one of the Jenkins hash functions. The hash function is applied to the complete call sign including any prefix or suffix.