Monday, December 11, 2017

Raspberry Pi 3 Headless With SSH

If you wish to make a standalone router, file server, or satellite weather station, then you need a little computer to make things happen.  At this time, the most popular embedded Linux machine is the Raspberry Pi.  It is a delightful little design - tiny and very useful.

The default system is Raspbian, which is loosely based on Debian.  This is excellent.  Years ago, I tried a Beaglebone Black and it came with a cripple version of Angstrom Linux which I didn't like and the board is consequently lying somewhere in my junk box.

The Raspbian system is aimed at clueless newbies and the ssh daemon is disabled by default.  To use it as an embedded server, without having to plug in a keyboard and screen, you need to add one line to a configuration file, before you plug the SD card into it.  Here is how to do all that.

Get a Pi and a SD Card Image

Get your RPi3 from here:
https://www.sparkfun.com/products/13826

Download a Raspbian image zip file from here:
https://www.raspberrypi.org/downloads/

Open a terminal and unzip with:
$ ark —batch filename.zip

That will take a loooong time…

Become super user:
$ su -
password


Write the img file to a miniature SD card:
# dd if=filename.img of=/dev/mmcblk0p

 

Make a headless pi

Re-insert the SD card and mount the root directory (don’t bother with the boot directory).
# cd /run/media/username/root/etc
# vi rc.local


Insert mode:
i

Go to the bottom and just above the exit statement add:
systemctl start ssh

Save the file:
[esc]wq

Flush the disk file buffers:
# sync

Umount and Eject the card.

First Login

Now when you hook the Pi to your router, it will get an IP address via DHCP and then run sshd automatically the way the Linux gods intended it to be.

You can then log in with for example:
$ ssh pi@192.168.1.100
raspberry
$


Change the password:
$ passwd
raspberry
newpassword
newpassword

Expand the root filesystem to use all of the SD card

Since this is a new device, you need to expand the file system to fill the whole SD card:
$ sudo raspi-config
password

Now do Update followed by Advanced, Expand Filesystem.  Then do Finish, Reboot, Yes.

Solid State File Server

With four 256 GB USB flash memory widgets plugged in, you can make a 1 TB solid state file server for about 1100 Dirhams - something that was unimaginable just a few years ago.

A file server doesn't have to be fast.  It is limited by the network speed, not the processor.  So a little Rpi makes a very cost effective file server.

So far, I managed to get only two 256 GB Sandisk widgets.  They came in perfectly idiotic packages, so I had to break all the plastic off to get them to fit in the USB sockets.  For protection, I wrapped one layer of self vulcanizing tape around them.  I don't know what the clowns who designed the little enclosures were thinking, but it was clearly form over function - now it is function over form...

I always prefer doing things the simple way, so I formatted them with ext4 and mounted them using /etc/fstab in /mnt/sda1 and /mnt/sdb1 like this:
$ sudo fdisk /dev/sda1
-t 83
-w

$ sudo mkfs.ext4 -L sda1ext4 /dev/sda1
y


$ sudo nano /etc/fstab /dev/sda1 /mnt/sda1 ext4 defaults,noatime 0 1

$ sudo mount -a

...and ditto for the other one.


I have never managed to figure out how to mount a disk so that a common user can write to it.  My workaround is to make a directory on the thing and assign the user name and group to that, so now I have /mnt/sda1/dataa and /mnt/sdb1/datab and chowned them to pi:. $ sudo mkdir -p /mnt/sda1/dataa
$ sudo chown pi: /mnt/sda1/dataa

So the access problem is solved without having to read another manual on disk mounting and with that, I now have 512 GB of online solid state storage, accessible over ssh and scp.

Heat

These Sandisk USB watchammacallits get very hot and there are long stories on the Sandisk forums about heat problems.  So removing them from their plastic packaging is actually a good idea, since that improves the air flow over the chips. The good news is that most people say they last for years, despite the heat.

Rsync Backup Script

I made a RSA key file with ssh-keygen and uploaded it with ssh-copy-id, as described here https://www.ssh.com/ssh/copy-id

The IP address of the Rpi was added to /etc/hosts, so I don't have to keep typing it in.

The trick with a backup script, is to keep it simple and include everything in your home directory and then exclude a few generic things.   That way, the script is maintenance free and will always work, irrespective of how you move files around.

My rsync backup script now looks like this:
#! /bin/bash
rsync -avze ssh --progress --delete --max-delete=10 --max-size=20M --exclude '.Trash'  ~/. pi@rpi:/mnt/sda/dataa/

The max-delete protects against catastrophes and max-size prevents making backups of large ISO files and movies, since those things can always be downloaded again from wherever they came from.


La voila!

Herman

Saturday, December 9, 2017

Satellite Weather Maps, on a Macbook

There are thousands of communications and earth observation satellites flying over our heads at all times.  Many of the earth observation satellites broadcast useful data which anyone can receive, once you acquired the necessary equipment and know-how.  See this https://amsat-uk.org/

Weather satellites are generally considered to be the most useful of the lot, since the data is open and not encrypted and the signals are quite strong.  The NOAA operates both geostationary and polar observers.  The geo satellites can only be received if you happen to live in its antenna footprint, while the polar satellites pass overhead twice a day wherever you are.

This article describes how to get an image from one of the NOAA polar satellites, using a cheap ($25) little RTL-SDR radio receiver.  These pictures are interesting, since the weather is always changing.

Interface Specifications

NOAA-15, NOAA-18 and NOAA-19 are probably the easiest to interface to.  All three satellites broadcast using an ancient system termed Automatic Picture Transmission (APT).

The APT signal is 2.4 kHz, amplitude modulated, described here http://www.cder.dz/download/Art7-1_1.pdf and here https://www.sigidwiki.com/wiki/Automatic_Picture_Transmission_(APT)

Which Computer System To Use

Most ordinary mortals use MS Windows computers.  These are generally good for playing games, writing letters and doing bookkeeping, but they are not very good for engineering use.  The problems are many fold:  The operating system scheduler is not real-time, the USB interface is buggy, scientific software invariably require specialized libraries of specific versions, which sometimes clash with libraries that are already installed.

The result is that if your special program happens to work, then you are in luck.   
If it doesn't work, then you are out of luck and there is nothing you can then do about it and your project is hung - Nuf sed.

A Macintosh system is better, since it is based on FreeBSD, but it suffers from some of the same software library issues when using precompiled (non-Free) software.  However, if you use Free software, then it is much the same as Linux/FreeBSD.  In order to use Free scientific/engineering software, you need Xcode (The C compiler provided by Apple, in the App Store),  Macports https://www.macports.org/ and Homebrew https://brew.sh/.  With these tools, you can compile specialized software, much the same as on FreeBSD/Linux.

Linux and BSD have good real-time performance and gives one full control over everything.   On these UNIX systems, Free software is installed by downloading the source code and compiling it on your machine.  This sorts out all the library dependency issues for your system, with the result that specialized scientific and engineering software generally work much better than on other systems.

Note that the future NOAA software systems will all run on Linux and other operating systems will be supported through Linux virtual machines only, as explained here http://noaasis.noaa.gov/NOAASIS/ml/future.html

So, for Linux users, it is the same idea as in this article.  You need to install rtl_sdr, gpredict and WXtoImg.  All the same, just a bit easier, since the repositories have what you need and you won't need weird paths - everything will be in the usual places.

The Heavens Above

The http://www.heavens-above.com web site is very useful, but the best way to see when a satellite will pass overhead is with gpredict.

Install gpredict from macports:
$ sudo port selfupdate
... long wait...

$ sudo port install gpredict
...even longer wait...

Finally, you can run it:
$ /opt/local/bin/gpredict

Gpredict Satellite Orbit Prediction

You need to select the satellites that you want to track, but it is not immediately obvious how.  There is a tiny down arrow at the top right, select Configure, then scroll down to the NOAA sats.  Enter your own ground station co-ordinates and then if you hover the mouse over a bird, you can see how many minutes are left to reach your position.

Image Rendering

The best program to render the images appears to be WXtoImg, which you can get here http://www.wxtoimg.com

There are other decoders and renderers for Linux/BSD, but I have not tried them yet.

RTL-SDR

The software required for the RTL-SDR radio widget is described here: http://www.aeronetworks.ca/2017/11/software-defined-radios.html

You need CubicSDR and rtl_sdr as described in the above link - or gqrx on Linux.

Frequencies:

You can look at the satellite data with CubicSDR.
  • NOAA15: 137.62 MHz
  • NOAA18: 137.9125 MHz
  • NOAA19: 137.10 MHz
The actual frequency is 1.9 kHz lower than the above and the modulation type is USB.  Once tuned in correctly, you'll hear the fax lines go cheap-cheap-cheap... at two cheaps per second.
The satellites also have other sensors on them and in future there will be other frequencies in the L and X band with much more data, as explained here http://noaasis.noaa.gov/NOAASIS/ml/future.html

Antennas

If you would use a simple dipole antenna, then you would only be able to receive something when the bird is almost directly overhead.  This may be good enough at first.

A better receive antenna that you can build yourself using common commercial items, is described here: http://www.aeronetworks.ca/2017/12/amateur-satcom-rx-antenna-for-2-meter.html

You need to know how to wield a drill, soldering iron and tin snips.  Do wear glasses, so you don't poke an eye out with the rods while working on the thing.

The advantage of this antenna is higher signal gain upwards and less noise from the surroundings.  However, the gain is not so high that you need to track the satellites with a mechanical rotator.  Just point it vertically up at the sky.  A plastic, water filled umbrella base, is all you need to keep it standing up.

Weather Data Capture

Once you figured out when a bird will fly overhead, go outside with your whole kit and kaboodle - you won't receive much indoors, if anything.  It depends on what your roof is made of and you won't get a very interesting image at night either.  So, horror of horrors, you have to get out of your cave in daylight!

The 2400 Hz "cheap-cheap" line data screeches can be received with the rtl_fm program and transcoded to wav format with Sound Exchange (sox), as below.

Note that on my Macbook sox resides in /usr/local/bin and rtl_fm in /opt/local/bin, probably since one was installed with homebrew and the other with macports.   This kind of confusion is one reason I prefer Linux for engineering work.

The dangling dash tells sox to read from stdin - the piped data from rtl_fm.
For example (NOAA15 137.62 MHz - 1.9 kHz, USB):
$ /opt/local/bin/rtl_fm -d 0 -M usb -f 137.618100M -s 24k -l 0 | /usr/local/bin/sox -r 24k -t raw -e s -b 16 -c 1 - wxdata.wav
 

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuned to 137618100 Hz.
Oversampling input by: 19x.
Oversampling output by: 1x.
Buffer size: 7.84ms
Exact sample rate is: 1045000.031662 Hz
Sampling at 1045000 S/s.
Output at 24000 Hz.

...long wait...

Press Ctrl-C to stop and close the wxdata.wav file.

You can pipe the signals straight into the rendering program and get the image in real-time, but making it work the simple way first, is hard enough for starters.

Also note that there are multiple types of weather fax modulation modes used by polar sats, geo sats and HF radio.  Russia also has different sats.  The above examples are for the older polar NOAA sats only.

Render the Image

Now you can run wxtoimg, hamfax or wxsat or satsignal and read the audio file.  Hopefully, the result will be better than my first try!

Nice Weather!

With a simple antenna, it will only work if the satellite is passing fairly high, more than 20 degrees above the horizon, otherwise there will be too much noise, distortion and doppler shifting.

If your antenna didn't blow down in the last storm, 
then it isn't high enough.

Other Software

There are also weather fax relays on HF radio for mariners.  The encoding is somewhat different and fldigi can be used to decode it.

The most comprehensive meteorological tool kit is probably gempack https://www.unidata.ucar.edu/software/gempak/

You can also look into wview http://www.wviewweather.com/

Setting the above up will likely be quite an adventure...

More Information

Group for Earth Observation (GEO):

Satellite Networked Open Ground Station (SatNOGS):

Digital Weather Satellite Reception:

Articles on decoding Russian Meteor-M2 weather pictures.  This one is much higher resolution than the older NOAA satellites:

Have fun,

Herman

Tuesday, December 5, 2017

Amateur Satcom Rx Antenna for the 2 meter Band

NEC2, 2 m band, 146 MHz, Yagi Turnstile Simulation and Build

This article describes a Turnstile Antenna for the 2 meter band, 146 MHz amateur satcom and NOAA weather satellites. 

The turnstile is made from two 3 element Yagis - crossed - with a 1/4 wave (90 degree phase shift) RG58 coax delay line between them for circular polarization.
Engineering, is the art of making what you need, 
from what you can get.

A 1 inch wide steel roll-up tape measure is self supporting up to about 600 mm - just good enough for the ~500 mm elements - provided that there is no wind.

Another option is to cut up a Carrefour aluminium clothes rack made of 6 mm aluminium tubes, but I like the idea of a roll-up antenna better - It is easy to stow until the next time I get the urge to bark at the moon.

For the rod, get a 1.5 inch by 1.5 m wooden dowel at Ace Hardware - it comes with a free boat anchor at one end, that one has to remove.

So, one can take some implements from the French Revolution and turn it into a modern day satcom antenna.

Radiation Pattern of the 3 Element Yagi-Uda Antenna

Only a true RF Geek can appreciate the invisible inner beauty of a herring bone antenna...


3-Element Turnstile Antenna

The idea of the antenna sketch is to make it less confusing.   Whether that aim was achieved, is not clear! 

Essentially, it is three crosses on a stick.  The driven elements are broken in the middle at the drive points.  The other elements can go straight through if that is convenient, or they can be broken also - it doesn't matter, since the current is zero in the middle.

The middle elements are driven and the electrical field is forced to rotate clockwise, when looking up at the sky, by using a delay line to make a 2 phase motor.



Tape Measure Turnstile Antenna

The reflector is 1/2 wavelength long.  The driven element is 5% shorter and the director is another 5% shorter.  The spacing from the reflector to the driven element is 1/4 wavelength.  The spacing from the driven element to the director is 0.15 wavelength.  This is a typical 3 element Yagi design.  The dimensions are not very critical, since the frequency is low.
  • The overall length of the reflector is 1027 mm.
  • The length of each arm of the driven elements is 488 mm.
  • The overall length of the director is 927 mm.
  • The spacing between the reflector to the driven elements is 513 mm.
  • The spacing between the driven elements and the director is 308 mm.
  • The cabling is RG58, 50 Ohm or similar. 
  • The delay line is RG58, 342 mm in length.
  • The balun is a clip on ferrite, or 5 to 10 wraps around the rod below the driven elements.
The elements can be made from a 24 mm tape measure, or from 6 mm aluminium tubing from a clothes dry rack or whatever tubing you have on hand.  It will work with almost anything, since the frequency is low.  It is easier if the elements are cut 50 mm longer and trimmed after mounting - for finger and eye safety, trim the corners 45 degrees and wrap the ends with tape.  

The rod can be wood or metal.  Wood is easier to work, but here in the desert, it can be harder to get.  I bought a garden rake with a nice wooden varnished handle for 40 Dirhams and cut the rake off

A beach umbrella stand makes a handy upright support.

The NEC2 Card deck:

CM Yagi, three element, 2 meter band, 146 MHz
CM Elements are made of 1 inch tape measure (r = 12 mm)
CM 40 Ohm, 9 dBi
CM
CM Feedpoint(1) - Z: (12.210 + i 39.873)    I: (0.0070 - i 0.0229)  
CM VSWR(Zo=50 Ω): 6.8:1
CM Max gain: 9.20 dBi (azimuth 90 deg., elevation 0 deg.)
CM Front-to-back ratio: 7.30 dB (elevation 0 deg)
CM
CM Cubesats:
CM 146 MHz Downlink
CM 436 MHz Uplink
CM
CM Speed of light in vacuum = 299792458 m/s
CM Speed factor of RG58/59 = 0.666
CM
CM 2 m band = 146 MHz
CM L = 2053 mm
CM L/2 = 1027 mm
CM L/4 = 513 mm
CM
CM RG58 90 degree phase shifter:
CM L/4 = 513 * 0.666 = 342 mm
CM
CM The wire radius alters the impedance of the dipole:
CM Thicker wire has higher impedance
CM
CM Reflector spacing alters the impedance of the dipole:
CM Closer spacing has lower impedance
CM
CM Length reflector = L/2 = 1027 mm
CM GW 1 5 -0.513 0 0 +0.513 0 0 0.012
CM
CM Spacing = L * 0.25 = 513 mm
CM Length dipole = L/2 * 0.95 = 976 mm
CM GW 2 5 -0.488 0.513 0 +0.488 0.513 0 0.012
CM
CM Spacing = L * 0.15 = 308 mm
CM Y Position = 513 + 308 = 821 mm
CM Length director = Length dipole * 0.95 = 927 mm 
CM GW 3 5 -0.463 0.821 0 +0.463 0.821 0 0.012
CM
CM Excite the 2nd wire in the middle on element 3 of 5 with 1 Volt
CM EX 0 2 3 0 1 0 0 0 0 0 0
CM
CM Frequency 146 MHz
CM FR 0 1 0 0 146 0
CM
CM Radiation plot 360 degrees
CM xnec2c: RP 0,91,120,0,0,0,2,3,0,0,0
CM CocoaNEC: RP 0,91,120,1000,0,0,2,3,5000
CE
GW 1 5 -0.513 0 0 +0.513 0 0 0.012
GW 2 5 -0.488 0.513 0 +0.488 0.513 0 0.012
GW 3 5 -0.463 0.821 0 +0.463 0.821 0 0.012 
GE
EX 0 2 3 0 1 0 0 0 0 0 0
FR 0 1 0 0 146 0
RP 0 91 120 1000 0 0 2 3 5000
EN

Impedance Match

The impedance of a dipole antenna in free space is supposedly 73 Ohm.  The parasitic elements of a Yagi-Uda, reduce the impedance to something closer to 50 Ohm.  You can fine tune the impedance by adjusting the distance between the reflector and the dipole.  The thickness of the elements also affects the bandwidth and the impedance.

In this design, the impedance is about 40 Ohm.  Therefore, it is good to hook the antenna up with RG58, 50 Ohm coaxial cable.

Circular Polarization

Most Satellites spin around to stabilize them (The ISS is an exception).  The result is that the RF transmissions also rotate.  If you would use a fixed dipole antenna to work a satellite, then the signal strength will fluctuate rapidly.  The solution is to use a Right Hand Circular Polarized Antenna.

You can get polarization naturally, with a helical antenna.  Otherwise, you can make a rotating field by setting up a 2 phase electrical motor.  The first phase is the regular signal and the second phase is obtained with a 1/4 wavelength delay line (90 degree phase shift), applied to a second radiator, set at 90 degrees to the first one.  So we use two identical Yagi antennas in a cross/turnstile configuration.

The delay line is simple to calculate using c = L x f, so L = c / f.   The speed of light in RG58 copper wire is 0.666 of c so the 90 degree delay line is shorter: L' = c / f / 4 * 0.666 = 342 mm.

Balun

The coaxial cable is unbalanced, while the dipoles are balanced.  It is therefore necessary to add some inductance to the cable shield, by wrapping five to ten turns around the rod, just below the driven elements.

Alternatively, clamp a ferrite around the cable.  This will prevent the cable shield from radiating and disrupting the antenna pattern.


Conclusion

A tape measure antenna is not rugged and sooner or later a wire connection will break, but the advantage is that one can fold it and get it in and out of a car, making it good for educational use.

Unknown Satellite Signal
A quick check outside showed that it works.  I could see a satellite signal get stronger over a period of time.  Unfortunately it is raining.  It is the middle of the desert and it is a veritable rain storm - a misty drizzle - not good for my computer!

The signal is stable, and doesn't fluctuate, so the circular polarization is working.


La voila!

Herman

Monday, November 20, 2017

SDR and ATC Transponders

Here is the skinny on my ATC transponder ADS-B phun and games. 

Get a SDR receiver for the princely sum of $25, including antennas and tripod here:
https://www.rtl-sdr.com/buy-rtl-sdr-dvb-t-dongles/




Mode A, C and S Transponders at Al Ain Airport

Ubuntu Linux

First try the Ubuntu repos for dump1090 if that is the Linux version you are using:
$ sudo apt install dump1090

and see if you are lucky!


Fedora Linux

Here is what I did to build Malcom Rob's version of dump1090 on Fedora 26:
According to legend, Malcom's is the best one and according to the below, it really is much better than rtl_adsb.

Get the rtl-sdr library, which includes a set of useful basic utilities, including rtl_test, rtl_fm, rtl_tcp and rtl_adsb:
# dnf install rtl-sdr

Get the development files, so we can build other software with this library:
# dnf install rtl-sdr-devel

Get and make Malcom's software:
# cd
# mkdir sw
# cd sw
# git clone git://github.com/MalcolmRobb/dump1090.git
# cd dump1090
# make

 

Test dump1090

Run it with the default settings:
# ./dump1090

and the output looks like this:
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001 (currently selected)
Found Rafael Micro R820T tuner
Max available gain is: 49.60
Setting gain to: 49.60
Exact sample rate is: 2000000.052982 Hz
Gain reported by device: 49.60

*5c89645ebfa547;
CRC: 000000 (ok)
DF 11: All Call Reply.
  Capability  : 4 (Level 2+3+4 (DF0,4,5,11,20,21,24,code7 - is on ground))
  ICAO Address: 89645e
  IID         : II-00

*5d8963c2b9d6d6;
CRC: 000000 (ok)
DF 11: All Call Reply.
  Capability  : 5 (Level 2+3+4 (DF0,4,5,11,20,21,24,code7 - is airborne))
  ICAO Address: 8963c2
  IID         : II-00

*5d8963c2b9d6d6;
CRC: 000000 (ok)
DF 11: All Call Reply.
  Capability  : 5 (Level 2+3+4 (DF0,4,5,11,20,21,24,code7 - is airborne))
  ICAO Address: 8963c2
  IID         : II-00

*0000019480b06c;
CRC: 8963c2 (ok)
DF 0: Short Air-Air Surveillance.
  VS             : Airborne
  CC             : 0
  SL             : 0
  Altitude       : 1500 feet
  ICAO Address   : 8963c2

*00050194ba3529;
CRC: 8963c2 (ok)
DF 0: Short Air-Air Surveillance.
  VS             : Airborne
  CC             : 0
  SL             : 0
  Altitude       : 1500 feet
  ICAO Address   : 8963c2


Old Transponder Modes

$ ./dump1090 --modeac --
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001 (currently selected)
Found Rafael Micro R820T tuner
Max available gain is: 49.60
Setting gain to: 49.60
Exact sample rate is: 2000000.052982 Hz
Gain reported by device: 49.60
*6041;
SSR : Mode A/C Reply.
  Mode A : 6041

*0130;
SSR : Mode A/C Reply.
  Mode A : 0130
  Mode C : 2400 feet

*6041;
SSR : Mode A/C Reply.
  Mode A : 6041

*0110;
SSR : Mode A/C Reply.
  Mode A : 0110
  Mode C : 2300 feet


Interactive Mode

To get a display as at the top of the page:
$ ./dump1090 --enable-agc --modeac --interactive --aggressive

 


Macintosh

I finally got ADS-B to work on my Macbook Pro with a combination of rtl_tcp and cocoa1090.


This is the best radio test tool I've ever bought and it is very useful for acceptance testing and fault finding of radio equipment in a laboratory, hangar, apron or helipad.  

Consider that a Keysight spectrum analyzer costs $30,000 and cannot do half of what this $20 hoosammawatzit does...


-. --- / .-- .. -. -.. --- .-- ... --..-- / -. --- / -.-. .-. -.--

Cheers,

Herman

Monday, November 13, 2017

Software Defined Radios With a Macbook Pro

I finally succumbed to the temptation and bought a couple of RTL SDR dongles.  These thingies are so cheap, they really open the art of amateur radio to the masses again.


CubicSDR on a Macbook Pro

These gadgets are wide band digital receivers, which make them much fun.  Effectively, RTL-SDR with CubicSDR provides you with a wide band DIY Spectrum Analyzer that works from about 1 MHz all the way up to about 3 GHz.

Read all about RTL-SDR here:
https://www.rtl-sdr.com/

If you have no idea what to do with SDR toys, go here:
https://www.hfunderground.com/board/

or here:
https://amsat-uk.org/funcube/funcube-dongle-sdr/

or, of course here:
http://www.aeronetworks.ca/2017/07/cube-satellites.html

BTW, if you use Linux or BSD, skip to the bottom of the page.

Where to Buy an SDR Widget

Get your own RTL-SDR kit for the enormous sum of $26 here:
https://www.rtl-sdr.com/buy-rtl-sdr-dvb-t-dongles/

For a proper transceiver, you can get the HackRF wotzit at Sparkfun, but it costs a rather more hefty amount - about 10x more:
https://www.sparkfun.com/products/13001

Receiver Software

On my Macbook Pro, the CubicSDR program works like magic.  I can sincerely recommend using it:
http://cubicsdr.com/

There are a few things I would like to do with these SDR thingies:
  • Hook to my BitX40 radio to verify the HF performance at 7 MHz, 
  • Listen to ATC aircraft band radio at 118 to 136 MHz and 
  • Decode ADSB from ATC transponders at 1090 MHz.
  • Decode GPS at 1575.42 MHz
The receiver is wide band so things fold back, which makes it a bit confusing, but even the simplest antenna will pull in many FM stations.  I would recommend using a tuned antenna for HF listening though.

AM and FM Radio

So far I managed to tick off the BitX40 (and Abu Dhabi Classic!) with CubicSDR.  This should also work with the ATC voice radio band, I just haven't gotten round to trying it yet.

Get rtl-sdr With Macports

The CubicSDR program can do everything I want with this widget, but the command line utilities mentioned above can also be very handy, especially when you want to log data for later analysis. 

The rtl-sdr package provides the following command line utilities:
  • rtl_adsb: a simple ADS-B decoder
  • rtl_eeprom: an EEPROM programming tool
  • rtl_fm: a narrow band FM demodulator
  • rtl_sdr: an I/Q recorder
  • rtl_tcp: an I/Q spectrum server
  • rtl_test: a benchmark tool
  • rtl_power: a spectrum analyzer
So, I used Macports https://www.macports.org/ and updated it, since I already have it installed:

$ sudo port -v selfupdate
sudo: port: command not found

Aargh...

Why is everything so clunky on my Mac?  I can add /opt/local/bin to the path, but that is also a security concern.

Let's try again, this time with the full path to the utility:
$ sudo /opt/local/bin/port -v selfupdate

and this time it worked.

Try to install the rtl-sdr package:
$ sudo /opt/local/bin/port install rtl-sdr
Error: The installed version of Xcode (7.3) is too old to use on the installed OS version. Version 8.2.1 or later is recommended on Mac OS X 10.13.

Bah, humbug...

Open the App Store, search for xcode and Get it all over again, which of course takes foreeever (TM)...  So I clicked the Caffeine coffee cup to keep the Mac from going to sleep and let it upgrade overnight.

Then try to install the rtl-sdr package again:
$ sudo /opt/local/bin/port install rtl-sdr
--->  Computing dependencies for rtl-sdr
The following dependencies will be installed:
 bison
 bison-runtime
 bzip2
 cmake
 ...
Continue? [Y/n]: y

...
Fetching - installing... getting somewhere now!

What hath god wrought?
$ ls /opt/local/bin/rtl*
/opt/local/bin/rtl_adsb        /opt/local/bin/rtl_power    /opt/local/bin/rtl_test
/opt/local/bin/rtl_eeprom    /opt/local/bin/rtl_sdr
/opt/local/bin/rtl_fm        /opt/local/bin/rtl_tcp


OK, let's test it.

Plug the widget in and:
$ /opt/local/bin/rtl_test
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
[R82XX] PLL not locked!
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...
^CSignal caught, exiting!

User cancel, exiting...
Samples per million lost (minimum): 0


ATC Transponders and rtl_adsb

So the test passes, now try to receive ADS-B data:
$ /opt/local/bin/rtl_adsb
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuned to 1090000000 Hz.
Exact sample rate is: 2000000.052982 Hz
Sampling at 2000000 S/s.
*8d896c9399001756282f02516497;
*8d7609895839c7f3dc483eb47eca;
*aec00327548cc8385eb439daf3df;
*a00012113000020000080047fe32;
*a82001910201000000000028ab15;

...

OK, now to make it a little more friendly...

When all else fails, read the manual:
$ /opt/local/bin/rtl_adsb --help
/opt/local/bin/rtl_adsb: illegal option -- -
rtl_adsb, a simple ADS-B decoder

Use:    rtl_adsb [-R] [-g gain] [-p ppm] [output file]
    [-d device_index (default: 0)]
    [-V verbove output (default: off)]
    [-S show short frames (default: off)]
    [-Q quality (0: no sanity checks, 0.5: half bit, 1: one bit (default), 2: two bits)]
    [-e allowed_errors (default: 5)]
    [-g tuner_gain (default: automatic)]
    [-p ppm_error (default: 0)]
    [-T enable bias-T on GPIO PIN 0 (works for rtl-sdr.com v3 dongles)]
    filename (a '-' dumps samples to stdout)
     (omitting the filename also uses stdout)

Streaming with netcat:
    rtl_adsb | netcat -lp 8080
    while true; do rtl_adsb | nc -lp 8080; done
Streaming with socat:
    rtl_adsb | socat -u - TCP4:sdrsharp.com:47806


So, let's try again, this time verbose and with short messages also:
$ /opt/local/bin/rtl_adsb -g49 -V -S
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to 49.60 dB.
Tuned to 1090000000 Hz.
Exact sample rate is: 2000000.052982 Hz
Sampling at 2000000 S/s.
*7918f0d9ca82d6;
DF=15 CA=1
ICAO Address=18f0d9
*57052d75970122;
DF=10 CA=7
ICAO Address=052d75
*530c80731ead47;
DF=10 CA=3
...


Apparently, there are bazillions of planes in the desert sky, but if I look up, I cannot see any! 

Now I need to figure out how to list/map the planes with dump1090 or cocoa1090.

Cocoa1090 for ADS-B Transponders

For Air Traffic Control transponder ADS-B information, I experimented with Cocoa1090:
http://www.blackcatsystems.com/software/cocoa1090.html

Start the rtl_tcp server first and connect to the dongle, then run cocoa1090.


The frequency is of course 1.090 GHz, so a half wave dipole antenna needs to be 275 mm overall, or each 1/4 wave arm needs to be138 mm.  Grab a ruler and tweak the telescopic antenna that you got with the SDR for best results.

ADS-B for Linux Lovers

You need to do one of the following:
$ sudo apt install rtl-sdr
$ sudo apt-get install rtl-sdr
# dnf install rtl-sdr

You can get Malcolm Robb's dump1090 from github.  If you need to ask how, then you have to hand your Geek card back.

ADS-B for BSD Devils

All that FreeBSD devil worshippers need to do is:
# pkg install install rtl-sdr
# pkg install dump1090
# dump1090 --net --aggressive


Then, point a webserver at http://localhost:8080/ and watch...

The OpenBSD Calgary Cowboys are SOL though - it doesn't work fully.

Antennas

The RTL SDR wotzit works perfectly from inside my house with just a simple little dipole antenna.   It is very sensitive, so you don't need any fancy antennas, unless you want to do HF DX.


-. --- / .-- .. -. -.. --- .-- ... --..-- / -. --- / -.-. .-. -.--

Cheers,

Herman

Monday, October 23, 2017

The Clue by Four, 40 m band Helical Dipole Antenna

Not Enough Spots

Thanks to the current low sun spot cycle, the 40 meter band arguably provides the best HF radio propagation.  The problem with this band, is that a half wave dipole wire antenna is 20 meters long.  If you string that from a mast or a tree, you may need 30 to 40 meters of space for the wire and ropes.  Most modern backyards are not that large.

One solution is to upgrade to a Country Manor House, but for most radio amateurs, that would be too much lawn to mow.  On the other hand, fitting a 40 meter band dipole into the attic of a regular sized home or cottage, certainly seems impossible, but it is actually quite easy: Curl the dipole up into a helix!

Clue Up On Helixes

The following NEC card stack defines a dipole made from two helixes, wound around a 5 meter length of "Two by Four" lumber, for a 75% overall size reduction, which should fit into the attic of most homes.

"Two by Four" lumber is actually 1.5 by 3.5 inches, or 38 by 89 mm in size.  With each arm of the dipole a 2.5 meter helix, wrapping it with ten meters of wire results in 39 turns per arm, for a spacing of 64 mm.  Hammer some 1/2 inch panel nails into the lumber to help you keep the windings even, use a couple hundred thumb tacks, or glue the wire down with a glue gun.  Keep it simple - using glue should be less painful than thumb tacks.

An alternative is 4 inch PVC drain pipe.   It costs more, but may look nicer.  Note that the outside diameter of 4 inch pipe is 4.5 inches (114.3 mm). The radius is therefore 57 mm in both x and y axes.

Kraus Helical Antenna Designer

The helical antenna work published by Kraus in 1948, shows that a thin helix radiates in normal mode, while a fat helix radiates in axial mode.  This space efficient dipole is made from two thin helix antennas tied back to back.

The NEC2 GH card defines the helix on the z-axis, which appears vertical in the simulator, but in practice one would install this antenna horizontally.  The GM card is used to rotate and copy the helix around the y-axis to make a curled up dipole.  Because this is a thin helix, the radiation is normal to the z-axis, the same as with a straight wire dipole.

You can model the antenna with CocoaNEC on a Mac, or with xnec2++ or xnec2c on Linux or BSD as described in another post.


Here is the Clue by Four Antenna Model:

CM Clue By Four Attic Antenna
CM Fit a 40 meter band, 7 MHz, HF dipole antenna into your attic
CM Copyright reserved, Herman Oosthuysen, 2017
CM Copyleft defined by the FSF GPL v2
CM
CM 40 meter helical dipole, for 5 meter, 2 by 4 lumber
CM A 2 by 4 is actually 1 1/2 by 3 1/2 inch, or 38 x 89 mm
CM 1/10th wavelength is 4 m
CM 1/1000th wavelength is 40 mm
CM Max Segments is 10,000 / 40 mm = 250
CM Radius is 19 x 44.5 mm
CM Circumference is 38 x 2 + 89 x 2 = 254 mm
CM Turns is 10,000 mm / 254 mm = 39.37 turns
CM Length is 2500 mm
CM Spacing is 2500 mm / 39 turns = 64 mm
CE
GH 1 250 6.40E-02 2.50E+00 1.90E-02 4.45E-02 1.90E-02 4.45E-02 1.00E-03
GM 1   1        0      180        0        0        0        0        0
GE
FR     0     0     1      0  7.00E+00         0         0         0         0         0
EX     0     0     1      0  1.00E+00  0.00E+00  0.00E+00  0.00E+00  0.00E+00  0.00E+00
RP     0    91   120   1000         0         0         2         3      5000
EN 



The antenna pattern of the twin helix is a regular dipole doughnut with a gain of about 1.5 dBi and an impedance of about 90 Ohm:


The Clue By Four Helical Dipole Antenna

Don't fret too much about the design of a wire antenna.  Use NEC to show that it works, then build it and add a simple little antenna tuner to it, as described at the bottom of this page http://www.aeronetworks.ca/2017/08/hf-radio-bitx40.html.

Now you can enjoy some DXing, without risking life and limb climbing trees, or erecting masts, while the antenna is protected against the elements, safe and snug inside the roof of your home.

Slinky Springs

Slinky Spring antennas have been around since forever, but steel wire will not work as well as copper wire and a slinky will rust and degrade rather quickly.  The main thing with a DIY helical antenna is to check the design with NEC before you build it - vary the length of wire, number of turns and do a frequency sweep to get a feel for it.

The feeling I got, was that most designs on the wild wild web use too much wire and try to compress the overall length too much.  If it doesn't work well in simulation, then it won't work well in practise either!

You can use the same trick for the 80 or 20 meter bands, to fit all your HF wire antennas into whatever space you have available and wind your dipoles around a piece of lumber, or a plastic drain pipe.  The result should be a good alternative to the classic flagpole, or downspout antennas.

Groundless Rhetoric

You can also use a helix for a 1/4 wave vertical flagpole antenna, but there seems to be a radial wire fetish or something in ham circles.  Every discussion on verticals, have long stories about how to lay radial grounds in a lawn, using hundreds of meters of costly wire.

If you simulate a vertical in NEC, then you need a ground plane, or radial wires for the purpose of the simulation, but in reality you have the earth, which is a pretty good earth, really!

Unless you are living in a sandy desert (like me) you should not need radial wires.  Hammer a 1.5 meter lightning rod ground spike into the earth and be done with it.  Instead of digging trenches, go fishing or watch a ball game.  If the ground is dry, change the timer dial on your lawn sprinkler system and if you do live in a desert like me, a chicken wire mesh is way cheaper than copper wire radials...

Tuners and Traps

Someone asked whether one could make a multi-band antenna this way. 

A simple way to make a 40/80 meter antenna would be to wind a second set of identical helixes and attach them through 10 uH inductors to lengthen the dipole for 80 m operation.  A ~10 uH inductor is simply ten tight turns around the two by four http://hamwaves.com/antennas/inductance.html.

In any case, you need a tuner on this type of antenna, since it is rather inductive (the shorter you make it, the more inductive it becomes) and it needs to be hooked to your radio through a L-match antenna tuner as shown at the bottom of this post http://www.aeronetworks.ca/2017/08/hf-radio-bitx40.html.


La Voila!

Herman