Skip to content

Commit 7ca5a4b

Browse files
committed
Initial commit of Dump1090, a simple Mode S decoder.
0 parents  commit 7ca5a4b

File tree

6 files changed

+1591
-0
lines changed

6 files changed

+1591
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.o
2+
mode1090
3+
testfiles/test*.bin

Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
LIBUSB_INC_PATH=/usr/local/Cellar/libusb/1.0.9/include/libusb-1.0
2+
LIBUSB_LIB_PATH=/usr/local/Cellar/libusb/1.0.9/lib
3+
LIBRTLSDR_INC_PATH=/usr/local/Cellar/rtlsdr/HEAD/include
4+
LIBRTLSDR_LIB_PATH=/usr/local/Cellar/rtlsdr/HEAD/lib
5+
LIBS=-lusb-1.0 -lrtlsdr -lpthread -lm
6+
CC=gcc
7+
PROGNAME=mode1090
8+
9+
all: mode1090
10+
11+
mode1090.o: mode1090.c
12+
$(CC) -O2 -g -Wall -W -I$(LIBUSB_INC_PATH) -I$(LIBRTLSDR_INC_PATH) mode1090.c -c -o mode1090.o
13+
14+
mode1090: mode1090.o
15+
$(CC) -g -L$(LIBUSB_LIB_PATH) -L$(LIBRTLSDR_LIB_PATH) -o mode1090 mode1090.o $(LIBS)
16+
17+
clean:
18+
rm -f *.o mode1090

README

+207
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
Dump1090 README
2+
===
3+
4+
Dump 1090 is a Mode S decoder specifically designed for RTLSDR devices.
5+
6+
The main features are:
7+
8+
* Robust decoding of weak messages.
9+
* Single bit errors correction using the 24 bit CRC.
10+
* Ability to decode DF11, DF17 messages.
11+
* Ability to decode DF formats like DF0, DF4, DF5, DF16, DF20 and DF21
12+
where the checksum is xored with the ICAO address by brute forcing the
13+
checksum field using recently seen ICAO addresses.
14+
* Decode raw IQ samples from file (using --ifile command line switch).
15+
* Interactive mode where aircrafts currently detected are shown
16+
as a list refreshing as more data arrives.
17+
18+
Installation
19+
---
20+
21+
Edit the Makefile and set the following variables according to your system:
22+
23+
LIBUSB_INC_PATH=/usr/local/Cellar/libusb/1.0.9/include/libusb-1.0
24+
LIBUSB_LIB_PATH=/usr/local/Cellar/libusb/1.0.9/lib
25+
LIBRTLSDR_INC_PATH=/usr/local/Cellar/rtlsdr/HEAD/include
26+
LIBRTLSDR_LIB_PATH=/usr/local/Cellar/rtlsdr/HEAD/lib
27+
28+
Then save the modified Makefile and type "make".
29+
30+
Normal usage
31+
---
32+
33+
To capture traffic directly from your RTL device and show the captured traffic
34+
on standard output, just run the program without options at all:
35+
36+
./dump1090
37+
38+
To just output hexadecimal messages:
39+
40+
./dump1090 --raw
41+
42+
To run the program in interactive mode:
43+
44+
./dump1090 --interactive
45+
46+
In iteractive mode it is possible to have a less information dense but more
47+
"arcade style" output, where the screen is refreshed every second displaying
48+
all the recently seen aircrafts with some additional information such as
49+
altitude and flight number, extracted from the received Mode S packets.
50+
51+
Using files as source of data
52+
---
53+
54+
To decode data from file, use:
55+
56+
./dump1090 --ifile /path/to/binfile
57+
58+
The binary file should be created using rtl_sdr like this (or with any other
59+
program that is able to output 8-bit unsigned IQ samples at 2Mhz sample rate).
60+
61+
rtl_sdr -f 1090000000 -s 2000000 -g 50 output.bin
62+
63+
In the example rtl_sdr a gain of 50 is used, simply you should use the highest
64+
gain availabe for your tuner. This is not needed when calling Dump1090 itself
65+
as it is able to select the highest gain supported automatically.
66+
67+
It is possible to feed the program with data via standard input using
68+
the --ifile option with "-" as argument.
69+
70+
Additional options
71+
---
72+
73+
Dump1090 can be called with other command line options to set a different
74+
gain, frequency, and so forth. For a list of options use:
75+
76+
./dump1090 --help
77+
78+
Everything is not documented here should be obvious, and for most users calling
79+
it without arguments at all is the best thing to do.
80+
81+
Reliability
82+
---
83+
84+
By default Dump1090 tries to fix single bit errors using the checksum.
85+
Basically the program will try to flip every bit of the message and check if
86+
the checksum of the resulting message matches.
87+
88+
This is indeed able to fix errors and works reliably in my experience,
89+
however if you are interested in very reliable data I suggest to use
90+
the --no-fix command line switch in order to disable error fixing.
91+
92+
Performances and sensibility of detection
93+
---
94+
95+
In my limited experience Dump1090 was able to decode a big number of messages
96+
even in conditions where I encountered problems using other programs, however
97+
no formal test was performed so I can't really claim that this program is
98+
better or worse compared to other similar programs.
99+
100+
If you can capture traffic that Dump1090 is not able to decode properly, drop
101+
me an email with a download link. I may try to improve the detection during
102+
my free time (this is just an hobby project).
103+
104+
Antenna
105+
---
106+
107+
Mode S messages are transmitted in the 1090 Mhz frequency. If you have a decent
108+
antenna you'll be able to pick up signals from aircrafts pretty far from your
109+
position, especially if you are outdoor and in a position with a good sky view.
110+
111+
You can easily build a very cheap antenna following the istructions at:
112+
113+
http://antirez.com/news/46
114+
115+
With this trivial antenna I was able to pick up signals of aircrafts 200+ Km
116+
away from me.
117+
118+
Debug mode
119+
---
120+
121+
The Debug mode is a visual help to improve the detection algorithm or to
122+
understand why the program is not working for a given input.
123+
124+
In this mode messages are displayed in an ASCII-art style graphical
125+
representation, where the individial magnitude bars sampled at 2Mhz are
126+
displayed.
127+
128+
An index shows the sample number, where 0 is the sample where the first
129+
Mode S peak was found. Some additional background noise is also added
130+
before the first peak to provide some context.
131+
132+
It is possible to display different categories of messages:
133+
134+
--debug 1 Displays all the messages correctly demoudulated.
135+
A correctly demodulated message is just one that
136+
makes sense as a Mode S message, the preamble makes
137+
sense, and there are no message errors, that is,
138+
no adiacet samples describing bits are the same
139+
magnitude.
140+
141+
--debug 2 Only messages with demodulation errors are displayed,
142+
That is, only messages where one or more adiacent
143+
samples that should describe bits are the same
144+
magnitude.
145+
146+
--debug 3 Correctly deooded messages with Bad CRC are displayed.
147+
148+
--debug 4 Correctly deooded messages with good CRC are displayed.
149+
150+
--debug 5 Preamble detection failed in some way (specified when
151+
dumping the samples) even if the current sample level
152+
is greater than MODES_DEBUG_NOPREAMBLE_LEVEL (set to
153+
25 by default).
154+
155+
How this program works?
156+
---
157+
158+
The code is very documented and written in order to be easy to understand.
159+
For the diligent programmer with a Mode S specification on his hands it
160+
should be trivial to understand how it works.
161+
162+
The algorithms I used were obtained basically looking at many messages
163+
as displayed using a trow-away SDL program, and trying to model the algorithm
164+
based on how the messages look graphically.
165+
166+
How to test the program?
167+
---
168+
169+
If you have an RTLSDR device and you happen to be in an area where there
170+
are aircrafts flying over your head, just run the program and check for signals.
171+
172+
However if you don't have an RTLSDR device, or if in your area the presence
173+
of aircrafts is very limited, you may want to try the sample file distributed
174+
with the Dump1090 distribution under the "testfiles" directory.
175+
176+
Just run it like this:
177+
178+
./dump1090 --ifile testfiles/modes1.bin
179+
180+
What is --strip mode?
181+
---
182+
183+
It is just a simple filter that will get raw IQ 8 bit samples in input
184+
and will output a file missing all the parts of the file where I and Q
185+
are lower than the specified <level> for more than 32 samples.
186+
187+
Use it like this:
188+
189+
cat big.bin | ./mode1090 --snip 25 > small.bin
190+
191+
I used it in order to create a small test file to include inside this
192+
program source code distribution.
193+
194+
Contributing
195+
---
196+
197+
Mode1090 was written during some free time during xmas 2012, it is an hobby
198+
project so I'll be able to address issues and improve it only during
199+
free time, however you are incouraged to send pull requests in order to
200+
improve the program. A good starting point can be the TODO list included in
201+
the source distribution.
202+
203+
Credits
204+
---
205+
206+
Dump1090 was written by Salvatore Sanfilippo <[email protected]> and is
207+
released under the BSD three clause license.

TODO

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TODO
2+
3+
* Extract from information from captured Mode S messages. Currently we only
4+
decode what is trival to decode.
5+
* Decode CPR encoded latitude and longitude, display it in normal and
6+
interactive mode.
7+
* Show nationality in interactive mode and normal mode using the
8+
aircraft ICAO address, like: 30xxxx -> Italy.
9+
* Actually use the fancy --debug feature in order to improve the recognition
10+
algorithm if possibile.

0 commit comments

Comments
 (0)