Archivi categoria: Ricerca

AIS – un aggiornamento

Correzione di un piccolo BUG nel sito web che presenta i dati dell’AIS: se sono presenti delle imbarcazioni che hanno un apostrofo nel nome, la mappa non funziona. Ho corretto il codice, inserendo una piccola funzione che elimina del tutto gli apostrofi dal nome. Il precedente approccio con un escape character non era valido.

Ho aggiunto la funzione di “ricerca” informazioni nel menu a nuvola che si apre cliccando su una stazione. Adesso compare la voce “search” che redirige al sito di MarineTraffic e visualizza il risultato della ricerca di quel particolare MMSI. Interessante potere visualizzare le foto della imbarcazione e i dati aggregati raccolti da MarineTraffic.

Ricordo il sito di riferimento:

WebSdr – PmSDR and RTL-SDR configuration Guide

PMSDR is a small, cheap and high quality SDR Receiver. It was conceived by Martin Pernter Iw3AUT some years ago. I have been using it for both hobby and scientific research, loving its stability and ease of use.

After a long time, during which the receiver collected dust on a shelf in my office, I decided to bring it again to life for the WebSDR project. I’ll not give details on the work of PA3FWM, please visit its site to learn about its work.

The WebSDR project is addressed both to hamradio  enthusiast both to students of the University where I work. SDR technologies are wide spread and it’s time to talk about this subject in the telecommunications oriented courses that are held at University. So I think that the possibility to show some real application of SDR can support the learning path of students, trying to catch their curiosity.

Phase 1 of the projects requires to setup a basic system, using PMSDR and RTL-SDR dongle in order to evaluate performances and get acquainted with WebSDR software.

Configuring the dongle to work in WebSDR is quite easy. It requires the installation of rtl-sdr package in order to provide rtl_tcp command.

After connecting the dongle to the PC, you can check it has been correctly recognised with the lsusb command.

websdr@websdr:~$ lsusb
Bus 002 Device 002: ID 0bda:2832 Realtek Semiconductor Corp. RTL2832U DVB-T

In order to let the dongle receive and forward data, you can use the rtl_tcp program. It will create a socket and stream I/Q samples through it. Put this command in your rc.local file to execute it as a daemon during computer boot.

rtl_tcp -a -p 65144 -f 145000000 -d 0

Remembre that if you want to change the receiving frequency, you have to modify THIS script, otherwise nothing will happen. The command stated shows -p switch, in order to set the streaming port, the -f to set the working frequency and -d to address a specific device in case you have multiple dongles.

WebSDR configuration lines for RTL-SDR are very simple:
#rtl_sdr per i 3cm
band 3cm
device !rtlsdr 85
samplerate 2048000
centerfreq 681000
antenna lnb

The “85” shows the amount of ppm correction to apply in the frequency.

Setting up the PMSDR may be a little “tricky”. First of all you have to consider this is a “near-zero IF SDR”: it will provide an audio baseband signal to a sound-card. First of all you have to setup an ALSA sound system. If you (like me) are not very familiar with Linux audio world, well “don’t panic”. The sound-card I use with PMSDR is USB connected. So let’s check it:

websdr@websdr:~$ lsusb
Bus 002 Device 002: ID 0bda:2832 Realtek Semiconductor Corp. RTL2832U DVB-T
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 002: ID 041e:30df Creative Technology, Ltd

Now it’s time to hadle permissions for using the soundcard:
websdr@websdr:~$ cat /etc/udev/
hwdb.d/ rules.d/ udev.conf
websdr@websdr:~$ cat /etc/udev/rules.d/90-creative.rules
ACTION==”add”, SUBSYSTEM==”usb”, SYSFS{idVendor}==”041e”, SYSFS{idProduct}==”30df”, GROUP=”audio”

Now you should be able to use the “magic” command:
websdr@websdr:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Pro [SB X-Fi Surround 5.1 Pro], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0

Before trying to go any further is mandatory to check if ALSA can support your hardware. In any other case all your efforts will result in a total loss of time. According to ALSA site, the SB X-Fi in UNSUPPORTED.

So let’s give up and try another Audio Adapter, this time embedded device:

root@websdr:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: ALC662 rev1 Alt Analog [ALC662 rev1 Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0

WebSDR configuration file wants to know 3 parameters: card,device, subdevice. Using this command we can retrive all data we need, as the card number is “0”, the device is “0” and the device is “0” as well. Write this parameters and  forget them.

Now you need a way to interact with PMSDR internal PIC in order to program the internal oscillators. More over, if your PMSDR is equipped with a Downconverter board, you have to program it as well. There is a small,yet realiable and easy-to-use, client which was written by Andrea Montefusco and is available on sourceforge. You have to build it, so install gcc and read carefully the installation notes. After the program has been built, run it by “pmsdr”. There is an embedded help system.

Linux PMSDR 2.0/2.1 control program, version 2.5.1
Original code by Martin Pernter IW3AUT
Linux porting by Andrea Montefusco IW0HDV – DG8SAQ-I2C
Interface 0 claimed.
Firmware reports version 2.5.0
Si570 detected.
CY22393 detected.
Downconverter Board detected.
Si570 on Downconverter Board detected.
Type ‘help’ or ‘?’ for get online help.
/tmp/PMSDRcommands FIFO unavailable [No such file or directory]
Input switched to standard input.
—> help

<command> [<value>] //
FREQUENCY : f <d> // f 7050000 == ( 7.050,000 kHz)
F3Harmonic : f3 <d> // f3 100300000 == ( 100.300 MHz)
FREQUENCY Dc : fd <d> // down converter conversion frequency in Hz
FILTER : filter <d> // 0 (no filter),1 (2-6MHz),2 (5-12MHz),3 (10-24MHz), 4 (<2MHz)
DFILTER : dfilter <d> // 0 (down converter bypass), 1 (VHF filter), 2 (UHF filter), 3 (unfiltered)
QSDbias : qsdbias <d> // qsdbias 512 (default), 346-692 (interval allowed)
QSDmute : qsdmute <on,off> // qsdmute on, qsd off (i.e. 0,1
STOREfreq : memf <d> // store init freq into PMSDR EEPROM f 585000 == (585,000 kHz)
STOREfreq3 : memf3 <d> // store init f3/3 into PMSDR EEPROM
RESTORE freq : rmemf // restore init freq from PMSDR EEPROM
PRINTlcd : plcd <col> <row> <message_text> // print the message text at specified coord on the LCD
QUIT : quit // exit from pmsdr
HELP : help // this help!

->help,filter 4,f 1611000,f 585000,memf 585000,filter 0,f3 100300000,quit

In order to set PMSDR for 2m reception you need to program downconverter first:
dfilter 1
fd 116000000
In this way 144MHz is downconverted to 28MHz. So the next step is
filter 0
f 28000000
save it!
memf 28000000.

Now let’s go back to WebSDR and let’s write some configuration for PMSDR as well:
#pmsdr per i 2m
band 2m
#alsa devices are: card/dev/subdev
device $hw:0,0,0
samplerate 96000
centerfreq 144320

Some screenshot taken with lab equipment, showing the receiver busy in demodulating a carrier at 144.290 MHz (frequency choosen where the waterfall was clean).

So the work is over. Everything should be fine and you should be able to run the server. I’m still very disappointed that I was unable to use a better soundcard. I did some testing with a PCI M-Audio Audiophile 2496 but I was unable to let it work.


Finalmente è arrivata!!!
(questo articolo è in attesa di essere pubblicato dal 3 ottobre 2016)

Packaging minimale, ottima imbottitura, grande protezione  e dentro la chiavetta! Completamente in alluminio, con un bel connettore SMA femmina installato. Il tempo di collegarla al PC e già funziona. Non richiede driver o procedure perverse di installazione. Davvero un dispositivo Plug ‘n Play.


Ho scaricato l’ultima versione di SDR# ed ho avviato la ricezione: eccellente! Il front-end è meno predisposto alla intermodulazione, lo spettro visualizzato è pulito ed i segnali si vedono decisamente peggio.

Forse lascia sul terreno qualche cosa in termini di guadagno: le conversazioni su satelliti MIL a 256 MHz non riesco a riceverle, ma sono piccoli dettagli.

La possibilità di visualizzare una porzione molto ampia di spettro è fantastica ed apre la scena a numerose applicazioni, anche in ambito didattico. Ecco qualche screenshot di SDR# della simpatica applicazione “analizzatore di spettro” che vedo molto bene in congiunzione con il generatore di rumore ad ampio spettro per fare qualche prova sui filtri in cavità. Antenna televisiva, in paese. La prima con 100MHz di span e la seconda in full Bandwidth.

Costa… vero… ma ne vale davvero la pena!!!

AIS Maintenance

The AIS decoder system has been up and running since March 2012. Since then database table have been growing up at a good rate. This year I decided to clean up the system before everything goes bananas.

The ais_stat_data table was really huge and it was really mandatory to cut some lines and make it lighter and faster.

Some old and unuseful tables were removed and data was stored in a safe place. After the cleaning database looks more “fit” and light.

The system is now up ‘n running and is ready to face 2017 AIS messages. Stay tuned!