Saturday, December 24, 2016

APRS and Laptop Power Cord Interference

One of the great things about the Kenwood TH-D74A is how easy APRS is to use. However I was puzzled for a few days because I could not make it work with my rtl-sdr receiver within my apartment.  It turns out my Lenovo W520 Laptop power cord was causing just enough interference to make the TH-D74 think it was receiving a message all the time preventing the HT from transmitting.

At the time, I was developing a python script to extract location data from APRS packets.  I had my cheap RTL2832 tv tuner plugged into an Odroid C2 on a different monitor and was watching the waterfall with GQRX.  After turning off all other electronics in the house, the spike near 144.390 MHz went away.   Trial and error revealed the problem to be with the laptop power supply.

Hooray!

Thursday, December 22, 2016

DStar Repeaters and QGIS

I recently purchased a Kenwood TH-D74A and downloaded the Repeater List by region from dstarinfo.com.   The data comes as a tab separated file (TSV) and has columns for Lat DD, Lat MM.mm, and N/S as well as Lon DD, Lon MM.mm, and E/W.

To import into QGIS, the file needs latitude/longitude in Decimal Degrees so we need to convert formats.

According to Directions Magazine:

Degrees Minutes Seconds to Degrees Minutes.m
Degrees = Degrees
Minutes.m = Minutes + (Seconds / 60)

Degrees Minutes.m to Decimal Degrees
.d = M.m / 60
Decimal Degrees = Degrees + .d

It's also worth noting that N and E are both positive numbers while S and W are both negative numbers.

Open Excel

On my repeater list, the columns were as follows:

  • U2 is Lat DD
  • S2 is Lat MM.mm
  • T2 is N/S
  • Y2 is Lon DDD
  • Y2 is Lon MM.mm
  • X2 is E/W


Add a new column for Lat

Use this formula: =IF(U2="N",(S2+(T2/60))*1,(S2+(T2/60))*-1)

Add a new column for Lng

Use this formula:  =IF(Y2="E",(W2+(X2/60))*1,(W2+(X2/60))*-1)

Copy and Paste into remaining cells.

Save as CSV

In QGIS, click the import delimited file button


Use the new columns created by the Excel formulas


Click Ok and you should see your repeater list as points on the map.



On further inspection, it appears the coordinates may have a lack of precision that puts the points not quite where they should be.   More research is needed.

Monday, December 12, 2016

Tips for installing GeoNode on Ubuntu 16.04.1


I followed the GeoNode install instructions for Ubuntu 14.04

I installed Postgresql 9.5/postgis and Geoserver as specified and then later changed them to other servers. I install Tomcat 8.


Tip One:
sudo pip uninstall celery
sudo pip install celery=3.1.18
sudo pip freeze > requirements
sudo pip install -e .


Tip Two
Edit /var/www/geonode/geonode.wsgi

#Comment out these lines and replace with:
#from django.core.handlers.wsgi import WSGIHandler
#application = WSGIHandler()

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Saturday, December 10, 2016

Separating GeoNode Capabilities

I was able to use separate hosts for GeoNode, Geoserver, and Postgresql/Postgis instead of having them all on a single machine.

On the remote Postgresql server:

  • Create the geonode user and both the geonode and geonode_data databases.  I used the instructions available here
  • Edit /etc/postgres/9.5/main/pg_hba.conf  to allow geonode user and database access
  • Edit /etc/postgres/9.5/main/postgresql.conf to allow listeners outside of localhost


On the GeoNode host:

  • Test access to remote server with:  psql -h <remote host ip> -U geonode
  • Edit /etc/geonode/local_settings.conf  and change the database host and password
  • Add the remote database server to the ALLOWED_HOSTS
  • Edit /etc/geonode/local_settings.conf and change the GEOSERVER_URL
  • Make sure the remote geoserver has an admin user/password that matches local_settings.conf
  • Edit /etc/apache2/sites-available/geonode.conf and change the ProxyPass and ReverseProxyPass directives.


For future builds:

Before running the install.sh script, edit the geonode/package/support/geonode.local_settings and change the remote database settings and remote geoserver settings



Friday, December 9, 2016

Creating C2 Images

After configuring each ODroid C2 computer with /etc/hostname, /etc/hosts, npre plugin for nagios server monitoring and other settings, I decided to clone the image without an additional software so I could easily create new builds for the host later on.  Here are the steps I took:

Put the eMMC into the ODroid SD card adapter and plug into a card reader

Launch Win32 Disk Imager

Choose location to store images and create a filename such as hostname_yyyymmdd.img

Choose Device drive letter and click Read

The final size was 14.5 GB for a single image so make sure you have enough space to store multiple images.


Tuesday, December 6, 2016

Virtual Machines have been built

So far, I've successfully created 3 virtual machines using Oracle VirtualBox and Ubuntu 16.04 Server


  • Geoserver 2.10
  • Postgresql with Postgis 9.5
  • GeoNode 2.5.5


As separate virtual machines, the Geoserver and Postgresql builds have been pretty straight forward. The Geonode has been quite painful but it is finally up and running.   However, the Geonode server involves installing Geoserver, Postgresql, and Geonode on the same machine.    I need to further configure the Geonode server to point Geoserver and databases to separate machines.  

I used virtual machines so I could take snapshots and restore to clean installs when I made mistakes.  The builds will be eventually repeated on the small single board computer, ODroid C2

To do in the near future:

  • Configure the Geonode server to separate duties
  • Install Nagios NPRE client so I can record various performance data onto the Nagios 3 software I have running on my Raspberry Pi 2.
  • Plan installs of Geonode, Postgresql, and Geoserver onto the ODroid C2 stack (More info later!)



Saturday, December 3, 2016

Portable Open Source GIS with Raspberry PI and Radio

I wanted a low cost, open source geographic information system (GIS) that would would support ham radio operations and could be added to a mobile ham shack.   I also wanted the GIS to work without internet access and be able to be updated using digital modes available to ham radio operators.

ESRI ArcGIS for Server, ESRI Portal for ArcGIS, ESRI ArcGIS Desktop,  and Microsoft SQL Server are widely used in the GIS community.  While these are great products, they did not meet my requirements.

Software:
  • Geoserver is the open source equivalent of ArcGIS Server, software that can provide geospatial information to applications
  • PostgreSQL is the database for storing both geospatial and non-geospatial information.
  • PostGIS is an extension for Postgresql that adds geospatial capability
  • GeoNode is an open source equivalent of Portal for ArcGIS, software that allows users to create and share web maps and documents
  • QGIS is desktop application for producing high quality maps and performing geospatial analyses
  • GNU Radio is the toolkit for developing software defined radios
  • RTL-SDR software used to demodulate radio signals
  • Python - script language for processing text and performing database operations
Hardware:
  • Raspberry Pi 2 (900 Mhz, 512 MB Ram, 10/100 Ethernet)
  • Raspberry Pi 3 (1.2 GHz, 1 GB Ram, 10/100 Ethernet)
  • ODroid C2 (1.5 GHz, 2GB Ram, 10/100/1000 Ethernet, 4K display support)
  • RTL-SDR RTL2832U  - a cheap radio receiver
  • HackRF One - a software defined radio receiver/transmitter
GIS Data:

In future posts, I'll be detailing the build and configuration process, expanding on GIS data sources, and discussing potential applications.

Wednesday, October 19, 2016

Morse Code, Linux, and Powershell


Here are some CW tips:

Use this to receive audio through mic jack and decode the cw signal:

arecord -f S16_LE -c1 -r48000 -D hw:CARD=Device,DEV=0 - | sox -t raw -esigned-integer -b16 -r 48000 - -esigned-integer -b16 -r 22050 -t raw - |multimon-ng -a MORSE_CW -t raw -


Use a command like this to receive and decode CW from an RTL2832U SDR:

rtl_fm -f <freq> -s 22050 -M wbfm | multimon-ng -a DTMF -t raw - 


Use Powershell to make system speaker beep CW:

$frequency = 400
#frequency needs to be between 37 and 32767

$time = 200

$dot_duration = 100
$dash_duration = 300

$dot = '[console]::beep($frequency, $dot_duration)'
$dash = '[console]::beep($frequency, $dash_duration)'

$spacing = 0.1
$char_spacing = .3
$word_spacing = 0.7

$morse_rev_lookup = @{
    ".-"="A";
    "-..."="B";
    "-.-."=    "C";
    "-.."=    "D";
    "."=    "E";
    "..-."=    "F";
    "--."=    "G";
    "...."=    "H";
    ".."=    "I";
    ".---"=    "J";
    "-.-"=    "K";
    ".-.."=    "L";
    "--"=    "M";
    "-."=    "N";
    "---"=    "O";
    ".--."=    "P";
    "--.-"=    "Q";
    ".-."=    "R";
    "..."=    "S";
    "-"=    "T";
    "..-"=    "U";
    "...-"=    "V";
    ".--"=    "W";
    "-..-"=    "X";
    "-.--"=    "Y";
    "--.."=    "Z";
    ".----"=    "1";
    "..---"=    "2";
    "...--"=    "3";
    "....-"=    "4";
    "....."=    "5";
    "-...."=    "6";
    "--..."=    "7";
    "---.."=    "8";
    "----."=    "9";
    "-----"=    "0";
    ".-.-.-"=  ".";
    "--..--"= ";";
    "..--.."= "?";
    "-...-"= "==";
    "-..-."= "/";
    "---..."= "=";
    "-....-"= "-";
    "..--.-"= "_"
    }

$morse_lookup = @{}

foreach($k in $morse_rev_lookup.Keys){
    $morse_lookup.add($morse_rev_lookup[$k], $k)
}

$someinput  = [Environment]::UserName

$chararr = $someinput.ToCharArray()
foreach($k in $chararr){
    
    if( $morse_lookup[$k -join ""] ){

        Write-Host $k, ":", $morse_lookup[$k -join ""]
        $letter = $morse_lookup[$k -join ""].ToCharArray()
        foreach($l in $letter){
            if($l -eq "."){
                Invoke-Expression $dot
            }else{
                Invoke-Expression $dash
            }
            sleep($spacing)
        }
        sleep($char_spacing)
    }else{
        sleep($word_spacing)
    }
}