How to record data from a local receiver

Do you want to record data from your own hardware to store for analysis? The default configuration of readsb on the ADSBx software image exposes data in real-time.

Replace <adsbexchange.local> with the IP address of your local receiver.

http://adsbexchange.local/tar1090/data/aircraft.json – JSON file containing current status of all aircraft being received by the hardware. Updated once per second. Field documentation here.

http://adsbexchange.local/tar1090/data/outline.json – JSON file containing coordinates of maximum coverage area over last 24 hours.

http://adsbexchange.local/tar1090/data/stats.json – Various statistics on signals and number of targets being received.

http://adsbexchange.local/tar1090/data/status.json – Various statistics on signals and number of targets being received.

Other links:

http://adsbexchange.local/tar1090/data/stats.prom

http://adsbexchange.local/tar1090/data/status.prom

Shell Script Example:
Here is a quick and dirty shell script to store the data every “x” seconds. Replace <adsbexchange.local> with the local name or IP of your receiver. We advise to NOT store the files on the SD card of the Raspberry Pi to prevent excessive writes to the SD card.

#!/bin/bash

# Define interval in seconds (e.g. every 5 seconds)
INTERVAL=5

# Start infinite loop to periodically query the API
while true; do
    # Get the current date and time in required formats
    YEAR=$(date +"%Y")
    MONTH=$(date +"%m")
    DAY=$(date +"%d")
    HRMINSEC=$(date +"%H%M%S")
    TIMESTAMP="${YEAR}/${MONTH}/${DAY}"

    # Create the directory structure if it doesn't exist
    mkdir -p "/tmp/${TIMESTAMP}"

    # Fetch the data from the URL and store it gzipped in the desired file
    curl -s http://adsbexchange.local/tar1090/data/aircraft.json | \
     gzip > "/tmp/${TIMESTAMP}/${HRMINSEC}Z.json.gz"

    # Wait for the defined interval
    sleep $INTERVAL
done