Digimodes - df8oe/UHSDR GitHub Wiki

The UHSDR software supports four digimodes (FreeDV, RTTY, BPSK, and CW) at the moment.

Common for all digital modes (except for CW decoding, see below):

  • Once only: enable "Digital Modes" in Standard Menu
  • With touchscreen
    • touch on blue box "DIGITAL" --> changes to orange and displays the digital mode
    • to switch to other digital modes touch box again
  • With menu (no touchscreen)
    • Go to "Touch via menu" Menu
    • Select desired "Digital Mode"
    • Leave menu mode
    • The blue box should show the desired digital mode.
    • Now switch to digital mode using the Mode button (G1). The blue box switches to orange and digital mode is active.

To TX in PSK, RTTY and CW the next methods are available.

Using CW Keyer Input

  • Switch CW Keyer Mode (CW menu) to "Iambic" or "Ultimate". Please note, an external Iambic or Ultimate keyer connected via the CW Keyer Mode "Straight" does not work.
  • Set CW TX RX delay (CW menu) high enough so that RTTY keeps transmitting between your morse letters
  • As soon as you start using the keyer, your decoded morse code will be sent out as RTTY, BPSK or CW (or idle is sent). As long as a character was transmitted it appears on the screen. (Future plans to make distinguishable the text entered to buffer and text which already transmitted).

Using USB Keyboard Input

Simple TX via USB Keyboard now possible in all digi modes (except FreeDV), most but not all USB keyboards work. Keyboard layout is QWERTY, no matter what the keyboard says. The recommended way to connect a keyboard is when TRX is OFF. Sometimes working keyboards are not identified when plugged in "hot"!

USB Keyboard Key Function
F1 Switch to TX
F2 Switch to RX
F5 Append text in Macro 1 to transmit buffer
F6 Append text in Macro 2 to transmit buffer
F7 Append text in Macro 3 to transmit buffer
F8 Toggle macro keyer mode on/off
F5 + Left Shift Start recording Macro 1
F6 + Left Shift Start recording Macro 2
F7 + Left Shift Start recording Macro 3
F8 + Left Shift Toggle between unbuffered and buffered transmit
ESC Clear transmit buffer
Backspace Clear text line on screen
Printable character Put character in transmit buffer. Not all characters can be transmitted
Enter Add new line / linebreak
Other special keys No function
How to use the keyboard
  • Select desired digital mode (PSK, RTTY or CW)
  • Hit F1 on keyboard to start TX (or press PTT).
  • In CW pressing F1 not necessary.
  • Enter text, the text is immediately sent out, as long it has transmitted, it appears on the screen. (Read future plans below)
  • Hit F2 on keyboard to stop TX (or press Tune twice, or F5 on UI "TXRX U")
  • You can also enter text before you press F1 (working not in all modes for now, and text is not visible - future plans to fix it), it is stored and sent when you start TX
  • Stored macros F1-F3 can be played in all digi modes by pressing F5-F7 on the USB keyboard
  • The buffer populated by macro F1-F3 or from the keyboard can be cleaned by pressing ESC on the keyboard
  • Text line on the screen can be cleared by pressing "Backspace" on the keyboard

Implemented modes:

FreeDV (Rx & Tx)

How to operate

  • select digital mode "FREEDV" as described above
  • press PTT

Theory

FreeDV is a digital voice mode designed for reception and transmission of voice on the HF bands. It uses a low bitrate voice coder-decoder (Codec 2) which is in the public domain (licensed under the GNU GPL). Decoding voice is possible down to signal-noise-ratios of 4dB. We are grateful to David Rowe for writing the source code and putting it into the public domain and also for answering questions and helping with design decisions for implementation of FreeDV into the UHSDR software. More details here: http://freedv.org/tiki-index.php?page=FreeDV+Specification

RTTY (RX & TX)

How to operate

  • select digital mode "RTTY" as described above
  • set AGC speed to very long (very slow) or (best) switch it off completely
  • change mode to RT-L (LSB aka normal polarity, Mark is the high RF frequency) or RT-U (USB aka reverse polarity, Mark is the lower RF frequency) according to desired RTTY mode
  • use filter bandwidth 1.4k BPF --> do not try to use a very narrow bandwidth, this does not help the decoder, maybe it helps your ears, but the decoder needs relatively wide bandwidth to avoid distortion decoder errors
  • with button M1 change orange focus to box BD
  • with encoder 1 adjust baud rate (BD)
  • with button M2 change orange focus to box SFT
  • with encoder 2 adjust shift (SFT)
  • adjust frequency until mark and space frequencies are accurately aligned with the vertical markers
  • if vertical markers are invisible, change their colour in Display Menu --> TX Carrier Colour
  • enjoy RTTY being decoded and displayed as running text

For transmitting, connect a USB keyboard, see above for details. Optionally you may use the macro buffers (USB Keyboard or CW input), see below for instructions.

Ham RTTY:

  • RTTY LSB mode = RT-L
  • shift 170 Hz
  • 45.45 bauds
  • signals at 915 and 1085 Hz

Shipping RTTY broadcast (marine weather, warnings etc.) of the Deutscher Wetterdienst DWD:

  • RTTY USB mode = RT-U
  • shift 450 Hz
  • 50 bauds
  • signals at 915 and 1365 Hz
  • try 4581.865 kHz, 7644.860 kHz, 10099.660 kHz, 11037.860 kHz or 14466.160 kHz

Theory

RTTY is a simple FSK (frequency shift keying) mode which transmits digital data at relatively low speeds without error correction. We use a simple but apparently quite well working decoder based on a DSP tutorial written by Norbert, HA2NON, adapted and extended for use in the UHSDR firmware. The demodulator filters both frequencies and passes the energy difference through a simple 50Hz filter. The resulting signal is passed to a digital PLL which handles the bit decoding timing and a symbol decoder which then decodes the bitstream into RTTY characters.

A nice example for a digital mode which existed for a long, long time.

Details of the RTTY demodulation chain:

  • filter the incoming audio baseband signal with two 2nd order IIR bandpass filters. The bandpass frequency for mark and space are adjusted according to the shift used for the specified RTTY mode
  • the result is two narrowband signals which are now separately multiplied to calculate the magnitude squared: mark * mark and space * space
  • calculate the envelope of the two signals by an exponential averager with fast attack and slow decay
  • calculate the noise floor level by an exponential averager with fast attack and even slower decay
  • "clip" by taking the smaller of the two: magnitude or envelope
  • this is the "Optimal ATC" - algorithm by W7AY also implemented in FlDigi. It copes quite well with selective fading and QRM: v1 = (mclipped - noise_floor) * (mark_env - noise_floor) - (sclipped - noise_floor) * (space_env - noise_floor) - 0.25 * ((mark_env - noise_floor) * (mark_env - noise_floor) - (space_env - noise_floor) * (space_env - noise_floor));
  • lowpass filter v1 with IIR filter with cutoff-frequency equal to the baud rate
  • slicing: is v1 <0 --> bit is 0, if v1 > 0 --> bit is 1
  • digital PLL: bit decoding timing
  • symbol decoder translates bit stream into characters
  • send character to print routine

CW Decoder

We know that experienced CW operators do not need this feature (and will probably also never use it ;-)), but it could be useful for beginners in CW or for refreshing your CW knowledge, or (we hope so!) could even motivate hams to learn CW from scratch!

The decoder code has been adapted from Lofturs´ implementation of an algorithm designed by Guenther (1973) (for military use on a "modern" microcomputer (modern in the seventies!), see reference below). Thanks, Loftur, for putting your code under the GNU GPL license!

Please note that the CW decoder is definitely not better than your ear-brain interface. This is also expressed by the huge amount of scientific effort still recently put into developing new algorithms to decode CW (eg. Zhang et al. 2006, Wu et al. 2010, Wang et al. 2016 and the "Machine Learning Challenge" in 2014: http://ag1le.blogspot.de/2014/09/morse-learning-machine-challenge.html).

So, for the moment, there seems to be no better CW decoder available than your ears and brain working together (which is somehow appeasing and alarming at the same time ;-)). Or your eyes and brain when using QRSS CW modulation.

Adjustments

Use a slow or very slow AGC or no AGC in your audio path. Make sure you have tuned to the CW station properly assuring that the audio pitch of the station matches your sidetone frequency (because the CW decoder only "hears" CW signals which are on the pitch of your selected sidetone frequency).

CW decoder enable - ON/OFF

  • Switches the CW decoder ON or OFF. This is possible in every mode, the decoder works on basis of the audio signal. Honestly, this is only useful, if you have a narrow filter and a one sideband mode, eg. 300Hz/700Hz in LSB or CW-L. Do not combine this with RTTY demodulation mode, this will produce garbage ;-)

Signal threshold:

  • Adjust this threshold while checking the red LED until the red LED is modulated with the rhythm of the CW signal you are listening to. This adjustment is dependent on the signal strength of your CW station and band and antenna noise. So you would likely have to adjust this threshold when changing bands, antennas, or frequency. ATTENTION: the audio signal has to match the pitch of your CW sidetone.

Blocksize

  • in order to be able to filter out and determine the real time signal strength of the CW impulses, we use the Goertzel algorithm. Similar to an FFT, we need a certain no. of samples and calculate the magnitude from the sample levels. The number of samples used for one signal magnitude value is called "Blocksize". Blocksize can be changed from 8 to 128 in steps of 8 samples.

Noise cancel ON/OFF

  • a special noise canceling algorithm for the decoder.

Spike cancel OFF/SPIKE/SHORT

  • yet another spike cancelling algorithm, which helps the decoder to ignore short noise impulses. Has three options: OFF/SPIKE cancelling/SHORT spikes cancelling

Use 3 Goertzels

  • may come in the future, there is nothing to choose here yet

Theory

The decoder works as follows (see Guenther 1973 for details):

  • collect a block of samples (with size "Blocksize")
  • calculate one "optimized Goertzel" magnitude value from this block of samples [Goertzel algorithm works like an FFT, giving you the magnitude of a signal for a given frequency --> the CW sidetone frequency you are listening to]
  • lowpass filter the magnitude values ("averager")
  • automatic gain control for these values ("AGC")
  • determine whether we have a pulse or a space by comparing the magnitude level to a "threshold"
  • noise canceling: determine whether two consecutive magnitude values are the "same" (pulse/space) and accepting only when this is true
  • light the red LED when we have a pulse
  • shut off the red LED when we have a space
  • the pulses and spaces and the time length of these pulses and spaces are stored in a ring buffer
  • the ring buffer is used to INITIALIZE the decoder: a set of equations from Guenther (1973) is used to determine the speed (WPM) of the received CW message, i.e. the length of dots, dashes and inter-character and inter-word spaces. This is the essential step for decoding the message
  • then the message stored in the ring buffer is being decoded by the DATA RECOGNITION routine using the timing information from the initialization --> this produces another data buffer with all the dits and dahs and spaces of the message
  • the dits and dahs are then interpreted in the CHARACTER IDENTIFICATION routine, where basically a look-up-table is used to interpret the dits and dahs as characters
  • the characters and the inter-character-spaces are then sent to the printer routine which prints them out on the display
  • One very important addition is an error correction routine which -in the case of a sequence of dits and dahs that can not be assigned to a character in the look-up-table- tries out several possibilities to eliminate single dots in order to finally match the dit/dah sequence to existing characters in the look out table. Also the error correction tries to correct too short character spaces
  • So, we are finally there: a sequence of characters and spaces which hopefully matches the transmitted CW message to a certain extent

Please note that still -in 2017!- there is no algorithm which performs better on decoding of CW signals than the human ear/brain of trained CW experts! Even highly sophisticated machine learning algorithms do not perform better than experienced CW operators.

PSK

The mode is usable in both directions (though rx could be improved). See discussion under #1002 and add any opinions or useful links there.

PSK demodulation works as follows:

  • switch demodulation mode to PSK-U or PSK-L depending on band and/or your personal preference
  • use a narrow filter that includes 1000Hz centre frequency (for example the 500/950Hz filter)
  • coarse tune into a PSK31, PSK63 or PSK125 transmission signal (the centre frequency is 1000Hz, which is indicated by the vertical line inside the filter passband)
  • press M3, so that orange "PSK" box becomes highlighted
  • adjust PSK mode (31, 63, 125) with encoder 3
  • fine tune with the SNAP button (only works within +-100Hz around the 1000Hz centre frequency)
  • perform further finetuning with 1Hz steps
  • you should now see the PSK transmission text decoded in the text line

PSK transmission works as follows: For transmitting, connect a USB keyboard, see instructions above. Optionally you may use the macro buffers (USB Keyboard or CW input), see below for instructions.

Or long press M1, while in CW mode record macro as described below, switch back to PSK mode and use TXRX to transmit. Long press TXRX switches from/to buffered/unbuffered mode. In buffered mode it returns to rx after finishing the message unless you keep typing. In unbuffered switch to rx manually.

Macro Keyer functionality

Macros are "prerecorded" text blocks which can be transmitted automatically in CW, RTTY and PSK modes. Macros are stored permanently when turning off the device. The macro keyer input can be from an USB keyboard or from CW paddles using any of the automatic keyer modes in the UHSDR. Input from straight CW key is not supported.

How to operate

UHSDR TRX UI Button Equivalent USB Keyboard Key Function
M1 Long Press F8 (De)-Activate Macro Keyer mode
F1 Long Press F5 + Left Shift Start recording Macro 1. [REC] shown in F1 button compartment
F2 Long Press F6 + Left Shift Start recording Macro 2. [REC] shown in F2 button compartment
F3 Long Press F7 + Left Shift Start recording Macro 3. [REC] shown in F3 button compartment
F1 Short Press F5 Play Macro 1 / Stop recording Macro 1 if recording
F2 Short Press F6 Play Macro 2 / Stop recording Macro 2 if recording
F3 Short Press F7 Play Macro 3 / Stop recording Macro 3 if recording
F5 Short Press F8 + Left Shift Switch between unbuffered [TX U] and buffer mode [TX B]. In buffer mode, transmit stops once buffer has been transmitted. TRX returns to RX
PTT / paddle F2 Stop transmission of buffer

After M1 long press, the macro keyer mode is entered (or left if active). The function of buttons F1-F5 is changed in macro keyer mode. The F1-F3 buttons become buttons to record and play back a macro (aka text to send). Long press on e.g. F1 enters recording mode - now use the iambic/ultimate keyer paddles or the USB keyboard to enter the macro. Short press on F1 while in recording saves the macro. Short press F1 will automatically send the saved macro. Touching any paddle or pressing Esc on the USB keyboard will stop sending. Label of the button changes to the first word of the macro. F4 are currently reserved for future use.

The first characters of the macro text are used to generate a label shown above the respective macro button on the TRX UI. Non-printable characters like Enter are shown as '_'. If nothing is stored in the macro, the label 'empty' is shown.

F1-F3 macros also can be played back by pressing F5-F7 on the USB keyboard.

Future improvements

  • radio stays in TX mode while sending the macro, it should return to RX between the symbols
  • only cw symbols recognized are saved and sent. Non-ascii characters are not saved
  • creating and sending actual macros not just static text
  • make distinguishable the text entered to buffer and text which already transmitted on the screen
  • add more functionality into keyboard layout such changing mode, band ...

Resources

RTTY

the source of the RTTY algorithm used HERE

Automatic threshold correction algorithm for RTTY HERE

how FlDigi does it HERE

why you need a slow or no AGC for RTTY decoding HERE

Fldigi source code: CW and RTTY decoding HERE

FREEDV

http://freedv.org/tiki-index.php

CW

Machine recognition of hand sent morse code incl. C source, by Loftur, GNU GPL3 HERE

GUENTHER, J.A. (1973): Machine recognition of hand-sent morse code suing the pdp-12 computer. - Air Force Institute of Technology Wright-Patterson Air Force Base, Ohio. HERE

Arduino morse code decoder incl. C source HERE

ZHANG, R.B., HE, L.G. & X.-Y. LI (2006): Automatic detection and recognition of Morse signal in strong noise environment. HERE

WU et al. (2010): Design and Implementation of Morse Code Recognition Based on Finite State Machines. HERE

WANG et al. (2016): An Automatic Decoding Method for Morse Signal based on Clustering Algorithm. - Advances in Intelligent Information Hiding and Multimedia Signal Processing pp 235-242. HERE

PSK31

PSK31 decoding and encoding, source code under GNU GPL HERE

⚠️ **GitHub.com Fallback** ⚠️