{ "metadata": { "name": "", "signature": "sha256:093146f89687b80a3ccd392f8b68db7dedb9825629b2c50b4c8412d959431149" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# EE123 Lab2 - Real-Time Flight Radar App\n", "\n", "### Written by Miki Lustig and Frank Ong" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "import numpy as np\n", "from numpy import *\n", "from numpy.fft import *\n", "\n", "\n", "from rtadsb import rt_flight_radar" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Task III: Play with the Real-Time Flight Radar\n", "\n", "The function rt_flight_radar() in rtadsb.py creates a real-time flight position plot using your preamble detection function and the data2bit() function. Decoding the packets is beyond the scope of this lab. However, if you are interested you can take a look at these links:\n", "\n", "* http://www.lll.lu/~edward/edward/adsb/DecodingADSBposition.html. There's a nice explenation how to decode position. \n", "* http://sdrsharp.com/index.php/a-simple-and-cheap-ads-b-receiver-using-rtl-sdr is a windows software to decode ads-b using rtl-sdr\n", "* http://www.blackcatsystems.com/software/cocoa1090.html is an OSX software to decode ads-b using rtl-sdr\n", "* https://github.com/antirez/dump1090 is a *nix software (linux/osx) to decode ads-b using rtl-sdr. It also has a feature that you can display planes positions on google maps. \n", "\n", "\n", "Our ADS-B decoder essentially follows the dump1090 software for mode S decoding. We first correct for 1-bit errors using the checksum in the packet and look for specific ADS-B message types that we are interested in. Most aircraft information (position, velocity, angle, altitude and flight number) can only be transmitted using the long squitters so we will actually ignore the short squitters. It turns out that even the long squitter is too short for precise latitude/longitude bits, so the aircraft positions are further split into 2 different packets called even and odd during transmittion. A more complicated reconstruction method is used to extract position from the two packets. You can read http://www.lll.lu/~edward/edward/adsb/DecodingADSBposition.html for more detail.\n", "\n", "\n", "Copy and paste your `detectPreamble()` and `data2bit()` functions to the code cell below. Scroll down to the bottom and you should be able to rt_flight_radar()! To receive the ads-b packets from planes, it is recommended you are outside during daytime. It is also recommended to use Chrome to view the map. (Some parts of the map become blank on Safari, but you can fix it by resizing your browser). \n", "\n", "If a plane with position information is detected, it will be shown as a blue cross on the map. If a flight number is decoded, it will be shown next with the blue blob. It might take some time to detect a plane, but be patient. When an ADS-B packet from a plane is decoded, a `Found a plane` string will be printed. However, it might not be on the map because its position information is not received. \n", "\n", "* Run the flight radar until you see at least a plane on the map. Submit a screenshot of it along with the notebook. You can check whether the plane is real by googling its flight number (if available).\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Your detectPreamble and data2bit functions below:\n", "\n", "\n" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "fs = 2000000; # 2MHz sampling frequency\n", "center_freq = 1090e6 # 1090 MHz center frequency\n", "gain = 49.6 # gain\n", "N_samples = 2048000 # number of sdr samples for each chunk of data\n", "\n", "pos_ref = [37.875219, -122.257939] # Berkeley's latitude, longitude for initializing the map\n", "\n", "functions = (detectPreamble, data2bit)\n", "\n", "# Run flight radar\n", "stop_flag = rt_flight_radar( fs, center_freq, gain, N_samples, pos_ref, functions )\n" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "# Run this to stop\n", "\n", "stop_flag.set()" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# I hope you enjoyed the lab!" ] } ], "metadata": {} } ] }