With a Software Defined Radio you can pick up all kinds of interesting signals with cheap commercial hardware. A RTL dongle is easily obtained online and can be connected to a Raspberry Pi to create a platform for experiments. I used an RTL2832 dongle for this project, although there are several options available as listed on the RTL-SDR website.
Living in a coastal city such as Sydney, you experience several aspects of life on the shore - the sea breeze, sea gulls, and of course, ships. Ships at sea broadcast AIS (Automatic Identification System) messages every few minutes when underway. They also broadcast messages when at port at a slower frequency. The AIS system aids navigation - other vessels can use this information to plot their courses, avoiding collisions.
This project uses the RTL dongle to listen to these signals and track ships as they move into and out of the Sydney harbour.
In particular I wanted to count the traffic under the harbour bridge and to Circular Quay (the geofenced area below). In addition, having access to a location with line of sight to the area in question, I wanted to photograph the ships exactly as they passed under the harbour bridge and in front of the opera house.
Using the GPS coordinates from the AIS messages broadcast by ships every couple of minutes when they are underway, it is easy to compute if the ship is inside the geofence or not, and record the time a vessel enters the geofence. And entering the geofenced area can be used as a trigger to start a capture.
There were several challenges getting this up and running: I used a Raspberry Pi Zero W as the basis of the platform, and this was simply not powerful enough to run the project reliably. In addition the tiny Pi Zero takes a very long time to compile the libraries needed - doing anything in the SDR world requires a lot of compiling c++ libraries.
The little Pi's CPU runs absolutely flat out trying to process the radio - after all it is Software defined - taking up 100% of all cores and occasionally crashing the driver of the RTL dongle.
The Raspberry Pi camera, though cheap, isn't the best for taking pretty pictures - particularly when you're only interested in a small portion of the image being captured. The sensor outputs grainy, blurry images.
After putting a restart script in place to recover from crashes,I ran the project for a few weeks and got some good captures of ships transiting the Sydney Opera House.
The data reported by the ships themselves was not always accurate, with some jumps in position that needed to be filtered out. The Sydney harbour also has massive traffic - and most of the vessels are too small to photograph with the Raspberry Pi camera, so ships big enough to photograph need to be filtered out.
In theory the AIS messages themselves carry information such as the ship's dimensions, draught, name, and even destination port. In practice, this information is self-reported with no real standards, and the information (other than the MMSI identifier and the GPS co-ordinates) is often wildly inaccurate. I attempt to filter out ships smaller than 80 metres in length to reduce the number of false captures although this often fails because not all ships report accurate sizes.
Overall the results from relatively cheap hardware were quite impressive. The RTL hardware combined with a raspberry pi can enable a massive number of possibilities, allowing readings from everything ranging from weather balloons and aircraft to smart electricity meters.
The source can be found in this Github repository
Next steps: Leave this running on a more permanent basis and put up a UI to show this data.«Back to homepage