RPITX interface to SVXlink using GNUradio

Uit Projectgroep .540
Ga naar: navigatie, zoeken

Interface RPITX to SVXlink.

Rpitx-plaatje.jpg

Inspired from the setup of the Spotnik made by F5NLG and the Reflector technique from SVXlink and the French reflector network hereby the description of the experimental interface between RPITX from F5OEO and SVXlink using GNUradio. The GNUradio flowchart was made with examples from these application notes . SVXlink have UDP input and output possibilities and these are used to input/output to GNUradio blocks. Setup I use is RX on 433.540 Mhz and TX is on 438.775 Mhz. I use a Wouxun transceiver ( dual band ) to communicate. TX is set to 433.540 and receive is set to 438.775 in the 70cm amateur band.

Picture test setup show green case contain 7inch touch screen, inside the blue case is Raspberry PI3 B+, extension cable to RTL dongle and small brown cable connected to PIN7 as transmit antenna


Equipment used : As SBC I use the RPI model 3B+ (with Rasbian Stretch) and as receiver I use the RTL dongle V3 from RTL-SDR.com No other hardware is required.

Functional Description : The receiver side is all handled by allready existing functionality in SVXLink using Ddr receiver. All configuration is well documented in svxlink.conf. The transmitter part interface is made out of 3 components. The audio coming from SVXlink TX1 is routed via UDP port 1235 to GNUradio, the PTT is routed to PseudoTTY port /home/pi/ptt and the TCP output port 8011 of GNUradio IQ stream is routed to RPITX. When SVXlink wants to transmit it sends a charackter T to the PseudoTTY device ( PTT ON ), a perl script which is started after the start of SVXlink will monitor this PseudoTTY and once it will see the character T it will execute other script starting first RPITX snd then Python GNUradio script. This will switch on the transmitter and audio is routed to RPITX. When SVXlink need to stop transmitting then the character R is send by SVXlink to the PseudoTTY and received by the script monitoring the PTY. It will kill RPITX and Python GNUradio script. As it takes a bit of time to start RPITX ( initializing the PLL ) and starting the TCP listener and starting Python some extra delay is given to SVXLink in the configuration.

Questions ?: please mail to pe2jko@pg540.org

Scripts and schematic GNUradio flowchart :

Rpitx grc.JPG



Perl Script which listen on the PTY port from TX1


#!/usr/bin/perl
#
# @file    nhrcx.pl
# @brief   Perl-script to link a NHRCx controller to SvxLink over
#          Linux pseudo tty's
# @author  Adi Bier / DL1HRC
# @date    2014-05-01
#
# Run this script after starting SvxLink. Do not configure the
# links in the /dev directory.
#
# SvxLink - A Multi Purpose Voice Services System for Ham Radio Use
# Copyright (C) 2004-2014  Tobias Blomberg / SM0SVX
# Adjusted PE2JKO to control RPITX

use Time::HiRes qw(usleep);
#use Device::SerialPort;
use IO::File;

$ptt_port   = "/home/pi/ptt";
$logfile    = "/tmp/nhrc-x.log";
$DEBUG      = 1;


$PTT = openPtty("$ptt_port"); #  ptt port from SvxLink

while (1) {

  $PTT->read($p, 1);
  if ($p gt ' ') {
    $message = $p;
    if ($p ne 'T') {
      system("/home/pi/rpitx/stop_tx.sh");
      &writelog("UIT");
    }

    if ($p ne 'R') {
      system("/home/pi/rpitx/start_tx.sh");
      &writelog("AAN");
    }

    &writelog("PTT-command: $p");
    undef $p;
  }

  usleep(10000);
}
close($PTT);
exit;

sub openPtty {
  my $fh = IO::File->new($_[0], O_NONBLOCK|O_RDWR);
  if (!(defined $fh)) {
    &writelog("Can not open $_[0]");
    print "Can not open $_[0]\n";
    return 0;
  }
  $fh->autoflush(1);
  &writelog("opening $_[0] OK");
  return $fh;
}

sub writelog {
  if ($DEBUG) {
    open(LOG,">>$logfile");
      print LOG $_[0],"\n";
    close(LOG);
  }
}



The startup script starts first svxlink, this opens the PTY port and then the perl script which monitor the charakters (T and R)


#!/bin/sh

echo "start"
/home/pi/reflector/src/build/bin/svxlink &
sleep 1
/home/pi/ptt.pl &
exit


Script start_tx.sh will be called when ptt.pl detect that PTT should be switched on


#!/bin/sh

echo test
nc -l 8011 | sudo /home/pi/rpitx/rpitx -i- -m IQFLOAT -f 438775 &
python /home/pi/rpitx_interface.py &
exit

Stop_tx.sh script called when SVXlink want to stop sending, so I kill processes


#!/bin/sh

echo "stop"
sudo killall nc python rpitx
exit 0


SVXlink configuration changes are :

In [RX1] of svxlink.conf configure TYPE=Ddr, SIGLEV_DET=DDR, SIGLEV_DET=2.61, SIGLEV_OFFSET=150, FQ=433540000, WBRX=WbRX1

In [WbRX1] put TYPE=RtlUSB, DEV_MATCH=0, HOST=localhost, PORT=1234, CENTER_FQ=433540000, GAIN=3.7,PEAK_METER=1, SAMPLE_RATE=960000

In [TX1] put TYPE=LOCAL, AUDIO_DEV=udp:127.0.0.1:1235, AUDO_CHANNEL=0, PTT_TYPE=PTY, PTT_PTY=/home/pi/ptt


These are the most important and relevant settings which need to be set.