lunedì 18 novembre 2019

SvxLink Echolink behind natted provider


Hosting a service on your server at home can be a big problem if you have (like me) a dsl/fiber connection with a provider that NAT his network, like Fastweb,TIM and Vodafone in Italy.
You can see technical description about how they make it on wikipedia https://en.wikipedia.org/wiki/Carrier-grade_NAT.
Now, we want to run svxlink software in order to have an echolink node connected to our station.
My setup is Kenwood TS-480 + audio usb key + Tinker board ( ASUS raspberry clone ).
In a previous post you can see how I made the audio cable.
Basic setup of our single board pc should be already done, connecting it to internet through lan cable is preferred over wifi.

Now connect the usb audio key and make it the default device disabling the onboard audio.

Login as root,
edit the following files ( create it if needed )
/etc/modprobe.d/blacklist.conf
and add the line: blacklist snd_bcm2835

edit : /lib/modprobe.d/aliases.conf and comment out "snd-usb-audio index=-2"

create: /etc/modprobe.d/snd_usb_audio.conf and write “options snd_usb_audio index=0”

edit: /etc/modprobe.d/alsa-base.conf and add the following 3 lines:
options snd_usb_audio index=0
options snd_bcm2835 index=1
options snd slots=snd_usb_audio,snd_bcm2835


Then, I force the cpu governor to be in performance mode rather then ondemand
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
and add it to /etc/rc.local to preserve the setting between reboots.

Next install svxlink,
apt-get update; apt-get install svxlink-server

and configure basic features as follow,
for now I have only created an echolink node to listen only in rx.
Edit /etc/svxlink/svxlink.conf
under [SimplexLogic] section edit the lines
CALLSIGN=IU2MEH
under [Rx1] section edit the lines
TYPE=Local
AUDIO_DEV=alsa:plughw:0

under [Tx1] section edit the lines
TYPE=Local
AUDIO_DEV=alsa:plughw:0
AUDIO_CHANNEL=0
PTT_TYPE=NONE 


To know which AUDIO_DEV you have to put in config you can run "aplay -l" and you will get an output like this:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

as you see, our usb audio key is the number 0.

Next step is to configure echolink module of svxlink,
edit the file /etc/svxlink/svxlink.d/ModuleEcholink.conf
and change the lines :
CALLSIGN=MyCall-L
PASSWORD=MyPass
SYSOPNAME=MyName
LOCATION=[Svx] …


Then run svxlink as root, if it is the first time you use callsign-L you should get a message that ask you to validate the callsign, you have to visit echolink website and follow the instructions.

SvxLink uses the TCP port 5200 and UDP 5198 and 5199, these ports have to be reacheable from internet cause echolink is a p2p protocol, but if we have a natted provider this is "impossible".
To resolve this issue we can use an external server with a vpn,
in my case a VPS bought from https://contabo.com/ where we have a linux system with full access as root and the server can be reached from internet without any issue.


On the external server side install openvpn:
apt-get install openvpn (assuming that your server is debian based)

Generate certification authority and keys:
cd /etc/openvpn/easy-rsa/
. ./vars
./clean-all
./build-ca
./build-key-server server
./build-dh

then generate they key for our svxlink server:
./build-key svxlink 

under keys directory you should find all the generated files, move them on /etc/openvpn/ directory
cd keys
mv ca.crt /etc/openvpn/ 

mv ca.key /etc/openvpn/
mv dh2048.pem /etc/openvpn/
mv server.crt /etc/openvpn/
mv server.key /etc/openvpn/


create and edit /etc/openvpn/server.conf , write the following lines:
port 5050
proto udp
dev tun0 ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
dh /etc/openvpn/dh2048.pem
server 10.8.0.0 255.255.255.128
persist-key
persist-tun
tun-mtu 1500
script-security 2
log /var/log/openvpn.log
sndbuf 393216 rcvbuf 393216
push "sndbuf 393216"
push "rcvbuf 393216"
ifconfig-pool-persist /etc/openvpn/ipp.txt
push "redirect-gateway def1 bypass-dhcp"

client-to-client
keepalive 10 120
verb 2

edit /etc/default/openvpn , find the line AUTOSTART and set it as:
AUTOSTART="server" # this is the same name of the conf file

reboot openvpn service:
/etc/init.d/openvpn restart

if all is ok you should see a new network interface named tun0 with address 10.8.0.1:

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.8.0.1  netmask 255.255.255.255  destination 10.8.0.2
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 100  (UNSPEC)
        RX packets 86819  bytes 92236228 (87.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 70603  bytes 14042290 (13.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enable ip forward:
edit /etc/sysctl.conf and uncomment the line
net.ipv4.ip_forward=1
then run:
sysctl -p /etc/sysctl.conf

sabato 10 agosto 2019

AOR AR8000 Panadapter Interface

The following post will describe how to take the IF from the radio scanner AR8000 by AOR and feed it to an SDR, this is useful to see the spectrum around the tuned frequency and/or use sdr sharp and its plugins to decode, for example, TETRA signals.

First you have to open the back of our radio removing the screws marked in the pics below:






Open and find a stripe of 16 pins, you are on the back of the board, see the red circle on the pic below:


Now, the IF output is the 10th pin from the left, the 6th from the right.
Solder a 100pf capacitor to decouple the radio from the sdr and to prevent sdr with bias tee to inject some current.
Add a cable taking the earth from the negative pin of the battery or from other place you like,
and a panel female connector, I choose to use a 2,5mm mono jack, and fix it on one side



You can close the radio now and make a cable to connect the IF out to an SDR, in my case a 2,5mm mono jack male to SMA.
Connect SDR to your PC and open SDR# or other sdr software you like.
According to AOR manuals you have to tune the following IFs, depending on the frequency sintonized:
from 100kHz to 450MHz and from 1500 to 1950MHz IF is at 736,250MHz
from 450 to 1500MHz IF is at 275,450MHz

Below are two examples:

Broadcast FM signals, radio set on 88MHz SDR# on 736,250MHz

TETRA signal, radio set on 463MHz and SDR# on 275,450MHz








sabato 1 giugno 2019

Kenwood TS-480 SAT panadapter interface

A panadapter is a device that connects to a standard hardware radio and allows you to visually see the RF signals on a waterfall. Since SDR’s run on the PC, they naturally have the ability to display a panadapter screen, and most software like SDR#, HDSDR and SDR-Console already provide this. The RTL-SDR can also be used to add panadapter capabilities to a regular hardware radio.

First of all you have to find the IF out pin named CN152 on our rig, opening the case bottom side, near the front.

kenwood ts-480 if pin

kenwood ts-480 if pin

I have found that connector on an old radio, something related to audio/music cassette deck, however they are very common.

Coax cable go out of the rig through the grid on the front panel

Even if with the signal coming out the IF stage we can already feed an sdr, it is strongly recommended to use an adapter to:
  • match impedence
  • don't load the rig uselessly
  • isolate the couple rig-pc
Personally i have bought this Panoramic Adapter Tap (PAT70M)  and put it in a Mentos box




adding a female jack to feed it with the required power, 13,8V , taken from the same power supply of the rtx.
It is not necessary to power off or isolate this board during tx.
On the other side of the box comes out the signal on a coax cable with MCX male plug that will feed our sdr, a NooElec Nano 3

Check here Kenwood TS-480 SAT panadapter interface - part 2 to see how to configure sdr-console.





domenica 12 maggio 2019

Kenwood TS-480 SAT audio cable for digi modes


I'm a happy owner of the rig Kenwood TS-480SAT, I will share how I made the audio cable to interface the rig to a computer to work with digital modes like FT-8.

The minidin connector named DATA in the rig manual is basically the same as the old PS/2 cable for mouse or pc keyboard.
You can take an old keyboard and cut the cable on the keyboard side,
remove the outer sheath and the common sheild and then, with the help of a tester,
find which pin is connected to which internal cable, taking note of the colors.
for example, below is my case
PS/2 TS-480 audio data cable



PS/2 male connector - front view:
Pin 1 - yellow
Pin 2 - green
Pin 3 - blue
Pin 4 - red
Pin 5 - brown
Pin 6 - black





On the rig side:
Pin 1 - GND
Pin 2 - to pc speaker
Pin 6 - to pc microphone

Then we will take two male jack 3.5mm connectors:

To pc mic:

PS/2 TS-480 audio data cable

Pin 1 connected to PS/2 pin 6 (black cable in my case)
Pin 2 not connected
Pin 3 GND to PS/2 pin 1 (yellow) and outer sheild











To pc speaker:

PS/2 TS-480 audio data cable

Pin 1 connected to PS/2 pin 2 (green cable in my case)
Pin 2 not connected
Pin 3 GND to PS/2 pin 1 (yellow) and outer sheild










For your convenience you can label the two jack connectors and use an usb sound card, as you see in the pic below, to leave the native pc sound card free.



 Maybe you have to polish the PS/2 connector to fit in the rig.
PS/2 TS-480 audio data cable





giovedì 2 maggio 2019

RaspBRadio - A Raspberry Pi and RTL-SDR Based Boombox

Raspberry radio scanner from 0 to 1750MHz

Introduction:
I'm not a python developer, you will find a lot of "strange things" in the code cause it is copy-pasted here and there from the net... but it's working.
Please help improving the code.
Any question or comments will be accepted.
------------------------------------------------------------------
For this project I have used:

SHARP GF-450 H Boombox - only case, antenna, speakers and a red led remain in place
Raspberry Pi 3 Model B
Nooelec Nano 2
Nooelec Ham It Up v1.3 HF upconverter
TDA2822M audio amplifier - DON'T use PAM8403 cause it produces a lot of interference in HF
KY040 rotary switch
4x4 matrix keyboard
4 lines lcd display
i2c level shifter
various cables and connectors
------------------------------------------------------------------
Description:
As you can see from pics below, there are 4 rotary switch on the top of the radio, one, on the left, is the potentiometer directly attached to audio amplifier module that receive audio signal through jack-jack cable connected to raspberry.
Other 3 are the ky040 rotary switches, 1st is to go up and down in freq with 500Hz steps and if pushed decrease the squelch level, 2nd is with 5KHz steps and if pushed change demodulation, 3rd with 50KHz steps and if pushed raise the squelch level.
On the right there is a lever, is connected to the upconverter in the place of the original switch and plus select the antenna, the original stylus for frequency above 30MHz or an external antenna for frequency below 30MHz (when upconverted is turned on) with a BNC connector on the right side of the radio.
On the right side there is also power connector, i've just used original raspberry power adapter with a male-female generic dc plug in the middle of the cable cutted and soldered.
Power must reach raspberry, upconverter and audio amplifier.
On the front we can find the lcd, inside, where was the musicassette mechanics, connected to raspberry gpio through a i2c level shifter; and a 4x4 matrix keyboard.
On the back, just as a backup when wifi doesn't work, there is a rj45 female coming from raspberry.
Audio is also streamed on the network thorugh a vlc instance.
------------------------------------------------------------------
Usage:
use the ky040 to set frequency, squelch and demodulation as described above.
Press 'A' to enter a frequency manually then press '#' to confirm and exit the menu.
Press 'C' to enable upconverter then move on the right the lever switch on the top of the radio.
Press 'C' again to disable and move the lever on the left.
Press 'D' to set audio properties, in this menu you can press 1 or 2 to decrease or raise bass volume, 4 or 5 for middle, 7 or 8 for high, 3 or 6 for software volume, then press '#' to exit.
Press '*' to shutdown the system.
You can listen the audio streamed on the network using VLC and opening the network stream http://ip_address:8010
If you press the ky040 demodulation switch till "spyserver" appear on the display, you can connect to the radio with sdr#.
Open sdr#, set as souce "spy server" and point to spy://ip_address:5555/ ; the ip address of wifi and vpn is also shown on the display.
------------------------------------------------------------------
If you use the integrated wifi module, you will listen some noise coming out the speaker like a tick.
I observe that these ticks are related to the network usage, more bandwidth is used more noise is produced on the speaker. Issue is resolved disabling integrated wifi and using an usb wifi dongle.
------------------------------------------------------------------
Software requirements for running this python script are:
Raspbian OS updated
rtl_udp, rtl-sdr and spyserver ( check https://airspy.com/download/ )
pad4pi python libraries
cvlc from vlc suite
pulseaudio and alsamixer
wifi or lan configured(with or without openvpn) to use sdr# ( https://airspy.com/download/ )remotely.
------------------------------------------------------------------
Install:
Put the python script on /home/pi/RADIO/ directory, naming it ctrl_rtl.py , together with spyserver and spyserver.conf
Run: chmod +x ctrl_rtl.py; chmod +x spyserver
Edit spyserver.conf for your needs
To run it at startup add to /etc/rc.local the line:
su pi -c "sleep 20; nohup /home/pi/RADIO/ctrl_rtl.py &"
------------------------------------------------------------------
TBD:
- CW listening (and decoding? printing it on lcd?)
- RDS decoding when listening to BFM stations
- do something with 'B' key
- date and time display
- improve speed and stability
------------------------------------------------------------------

watch video below in fullscreen at 480p




raspberry ghettoblaster sdr radio scanner

raspberry ghettoblaster sdr radio scannerraspberry ghettoblaster sdr radio scanner


raspberry ghettoblaster sdr radio scanner

raspberry ghettoblaster sdr radio scannerraspberry ghettoblaster sdr radio scannerraspberry ghettoblaster sdr radio scannerraspberry ghettoblaster sdr radio scannerraspberry ghettoblaster sdr radio scanner