Ayan Pahwa

View Original

How To - ADSB Flight tracker using Software Defined Radio

Future Drones becoming much safer | How To - ADSB Flight tracker using SDR


DJI the renowned drone manufacturer from China has recently announced that all there future drones weighing over 250g will come with a new technology they are calling DJI Airsense. Airsense will allow drones to track and locate airborne airplanes and helicopters in near vicinity and prevent any sleek chances of crashes.

Drone sighting by commercial airline pilots, Air traffic controller or other airport related authorities in recent time have become a very common incident and have caused a lot of panic in major airports around the world causing disruption, loss of money and time to the airline operators and travellers. The most recent one was from Gatwick Airport resulting in closing of the airport’s runway affecting 140,000 passengers and 1,000 flights. The situation is straightforward, a commercial airline pilot sees a Drone flying in common airspace with no prior knowledge of it from air traffic controller is treated as a potential threat to the airplane in case of a collision, hence emergency code calls causing distress to everybody.

The question is can a drone really cause serious damage to airplane causing fatal accidents? The answer is yes and if you want to see to what extend then watch this video where researchers have emulated an environment where a DJI Phantom drone is being collided with an airplane in as close to real life situation as possible being emulated in a lab.


Now let’s talk about how the DJI Airsense can prevent chances of such fatal accidents or avoiding drone being in a path of airplane, but first let’s watch the official video from DJI:

As seen in this video, according to DJI they are using something known as ADS-B or Automatic Dependent Surveillance—Broadcast to track the planes and notify the drone pilot. ADSB is designed for planes and helicopters to broadcast their real-time live data such as Speed, Heading, Flight name, etc and using this data Airsense can calculate if the drone is likely to be in path of any airplane and notify the pilot before hand so the pilot can lower the altitude, land the drone or change it’s heading which IMO is really smart and safe way going forward.

To more geeks who wish to know how ADSB plane tracing works in depth please continue reading down below:

So it’s intriguing for me to know DJI Airsense can track planes and use the data and analytics on it to notify pilot of any potential hazard situation, hence I decided to check out the inner working for myself. For a long time I am having a device called SDR or Software Defined Radio receiver. Also sometimes dubbed as RTL-SDR because the common one using the chipset from Realtek(RTL) not the Register Transfer Level (Another common full form of RTL). If you have seen old analog radios used to receive AM and FM signals, the first thing you must have noticed are the huge rotary dials using which we tune the radio receiver to catch a certain frequency and tune to thr desired radio channel. The inner working of that radio are sets of Potentiometer or Rheostats(Variable resistor) hooked to operational amplifiers or voltage to frequency converters and by rotating the knob of those potentiometer we change gains of amplifiers hence tuning to different channels at different resistance value. That was the time of analog world with analog circuits.

Now a days world works on 1s and 0s and we have gotten into the habit of involving tiny computers everywhere so how do we achieve same functionality of old radio receivers using digital electronics? Enter Software Defines Radio, where you tune the radio using a software program being run from your computer, how cool can it be?

  • For starters you can visualise the radio signals in air around you

  • You can sniff radio signals like one coming out of your car’s keyfob

  • Or you can track planes near you, because planes are always transmitting their data on 1090Mhz frequency which you can pick by tuning your SDR to listen to that frequency.

BINGO! Now we know the working so let’s try on our own. For this experiment I’m using a very basic RTL-SDR Dongle which I picked from Amazon . Not everyone would work the same ways so pick this very one just to be sure.

Background - Planes have ADS-B transponders installed which automatically transmits it’s data like GPS Coordinates, speed, heading on 1090Mhz frequency, so we gonna pick this using our SDR Dongle.

The Steps:

  • Connect Dongle to PC or SBC like Raspberry Pi (Linux/OSX preferred. Windows will work too but we don’t use it here :P )

  • Install necessary drivers

    • Use your package manager to install librtlsdr pkg-config

  • Download and setup required software

    • git clone https://github.com/iayanpahwa/dump1090.git

    • cd to it and run ‘make’

    • make a tmp folder to dump temp data “mkdir -p /usr/local/var/dump1090-mut-data“

  • Set-up the antenna

  • Run ADS-B tracker software to tune SDR on 1090Mhz frequency

    • Find latitude and longitude of your area and run below command using that

    • ./dump1090 --interactive --net --lat <YOUR LATITUDE> --lon <YOUR LONGITUDE> --modeac --mlat --write-json /usr/local/var/dump1090-mut-data

  • Track the planes and visualise on a map

    • Install nginx web server and create a config file at /usr/local/etc/nginx/servers/dump1090

    • Copy content from ngnix_config.txt to /usr/local/etc/nginx/servers/dump1090 and change path according to your project

    • Start nix service using your init system, in my case brew services start nginx

  • See what data we can get.

    • Go to your browser, url localhost:8081 to see the interactive map

  • Wait for a plane to come nearby and see it’s data

`

I hope you enjoyed reading this blog post and learned something new. You can watch my video on same