Connected devices

Streaming EEG data over BLE on Android

By Zawar Nadeem · Published May 19, 2026 · Updated Nov 18, 2026 · 6 min read

← All articles

Bluetooth Low Energy is a common transport for EEG headsets, but a version number does not establish usable application throughput. The complete path includes sensor framing, peripheral buffers, connection parameters, phone controller and host behavior, application scheduling, and storage. A sequence gap can invalidate analysis unless the protocol detects it and the study defines how to handle it.

This guide focuses on something more defensible than a "zero-drop" promise: measured headroom, detectable sequence discontinuities, timing reconstruction through delivery bursts, and enough evidence to judge whether a session is usable.

Understanding the throughput requirement

Before tuning, calculate how many bytes per second the device produces. A 4-channel stream sampled at 256 Hz with 24-bit values generates 3,072 bytes per second of raw sample data. Add the actual protocol's framing, timestamps, sequence fields, checksums, and auxiliary channels, then measure the resulting rate with recovery headroom on the target link.

At 64 channels and 500 Hz with 24-bit samples, raw sample content is 96,000 bytes per second before framing and auxiliary data. Whether BLE has enough margin must be proved on the actual radios, firmware, packet format, and supported phones.

Use the negotiated ATT MTU

An ATT MTU of 23 bytes leaves up to 20 bytes for one notification value. Carrying 3,072 raw bytes per second at that size would require at least 154 notifications per second before protocol framing. That's an inefficient baseline, and you have to measure how it behaves because the arithmetic won't tell you.

Request an ATT MTU your protocol can use, then size values from the negotiated result. Do not assume the requested size was accepted.

As documented in the Android 14 behavior changes, the first GATT client MTU request on an ACL connection requests 517 and later requests on that connection are ignored. The negotiated minimum and callback result remain the source of truth.

Also check LE Data Length Extension (a 251-byte versus 27-byte link-layer payload) and the PHY (LE 1M or LE 2M) in the HCI trace; a large ATT MTU carried over 27-byte link-layer packets is still fragmented.

Two details to get right:

Connection interval tuning

The connection interval influences how often the central and peripheral can exchange data, but it does not determine application throughput by itself. Inspect the negotiated parameters and measure delivered bytes, batching, retransmissions, and buffer occupancy during a full recording. Do not infer capacity from a nominal interval alone.

On Android, request CONNECTION_PRIORITY_HIGH for the recording phase and return to balanced policy when it ends. Treat that as a hint. Coordinate compatible preferences in firmware and measure what the link actually delivers.

The actual result depends on the central, peripheral, controller, other connections, and system policy. Adapt buffering from measured queue pressure and sequence gaps. Only warn the user when the product has an actionable recovery step.

Measuring the actual connection interval

Android 17 QPR2 (API level 37.2, in beta in late 2026) makes BluetoothGattCallback.onConnectionUpdated public, which reports the connection interval, latency and supervision timeout. Production Android releases before it have no public API for reading these parameters, so read them from an HCI trace. Notification arrival deltas can reveal batching or degraded delivery, but they are not the connection interval because multiple packets may share an event and callbacks add scheduling jitter. Use HCI or air traces for link timing; use application telemetry for effective stream health.

Buffering strategies on the peripheral

Design for bursts in which the BLE link drains data more slowly than acquisition produces it. Firmware needs a bounded buffer and an explicit overflow or backpressure policy tied to the product's allowable interruption.

A common firmware design separates acquisition from transport with a bounded ring buffer. When the transport cannot keep up, preserve sequence and clock continuity and emit an explicit overflow record. Set the buffer size and overflow policy from the allowed interruption and memory budget.

Do not block time-critical acquisition on BLE transport. Which samples may be discarded, if any, is a product and study-protocol decision. The engineering goal is to bound detectable loss, timestamp it, and avoid presenting a known gap as contiguous data.

Android-side receive pipeline

Keep onCharacteristicChanged bounded: copy or hand off the callback value promptly, then parse, validate, persist, and render on owned execution contexts. Do not rely on one undocumented callback-thread identity across Android versions.

A receive path should separate callback ownership from parsing and persistence:

  1. Copy or transfer ownership of the callback value promptly and enqueue it into a bounded channel.
  2. On an owned execution context, validate framing and sequence, reconstruct complete records, and append them to durable session storage.
  3. Feed display state from a deliberately decimated view of the stream; UI cadence is independent from acquisition cadence.
The path a sample takes from sensor to storage
The path a sample takes from sensor to storageAcquisition never waits on Bluetooth: a ring buffer absorbs bursts. On the phone, the callback only copies and hands off; parsing, sequence checks, storage and a slower UI view run on the app's own threads.PERIPHERALANDROID PHONEAcquisitionnever blocksRing bufferoverflow → recordNotifications≤ MTU − 3, seq no.BLECallbackcopy + hand offBounded channelpolicy when fullParse + check seqown threadSession storagedurable, append-onlyDecimated UIown cadenceGap logrange + timing
Acquisition never waits on Bluetooth: a ring buffer absorbs bursts. On the phone, the callback only copies and hands off; parsing, sequence checks, storage and a slower UI view run on the app's own threads.

Measure allocation and queue pressure in the receive path. A bounded buffer pool can reduce churn, but it also needs an explicit exhaustion policy and tests that prove buffers are not reused while still owned by downstream work.

Dealing with Android fragmentation

Android behavior varies across phone models and OS builds. Turn that variation into a device matrix instead of a list of vendor folklore:

Sequence numbers and error recovery

Continuous acquisition protocols should include a sequence number, sample counter, or equivalent continuity field with documented wrap and reset behavior. On mobile, check progression and record the missing range and timing context. Do not interpolate lost physiological samples unless the scientific protocol explicitly defines and labels that transformation.

Detecting a gap from sequence numbers
Detecting a gap from sequence numbersThe app expects 44 and receives 47. It records the missing range with its timing context and leaves the samples missing rather than inventing them.arrival order →4142434445464748gap 44–46: missingExpected 44, received 47 → gap [44, 46], logged with arrival times and cause.The link layer retransmits; gaps come from a full buffer (either side) or a reconnect.
The app expects 44 and receives 47. It records the missing range with its timing context and leaves the samples missing rather than inventing them.

When timing matters, include a peripheral sample counter or timestamp often enough to reconstruct the capture timeline through batching, wrap, and loss. Choose its width and cadence from the longest session and required accuracy.

Testing under realistic conditions

A close-range quiet-RF test is only a baseline. Add controlled attenuation and interference, realistic body placement, screen and lifecycle changes, multiple connections where supported, and the intended deployment environment. BLE and 2.4 GHz Wi-Fi coexistence belongs in the test matrix, but traces are still required before assigning a field gap to interference.

Define acceptance criteria before testing: session duration, supported phone and firmware matrix, RF stress, allowed gap count and length, reconnect behavior, buffer high-water mark, battery use, and what makes a recording invalid. Report per-session distributions rather than one aggregate loss percentage.