A python/micropython based library for encoding and modulating WSPR packets in AFSK audio.
The purpose of this library is to enabe WSPR encoding and audio modulation from PC to microcontroller while maintaining portability and readability of python. This library is optimized for embedded systems, especially micropython supported targets and platforms and small computers, not to mention Cpython and Pypy!
In practice this means we:
- Avoid floating point and math libraries and dependencies in critical sections.
- 👍 Integer math only
- 👍 NO external libraries (numpy/scipy/pandas).
- Special care for memory allocation
- 👍 Pre-computing buffer/array sizes and modifying in place
- 👎 Dynamically appending items to a list
- Single threaded, multitask friendly
- 👍👍 Asyncio
- Micropython unix build instructions, and encode/decode examples via cli.
- TinyS3, ESP32S3 build isntructions on the TinyS3 (ESP32-S3).
- TinyC6, ESP32C6 build isntructions on the TinyC6 (ESP32-C6).
From the micro-wspr/src folder, try
echo "KI5TOF FN42 37" | python wspr_mod.py -v -t null -t -
# WSPR MOD
# IN -
# OUT null
===== WSPR ENCODE >>>>> KI5TOF FN42 37
3 1 0 0 0 0 0 0 3 2 0 0 3 3 1 2 0 0
3 0 2 3 2 3 3 1 1 2 0 2 2 0 2 0 3 2
0 1 2 3 0 0 2 0 2 0 1 2 3 1 0 2 3 1
2 1 2 0 2 1 1 2 1 2 0 2 0 3 1 0 1 0
3 0 3 2 3 2 2 1 0 0 1 2 3 1 0 0 2 1
3 2 1 0 3 2 2 0 1 0 2 0 2 0 3 2 0 3
0 0 3 1 1 0 3 3 0 2 1 1 2 3 2 2 2 1
3 3 2 0 2 0 0 1 0 3 0 0 3 3 0 2 0 2
0 0 2 3 3 0 3 2 1 1 2 0 2 3 3 2 0 0
Thank you to wspr-cui for documenting wsprd requires the wav file to have the following properties.
- WAV header (first 22 bytes) are ignored
- Format: fixed to S16_LE, 12000Hz, monaural (1 channel)
- Length: 114 seconds (see
readwavfile()in wsprd.c)
echo "KI5TOF FN42 37" | python wspr_mod.py -r 12000 | sox -t raw -b 16 -e signed-integer -c 1 -v 1.0 -r 12000 - -t wav test.wav
wsprd test.wav
test 9 0.0 0.001498 0 KI5TOF FN42 37
test 40 -0.0 0.001502 0 KI5TOF FN42 37
test -21 -0.4 0.001572 0 KI5TOF FN42 37
<DecodeFinished>
Unlike the wsprd version, we'll generate a higher quality and more typical wave files sampled at 22050. This file will not properly be decoded by wsprd!
echo "KI5TOF FN42 37" | python wspr_mod.py -r 22050 | sox -t raw -b 16 -e signed-integer -c 1 -v 1.0 -r 22050 - -t wav test.wav
- Micropython project
- WSPR protocol documentation by Andy Talbot (G4JNT)
- WSPR 2.0 User’s Guide Very good WSPR Protocol dscription in Appendix.
- WsprSharp a C# WSPR implmentation
- WSPR Code Generator online code generator based on WsprSharp
- FSKview spectrogram for viewing frequency-shift keyed (FSK) signals in real time
- genwspr.py Python 2 WSPR encoder by Mark VandeWettering K6HX.
- genwsprcode.py Converted genwspr to python3.
- Raspberry Pi version
- wspr-cui Wspr code
MIT License