Jan 2, 2014

SBS-3 to Base station Traffic Compression

Listening only to ADS-B data from an SBS-3 antenna can consist of something like 20-30KB/s of continuous data. If you have the device turned on 24/7 for a whole year this will sum up to more than half a Tera Byte of data. For most people this is just fine since it should still fall under the terms of use of most service providers or because the device is in the local network.

For others, however, it could be a problem. Take for instance a setup where the antenna will have to transmit the data via cellular network or via modem. Let's not forget that the data is outbound and on a line with 1Mbit/s out speed the basestation will eat up about 15% of the bandwidth.

Fortunately the traffic is quite repetitive and a constant flow is not really necessary. So this leaves the door open to compression and some nice people did all the work for us.

In this example the local network of the antenna is called Net A and the one of the client Net B. To compress the traffic we will need an additional computer on Net A that we will call Encoder. Here a Raspberry Pi or similar could be really ideal.

For the tunnel we will use ncat and we will only compress the outbound traffic. Assuming that the antenna has the IP 192.168.1.2, on the Encoder we will run the following command:

ncat -l 10001 -c 'ncat 192.168.1.2 10001 | gzip -c'

Assuming that the encoder's IP is 192.168.1.3, on the client in Net B we will run

ncat -l 10001 -c 'ncat 192.168.1.3 10001 | gunzip -c'
To get ncat and gzip on windows you can either install them directly or use cygwin.

now we just have to configure the basestation software to access localhost instead of the antenna and all traffic in going to be compressed.

Results

With some simple measurements, I could notice that the trick should allow you to reduce the traffic from the original 20KB/s to about 1KB/s. Since gzip will compress data in blocks the flow of data will be much less regular. Fortunately it looks like the basestation software does not care about this.

Other software

Initially I tried to use a compressed SSH tunnel. Strangely there was no reduction in the traffic size. I probably did something wrong in setting the tunnel up. Since ncat worked so well I did not bother finding out what went wrong with the SSH tunnel.

Instead of gzip one could also use other compression software like xz, bzip2, etc. Such software might have even better compression ratios. Beware, however, that some algorithm use big compression buffers and might require quite some data before actually returning something.

Links

kinetic avionics
http://www.kinetic-avionics.com
ncat
http://nmap.org/ncat/
gzip for windows
http://gnuwin32.sourceforge.net/packages/gzip.htm
cygwin
http://cygwin.org/

Apr 13, 2013

SVG Filters: ColorMatrix

The Matrix you can enter below will be multiplied against all the color vectors of the image on the right below.
RGBA1
R
G
B
A
0 0 0 0 1 1
The SVG filter that is being applied to the image is the following.
<svg width="0" height="0" xmlns="http://www.w3.org/2000/svg">
    <filter id="filterid">
        <feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 "/>
    </filter>
</svg>
To apply such a filter to an HTML element one simply has to put the SVG filter somewhere in the page and apply it with the following CSS3 code.
img {
   -webkit-filter: url(#filterid);
   filter: url(#filterid);
}