# VP-Digi: cheap and functional open-source APRS digipeater controller with KISS modem

VP-Digi:
VP-Digi is a very cheap, functional, easy to assemble and run, APRS digipeater controller, which can work also as a KISS modem or a frame monitor. Now VP-Digi is an open-source project!

The device is based on a popular „Blue Pill” board with STM32F103C8T6 microcontroller. This board can easily be found on websites like Ebay, Aliexpress etc. at the price of about 4$. VP-Digi requires only a few typical external components to operate. Thanks to the use of STM32 processor, the VP-Digi can offer many more capabilites than similar devices based on Arduino, at a very similar costs. VP-Digi offers 8 configurable beacons and an APRS digipeater, which is capable of handling 4 type n-N aliases (e. g. WIDEn-N, NYn-N) and 4 simple aliases (e. g. CITY, AREA). Moreover, the digipeater incorporates the viscous delay function know from aprx, which can reduce unnecessary traffic. There is also a posibility to filter packets by sender callsign, either in blacklist or whitelist mode. The digipeater can be freely configured, e. g. to work as regional (Wn) or fill-in (W1) digi. The device is equipped with an USB port and two UART ports. All of them can work independently in KISS TNC, frame monitor or configuration mode. The configuration is done by simple commands using any terminal program and is stored in the embedded flash memory. VP-Digi incorporates a very effective 1200 Bd (AFSK Bell 202) DSP-based modem, which decodes about 980 frames from WA8LMF CD Track 2. Additionally, a digital carrier detection (DCD) is implemented. It uses an approach of looking for correct modulated signal rather than checking demodulated data. This algorithm provides much better results, is more sensitive, but at the same time is more immune to noise. That’s way VP-Digi works very well with devices with open squelch. Rzeszow’s regional digi SR8NDR is based on the same hardware. The effects of its work can be seen here. Assembly: The device can generate signal using either a R2R ladder or a PWM technique. There are some typical external components needed. The schematic for both versions, including component values, can be found here. Whole device can be built on small 5x7cm universal PCB. There are two potentiometers to give a possibility to adjust TX and RX signal levels. If the RX signal level can be adjusted directly in a transceiver, VP-Digi’s RX signal level adjustment part can be ommited by not mouting respectively RV2, R15 and C4 or RV4, R24 and C10. If the transceiver requires PTT to be keyed through a mic line, the 2.2k resistor (R12 or R16 respectively) should be put across the PTT output and the signal output. It’s also important not to forget about the 22k resistor or similar (R13 or R22) to protect the ADC input from being accidentaly damaged. Coupling capacitors C1, C3, C4 or C5, C9, C10 might (and even should) have higher capacitance, but not lower than 100 nF. R2R ladder resistors (R1, R2, R3, R4, R5, R6, R7, R8) values also can be changed, but they must be kept at 2:1 proportions. These resistors should not have lower values than in the schematic. Q1 or Q2 transistor can be any NPN type transistor (BC547, 2N2222 etc.). The board must be powered from USB or an external 5V or 3.3V supply (connecting it to the corresponding pin). It’s recommended to use a well filtered power source. Firmware: The firmware (HEX file) is available here. To program the MCU a ST-Link programmer or an USB-UART adapter is needed (both cost about 2$ each on Aliexpress).

Download and install ST-Link Utility and neccesary drivers. Connect VP-Digi to the programmer, then the programmer to the PC. In ST-Link Utility selected File->Open file and select the downloaded HEX firmware. Then go to Target->Program and verify and click Start. After a few seconds the device will reboot and the VP-Digi firmware will start.

Make sure your adapter provides 0-3.3V voltage levels. If neccesary, install required drivers for the adapter. Download and install Flasher-STM32. On the board set the jumper closer to the reset button to position 0, and the other jumper to 1. Connect adapter’s TX pin to PA10, RX pin to PA9 and then power everything up.
Check the COM port number of your adapter in the Device Manager. Then start STM32 Flasher, select COM port and click Next. If an error appeard check all connections and jumpers and reset the device. On the next screen click Next. Select Download to device option and select the HEX file. Also tick Errase neccesary pages and Verify after download and click Next. After a few seconds VP-Digi should be programmed. Set both jumpers to 0 position and reset the board.

Setup:
VP-Digi always starts USB, UART1 and UART2 in KISS mode, where serial ports work at 9600 Bd by default. There the device can be used as a standard KISS modem. To configure VP-Digi some terminal program is needed (like TeraTerm). To switch to a configuration mode, type config and press Enter. In KISS mode the remote echo is disabled, so you won’t see what you type. After entering configuration or monitor mode the remote echo is enabled.

Available USB and serial port modes:
– KISS – default mode where all received frames are sent through the port and all frames received from the PC are transmitted. This mode can be used with softwares like UI-View32. To enter this mode, use kiss command.
– monitor – in this mode all received and transmitted frames are shown in the user-friendly format. There you can see the RX signal level and run a test transmission for TX level adjustment. To enter this mode, use monitor command.
– config – in this mode you can check current settings and apply new. To enter this mode, use config command.

There can be different modes active on different ports at the same time. Other functionalities (beaconing, digipeater etc.) are independent from the currently selected modes.

Interfacing with radio is simple. First, disconnect power. Connect GND to GND, transceiver’s audio output to SIG_IN and transceiver’s input to SIG_OUT. Also connect PTT to PTT input if neccesary. Then apply power again.

Remember, that the device operates on 0 to 3.3V voltage levels.

Basic configuration:
First, open the terminal and switch to monitor mode, then wait for some RF traffic. There is signal level shown for every received frame. Set the input audio level for the most stations to be at 50-70%. If that’s not possible, adjust the level for all stations to be between 10 and 100%.

It’s important to set output signal level properly. This stage is often done very inaccurately and incorrectly. We need some additional receiver tuned to the same frequency as the transmitter. In monitor mode enter cal high command (2200Hz tone will be transmitted) and adjust the output signal level slowly, starting from the position where signal is inaudible in the receiver. Listen to the received signal carefully and monitor its strength. The amplitude should rise, but after some point there will be no further increase in strength. Stop at this point and turn the potentiometer the other way just a little (to sligthly decrease the signal amplitude). Enter cal stop command. Now you have your APRS signal level as it should be.

Further configuration and commands:
To use VP-Digi as a digipeater you must configure it in the config mode. When you are done, remember to save everything using save command.

call SP8ABC – sets the callsign. A-Z, 0-9, 6 characters max.
ssid 4 – sets the SSID: 0-15
txdelay 300 – sets preamble length in ms: 30-2550
txtail 20 – sets tail length in ms: 10-2550
quiet 300 – sets quiet time (before TX) in ms: 100-2550
rs1baud 57600 – sets UART1 baudrate: 1200-115200
rs2baud 57600 – sets UART2 baudrate: 1200-115200
pwm on – sets DAC type: on for PWM, off for R2R
flat on – configure modem for radios with flat audio output (on) or normal output (off)
beacon 0 on – on enables, off disables selected (0-7) beacon
beacon 0 iv 10 – sets interval between selected (0-7) beacon in minutes
beacon 0 dl 10 – sets delay for transmitting selected (0-7) beacon
beacon 0 path WIDE1-1,WIDE2-2 – set path for selected (0-7) beacon: 1 element (like WIDE1-1), 2 elements (like WIDE1-1,WIDE2-2) or none for no path
beacon 0 data >Test – sets information field for selected (0-7) beacon
digi on – on to enable digipeater, off to disable
digi 0 on – on enables, off disables selected (0-7) digi alias
digi 0 alias WIDE – sets alias for the selected (0-7) slot. For 0-3 n-N slots up to 5 characters, for 4-7 simple slots up to 6 characters + SSID (e. g. LONDON-5)
digi <slot> max <n> – sets maximum n for normal digipeating of n-N aliases (slot 0-3)
digi <slot> rep <n> – sets minimum n for digipeating n-N (slot 0-3) aliases as simple aliases. 0 disables this functionality
digi 0 trac on – sets selected (0-7) alias as traced (on) or untraced (off)
digi 0 viscous on – on enables, off disables viscous delay mode for selected (0-7 alias)
digi 0 direct on – on enables, off disables direct-only mode for selected (0-7 alias)
digi 0 filter on – on enables, off disables filtering frames for selected (0-7) alias
digi filter black – sets filter list type to whitelist (white) or blacklist (black)
digi dupe 30 – sets duplicate protection buffer hold time in secs: 5-255
digi list 0 set SQ8VPS-* – inserts callsign to a selected (0-19) position in filter list. * wildcard might be used to mask all characters to the end, ? to mask single character. * or ? work the same in SSID
digi list 0 remove – removes callsign from a selected (0-19) position in filter list
autoreset 24 – sets interval for automatic device reset in hours: 0-255. 0 disables
monkiss on – on enables, off disables sending own and digipeated frames to KISS ports
list – shows full callsign filter list
print – shows current configuration
save – saves current configuration to flash memory and resets the device. Remember to always use this command
eraseall – erases all saved configuration and resets the device
help – shows short version of command descriptions
reboot – reboots the device
version – shows version info
monitor – switches to monitor mode
kiss – switches to KISS mode

In monitor mode following commands are available:
help – show short version of command descriptions
reboot – reboots the device
version – shows version info
config – switches to config mode
kiss – switches to KISS mode
beacon 0 – immediately transmits selected (0-7) beacon
cal low/high/alt/stop – low starts transmitting 1200 Hz tone, high – 2200 Hz, alt – alternating tones, stop stops

How the digipeater works here? What are max and rep?
The digipeating algorithm in VP-Digi is quite non-standard and may be not very clear to understand.
Have a look at a WIDEn-N path. If the n number in a received frame is less or equal to max value, the frame will be digipeated normally: e.g. SQ8L>APRS,WIDE2-2, when max=2, will be digipeated as SQ8L->APRS,SR8NDR*,WIDE2-1, exactly as n-N paradigm says. If the number n is greater than max, then this part of the algorithm will do nothing. But here comes the rep value.
If the n number in a WIDEn-N path is greater than rep value, this element will be replaced by the digipeater’s callsign (like digipeating a simple alias): e.g. SQ8L>APRS,WIDE3-3, when rep=3, will be digipeated as SQ8L>APRS,SR8NDR*.
The most natural setting is that rep=max+1, e. g. max=2 and rep=3. In this case, frames with WIDE2-N path or shorter will be digipeated normally, while frames with WIDE3-N path or longer will be digipeated as a simple aliased. There is also a possibility to leave a „hole”, where the digipeater won’t process any frame, e.g. for max=2 and rep=5. Frames with WIDE2-N path or shorter will be digipeated normally, WIDE3-N and WIDE4-N won’t be processed at all, and WIDE5-N and longer will be digipeated as simple aliased.
The rep value purpose is to decrease the unneccesary traffic caused by long paths. This can be disabled by setting rep value to 0.
Normally, rep>max, but in case of an inappropriate configuration (max>=rep) normal n-N digipeating has higher priority (max value is more significant).

Beacon:
Example for beacon number 0. Available beacon numbers are 0 to 7.

1. „beacon 0 data !5002.63N/02157.91E#Digi Rzeszow” – set beacon data in APRS standards
2. „beacon 0 path WIDE2-2,SP2-2” – set path (1 or 2 comma-separated elements or none)
3. „beacon 0 iv 15” – beacon every 15 minutes
4. „beacon 0 dl 5” – send beacon for the first time 5 minutes after device boot
5. „beacon 0 on” – enable beacon

WIDE1-1 digi (fill-in):
Example for slot number 0. Available slot numbers are 0 to 7.

1. „digi 0 alias WIDE” – digipeating of WIDEn-N type aliases. n and N numbers are NOT set here,
2. „digi 0 max 1” – allow paths up to WIDE1-1
3. „digi 0 rep 0” – no path replacement
4. „digi 0 trac on” – WIDEn-N path is traceable (digipeater callsign should be put into the path)
5. „digi 0 on” – enable specified slot
6. „digi on” – enable digipeater

Viscous-delay digipeater (recommended configuration):
Example for slot number 0. Available slot numbers are 0 to 7.

1. „digi 0 alias WIDE” – digipeating of WIDEn-N type aliases. n and N numbers are NOT set here,
2. „digi 0 max 2” – allow paths up to WIDE2-2
3. „digi 0 rep 3” – WIDE3-3 and longer paths will be simplified
4. „digi 0 trac on” – WIDEn-N path is traceable (digipeater callsign should be put into the path)
5. „digi 0 viscous on” – enable viscous delay mode
6. „digi 0 on” – enable specified slot
7. „digi on” – enable digipeater

Regional digipeater WIDEn-N + CTn-N (recommended configuration):
Example for slots number 0 (for WIDE) and 1 (for CT)

1. „digi 0 alias WIDE” – digipeating of WIDEn-N type aliases. n and N numbers are NOT set here,
2. „digi 0 max 2” – allow paths up to WIDE2-2
3. „digi 0 rep 3” – WIDE3-3 and longer paths will be simplified
4. „digi 0 trac on” – WIDEn-N path is traceable (digipeater callsign should be put into the path)
5. „digi 0 on” – enable specified slot
6. „digi 1 alias SP” – digipeating of CTn-N (where CT is a country/state/region alias, e. g. SP in Poland, HU in Hungary, NY in New York) type aliases. n and N numbers are NOT set here,
7. „digi 1 max 7” – allow paths up to CT7-7
8. „digi 1 rep 0” – no need to limit regional aliases (as they are geographically limited)
9. „digi 1 trac off” – CTn-N path is (usually) not traceable (digipeater callsign should not be put into the path)
10. „digi 1 on” – enable specified slot
11. „digi on” – enable digipeater

Known bugs:
– the device sometimes digipeats the same frame twice (when received twice – for example when digipeated by two different digipeaters). I don’t see anything wrong in my code – maybe some digis change some bits in a frame and it causes VP-Digi to „think” that these two frames are different.

Changelog:
Changelog is available here and will be updated only there.
v. 1.2.0 – 10 September 2021 – source code is available. Code partially rewritten. Viscous delay and direct-only modes enabled for each alias separately. Special mode for radios with flat audio output. Erase configuration command.
v. 1.1.2 – 27 October 2020 – schematic fix, RX diode output moved from PB3 to PB5 (hardware and firmware changes) – thank Alfredo, IZ7BOJ for spotting these errors
v. 1.1.1 – 10 September 2020 – bug fix (4-7 digi aliases configurations were displayed incorrectly)
v. 1.1.0 – 02 August 2020 – external TX and RX LEDs, small internal modem configuration changes
v. 1.0.0 – 01 August 2020 – inital release