I have a docking station for autonomous drones in the field. It is equipped with a Raspberry Pi, an 1090 MHz ADS-B stick, and it knows it's geometric position from a previously done precise measurement. This station needs to maintain a cylindrical "flight security zone" around itself. Whenever an aircraft breaches this zone, security measures are taken. Furthermore...

  • the zone's exact dimensions are not known yet, but we can assume a diameter of around 5km and a height of around 200-300m.
  • within the zone, the measurements of aircraft positions should be "as precise as possible". Outside the zone, I don't really care
  • the measurements need to work for every aircraft, optional messages only certain aircrafts send are not an option.

My Question in a nutshell

How can I measure the distance between an aircraft and myself, and what would be the most precise way to do it?

My ideas so far

I have used dump1090 to receive ADS-B messages from the stick, which returns them in raw- or SBS-1 format.

The horizontal distance from my station to the aircraft should be deductable in sufficient precision from the ADS-B messages, I guess. An SBS-1 message, for example, contains the already calculated WGS84 coordinates.

The vertical distance is a bigger problem. As I understand, ADS-B works with pressure altitude referenced to standard pressure. That leaves me with two options:

  • Integrate a barometer into my setup and correct the aircraft's altitude with reference to my local pressure.
  • ADS-B also mentions a message with GNSS height (Type Code 20-22), but I can't seem to find any info about when to expect it. Is is completely optional, is it mandatory below transition height...?

Are my general assumptions correct? Are there other possibilities?

Thanks in advance

Edit 1:

Note that if there are rare and "unusual" occurances where planes might not identify themselves via ADS-B, like military machines that don't use ADS-B for reasons of camouflage, or planes with broken transponders, then these occurances can be ignored. I realize that, with just an RPi and an ADS-B stick, my capabilities are limited. But whenever a plane (passenger or sport) or a helicopter (police, rescue...) comes by, I'd like to know it.

  • $\begingroup$ the measurements need to work for every aircraft, optional messages only certain aircrafts send are not an option”. That effectively rules out ADS-B. Even in places where it’s mandatory there are still a number of exceptions, and of course there could be malfunctions. In which country/region are you? $\endgroup$
    – jcaron
    Commented Mar 29 at 10:08
  • 1
    $\begingroup$ As jcaron points out, this will not work. If you absolutely need an area completely free of air traffic, you need to work with the local aviation authorities to set up a (temporary) restricted area $\endgroup$ Commented Mar 30 at 7:05
  • $\begingroup$ We're talking about germany and I was under the impression that an ADS-B transponder is mandatory nowadays. How do the authorities or airports know who's currently flying, do they have a different technology? Please also take note of my edit. $\endgroup$ Commented Mar 30 at 12:52
  • $\begingroup$ @user3792852 -- just for completeness you might want to google up the regs for gliders (sailplanes). I'm not sure whether they are required to have transponders and ADS-B out in Germany or not. Likewise ultralights or microlights. I do understand that you know you will never cover all possibilities, but just something to consider. $\endgroup$ Commented Mar 30 at 15:08
  • 1
    $\begingroup$ In some airspace classes you can fly without any transponder at all (ADS-B or otherwise) $\endgroup$ Commented Mar 31 at 7:32

3 Answers 3


As you say, horizontal distance can be easily deduced from ADS-B messages.

ADS-B can use multiple different sources for position. If it's using GNSS (as most are), it should be transmitting its geometric altitude in addition to its barometric altitude. If it is using DME/DME, for instance, it will not report geometric altitude.

Your options for barometric altitude are to integrate a barometer or to do the same thing airplanes do and get a local altimeter setting. This could be done manually with a handheld radio or automatically if local METARs are available online.

Using both altitudes and taking the closest one is the most conservative approach. If only using one, you should use the barometric altitude and correct for non-standard pressure.

Keep in mind that Europe does not mandate ADS-B for light aircraft flying VFR, which are the aircraft most likely to be so low! So you absolutely cannot rely on ADS-B as your sole source of manned aircraft avoidance.

  • $\begingroup$ It's starting to look like ADS-B is only for large passenger aircrafts. As for medical-, police- or sport aircrafts, no one really knows where they are exactly when airborne. Everything just happens on sight. Is that about right? $\endgroup$ Commented Apr 1 at 16:33
  • $\begingroup$ @user3792852 Not just sight- most aircraft will at least have a mode S transponder so ATC and to some degree other aircraft will know where they are. With several receivers spread over a geographic area it's possible to triangulate such aircraft by timing measurements of their mode S responses. But this only works if the aircraft are in range of a radar facility- mode S responses are only sent in response to interrogations sent to them by a radar facility or other aircraft. $\endgroup$
    – Chris
    Commented Apr 1 at 17:38

A certified and correctly functioning ADS-B transmitter sends position, (usually GPS derived), pressure altitude and geometric height above WGS84 ellipsoid.

If you know your receiver's position and height (above ellipsoid, not MSL) and you can get the geometric height from ADS-B, then it is easy to solve your problem.

The geometric height is normally encoded as difference from pressure altitude. It is contained in the velocity messages. See EUROCAE ED102A or RTCA DO-260B for encoding details.

But beware! Many aircraft in German lower airspace are not equiped with ADS-B transmitters, and those that are equiped may not perform as advertised. Notable examples of non ADS-B aircraft are part of the Medical Helicopter and Police fleet, and those can be expected to fly low and fast.

Don't think that because you have an ADS-B receiver you can fly drones safely and legally. Flying autonomous drones is not allowed in Germany, as far as I know. Look at Germany's DIgital Platform for Unmanned aviation DIPUL for more information about regulations and maps of geozones.

  • $\begingroup$ Nothing is illegal if the authorities grant you permit for it. We're currently in the process of acquiring said permit, and it would help our cause if we had a means of surveilling the airspace around our drones. $\endgroup$ Commented Apr 1 at 16:25
  • $\begingroup$ In that case: I am really happy to hear that you are planning going down the legal road. I would not use an in-house developed surveillance solution based on ADS-B alone, but instead use a combination of official surveillance sources, perhaps combined with local additional sensors to fill gaps (depending on where you are planning to fly). If you can tell a bit more about your project I may be able to help you further. $\endgroup$
    – DeltaLima
    Commented Apr 1 at 18:16

To properly close this topic, here is what I ended up doing:

Note, however, that this problably makes no practical sense. Since the area to be controlled is not a special airspace, aircrafts below 5,7 tons MTOW and 250 knots aren't required to use ADS-B. The messages I will mostly receive will be coming from airliners, which will be way above my area of interest (Correct me if there is anything wrong here).

I start dump1090 with the following parameters:

./dump1090 --net-only --interactive

Now I can open a TCP port on localhost:30003 and receive messages in SBS1 format. This is the lazy approach, as this format is easiest to parse.

Furthermore, I integrated a barometer into my setup. The SBS1 messages contain the pressure altitude according to the standard atmosphere in feet, so I measure my pressure altitude in feet using the following python code:

local_pressure = get_barometer_reading()
my_alt = 145366.45 * (1 - (local_pressure / 1013.25)^0.190284)

The formula to calculate the pressure altitude was taken from here.

The value my_alt is subtracted from the aircraft's altitude and I have the height difference.

  • $\begingroup$ I haven't checked your implementation, but this approach should work. In addition you could use the geometric height as well, but then you need to use a different format (SBS-1 didn't include that info IIRC). $\endgroup$
    – DeltaLima
    Commented Apr 8 at 18:35
  • $\begingroup$ But still, I won't recommend relying on ADS-B alone for the type of project you are doing. You may be able to get access to a stream of surveillance data from ATC for your area of operations. Can you tell more about the kind of operation you are planning to do, and what type of airspace it is in? I especially interested because I am professionally involved in integrating Unmanned Aviation in the airspace. $\endgroup$
    – DeltaLima
    Commented Apr 8 at 19:19
  • $\begingroup$ The airspace is uncontrolled and the drones will be operating at a height of 30-50 metres. Is there anything specific you'd like to know? $\endgroup$ Commented Apr 14 at 6:45
  • $\begingroup$ Thank you for getting back to me! What is the nature of the operation? Surveillance, transport, agriculture? Is it in urban area, near an urban area? Can you tell me where it is? $\endgroup$
    – DeltaLima
    Commented Apr 14 at 14:23
  • $\begingroup$ It will mainly be surveillance of larger industrial areas with little to no people underneath. Please understand that I cannot give any more details, as this would compromise security. $\endgroup$ Commented Apr 19 at 12:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .