Modernizing PiAware Setup with Bluetooth LE

Modernizing PiAware Setup with Bluetooth LE

In my previous blog post, I shared an overview of FlightAware’s ADS-B receiver network that streams real-time flight data to FlightAware. Our receivers require an Internet connection to operate, so a key focus over recent years has been making it easier for our hosts to get them connected to the Internet and simplify the overall setup process. For modern day consumer electronics, configuring the Wi-Fi network is often the first step in the setup process and requires a mobile device to connect to them and complete the setup.

FlightAware wanted to adopt a similar approach to setting up our ADS-B receivers. This blog post explains how users traditionally set up Wi-Fi on our ADS-B receivers and how we leveraged Bluetooth Low Energy (BLE) to simplify and modernize the setup process.

PiAware Explained

If you’re not familiar with PiAware, it is an open-source solution we’ve developed for people that want to assemble an ADS-B receiver and contribute data to FlightAware. Our ADS-B receivers are powered by Raspberry Pi computers. PiAware at its core is a Raspberry Pi OS image with our pre-installed suite of flight tracking software. We used the open-source tool that the Raspberry Pi Foundation uses to build the standard Raspberry Pi operating system and added custom build stages to install our software and configure them to start up at boot time. The goal with this was to reduce the barrier to entry for contributing to FlightAware and make the process as simple as possible: Acquire a Raspberry Pi and ADS-B receiver hardware, flash PiAware on an SD card and insert it into the Pi, connect it the Internet, and off you go.

The simplest method to connect PiAware to the Internet is to attach it to a wired Ethernet connection. However, the process is less simple for users that prefer to connect it over Wi-Fi. The process is as follows:

1.        Insert the PiAware SD card into a computer

2.        Open a text file and edit it with your Wi-Fi SSID and password

3.        Insert PiAware SD card image into the Raspberry Pi and boot it up 

Not entirely too difficult, but we were starting to venture into pre-built, headless ADS-B receivers and needed some way to connect to the device and configure Wi-Fi without having to open it and edit text files.

Leveraging Bluetooth

During the exploratory phase, we explored two well-established approaches to this problem: Bluetooth and Wi-Fi access point mode. The latter involves turning the device into a wireless access point and requires the user to manually enter in a passkey to connect to the device before transferring data. We thought this process would be complex and prone to issues and ultimately decided on using Bluetooth, specifically BLE, for its simplicity and to minimize the risk of disrupting an active data feed to FlightAware.

Bluetooth Low Energy was designed for low power consumption and ideal for devices needing to transfer small amounts of data periodically, as opposed to a continuous stream of data. This made it a suitable choice for our needs. Within the Bluetooth LE specification, there are two protocols for handling device connectivity and data transfer within a Bluetooth LE network:

1.        Generic Access Profile (GAP) – This protocol allows Bluetooth LE devices to discover and connect to each other 

2.        Generic Attribute Profile (GATT) – Once a connection is established, GATT defines how data is transferred between each other

We built a custom Bluetooth service, “piaware-ble-connect”, that leveraged these two protocols to provide an interface to PiAware over Bluetooth. It uses the official Linux Bluetooth protocol stack and the D-Bus messaging system to provide a high-level API for interacting with the Bluetooth hardware. 

Connecting to PiAware

To enable PiAware to be discoverable over Bluetooth, piaware-ble-connect creates a D-Bus interface to interact with the Bluetooth LE Advertising manager on the system bus. It then configures and broadcasts advertising packets containing information that identifies PiAware which allows nearby Bluetooth LE devices to discover PiAware and establish a connection with it.

We added a user interface in both the FlightAware iOS app and the FlightAware website to allow users to connect to PiAware. The iOS app utilizes Apple's Core Bluetooth framework for connectivity and the FlightAware website leverages the Web Bluetooth API, which allows connections to BLE devices through a web browser.

Figure 1- Connecting to PiAware over Bluetooth LE

Configuring Wi-Fi on PiAware

The Generic Attribute Profile mentioned above defines the format and organization of data exchanged between Bluetooth LE devices. The data is generally organized into “services”, which are groups of related functionalities, or “characteristics”, provided by a Bluetooth device. For example, a BLE device may expose a Battery service with characteristics for battery health and level that can be queried. 

We took a slightly custom yet common approach to using GATT for transferring data, which was implementing a UART service with two characteristics: one for receiving data (RX) and one for transmitting data (TX).  This essentially emulates a serial communication channel over Bluetooth LE. We decided to go with this approach because it gave the flexibility to send data in JSON format, which can be relayed to a web server as an HTTP request. The BLE client application (e.g. the FlightAware iOS app or web browser) would send the Wi-Fi settings to piaware-ble-connect, which acts as a bridge to transmit those settings to an API that handles those requests. 

We developed piaware-configurator, an API written in Python and Flask, that handles HTTP requests and performs the necessary logic to configure and apply the device Wi-Fi settings. The responses from the API are returned via BLE and presented to the user, indicating if PiAware has successfully connected to FlightAware. 

The figures below demonstrate the data flow when configuring Wi-Fi and the user interfaces the Web and Mobile teams developed for it.

Figure 2 - Data Flow for configuring Wi-Fi
Figure 3 - Connecting to PiAware using the FlightAware website and Web Bluetooth API
Figure 4 – Connecting to PiAware using the FlightAware iOS app and Core Bluetooth


As a result of adopting Bluetooth technology to help with the setup process, users are no longer required to modify text files on PiAware to configure Wi-Fi. This was a big step towards modernizing and improving the overall user experience of our products. We’ve since extended this functionality to our latest, recently released FlightFeeder, allowing us to remove the LCD display previously used to configure Wi-Fi. We plan to extend this feature to the FlightAware Android app to expand usage and continue to build on the rest of our products.

Eric Tran

Eric Tran

Eric Tran is an Engineering Manager at FlightAware. He leads a team within the Operations & Reliability group that is responsible for building & maintaining our global network of ADS-B receivers.

Show Comments
Back to home