Skip to main content

airhand

Drive any device that accepts a Bluetooth keyboard and mouse: phones, tablets, computers and TVs. Nothing is installed on the device. A $10 nRF52840 USB dongle pairs with it as a keyboard, mouse and media remote, and your computer sends it commands over USB serial.

your computer ──USB serial──▶ nRF52840 dongle ──Bluetooth LE HID──▶ phone · tablet · computer · TV

Use it to automate devices that you cannot or do not want to instrument: real phones without developer mode, locked-down apps, kiosks, set-top boxes. Add a camera over the screen if your automation needs to see.

What it can send

Input Commands
Pointer at an exact position tap, double tap, right click, long press, hover, swipe, drag
Scroll wheel vertical and horizontal
Keyboard text on a US layout, any key with ctrl / shift / alt / cmd, F1 to F24, the numpad
Media and system keys home, back, search, volume, mute, play/pause, next, previous, brightness

Positions are fractions of the screen, 0.0 to 1.0, so the same script works at any resolution.

Hardware

  • A Nordic nRF52840 Dongle (PCA10059). It costs about $10.
  • A device with Bluetooth LE that accepts a Bluetooth keyboard and mouse.

Quick start

  1. Install the bootloader, once per dongle. Download airhand-bootloader-<version>.zip from the releases. Press the dongle's RESET button (the red LED pulses), then:

    pip install nrfutil
    nrfutil install nrf5sdk-tools
    nrfutil nrf5sdk-tools dfu usb-serial -pkg airhand-bootloader-<version>.zip -p <serial port>
    

    This is the last time you press RESET. The dongle now shows up as airhand update and waits for firmware.

  2. Install the firmware.

    pip install "airhand[update]"
    airhand update
    

    airhand update installs the firmware that ships with the package, over USB. Run it again after you upgrade the package.

    On Linux, do this once before airhand update: it lets your user open the dongle and keeps ModemManager from probing it. Then plug the dongle in again:

    echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="2fe3", ATTRS{idProduct}=="0004|0100", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1"' | sudo tee /etc/udev/rules.d/70-airhand.rules
    sudo udevadm control --reload-rules
    
  3. Pair. Open the device's Bluetooth settings and select airhand. Pairing needs no code.

    • iPhone and iPad: turn on Settings > Accessibility > Touch > AssistiveTouch to use the pointer.
    • Android, computers and TVs: no extra settings.
  4. Send input.

    from airhand import Dongle
    
    with Dongle() as dongle:
        dongle.media("home")
        dongle.tap(0.5, 0.3)
        dongle.type_text("hello\n")
        dongle.swipe((0.5, 0.8), (0.5, 0.3), ms=400)
        dongle.key("cmd+space")
    

    Dongle() opens the one plugged-in dongle. With several, give a USB serial number from airhand.serial_numbers(): Dongle("<serial>"). A dongle found by serial number is found again after a replug. Use Dongle(port="/dev/ttyACM0") for a fixed port. touch=True makes the dongle a touch screen; Android needs it.

Python API

Method Does
tap(x, y, button="left", count=1) Click. count=2 is a double click; button is left, right or middle.
hold(x, y, ms, button="left") Press and hold: a long press.
move(x, y) Move the pointer without pressing.
swipe(start, end, ms, hold_ms=0) Press, move, release. With hold_ms, a drag that starts with a long press.
wheel(lines, pan=0) Turn the scroll wheel by detents. Positive turns it up and right; natural scrolling reverses the content.
type_text(text) Type text.
key(combo) Press a key or a combination, such as enter, a or ctrl+shift+t.
media(name) Press a media or system key.
status() The link state, such as {"conn": "yes", "sec": "2", "interval_ms": "45"}.
hosts() The paired devices, as Host(address, name, connected, chosen).
use(host, wait_s=20) Let only that paired device connect, by name or address, and wait until it has. use(None) lets any paired device connect.
unpair() Forget every paired device.

airhand.serial_numbers() lists the plugged-in dongles. airhand.KEYS, MODIFIERS, MEDIA and BUTTONS list every name the firmware accepts.

Errors all derive from airhand.AirhandError:

Error Means
HostUnavailable No device took the command within 10 s: it is not connected, or never encrypted the link. Its reason says which.
DongleLost The dongle is not plugged in or stopped answering. The command may or may not have run.
Unsupported The input cannot be sent: a character, key, button or position outside what the firmware supports.
Refused The firmware refused the command and sent nothing. Its reason holds the firmware's words.
WrongFirmware The port answers, but not with airhand firmware of the client's series: client 0.1.x needs firmware 0.1.x. airhand update installs the matching firmware.

The client keeps commands safe across a lost reply. Every request carries an id, and a reply that goes missing is asked for again with result <id>, so a tap is never sent twice.

airhand.testing.FakeDongle answers the protocol on a pseudo-terminal (macOS and Linux), so you can test your code without hardware:

from airhand import Dongle
from airhand.testing import FakeDongle

with FakeDongle() as fake:
    Dongle(port=fake.port).tap(0.5, 0.5)
    assert fake.commands == [("tap", "0.5000", "0.5000")]

Several paired devices

The dongle keeps up to 4 paired devices but drives one at a time. To pick one while all of them have Bluetooth on:

airhand hosts
airhand use "iPhone"

The dongle drops any other device's link and lets only the chosen one connect. airhand use any lets every paired device connect again. The choice lasts until the dongle restarts. Firmware 0.1.6 or later.

Firmware updates

pip install --upgrade "airhand[update]"
airhand update

The firmware restarts in update mode, receives the new image in a second flash slot, and restarts on it. A dongle that already runs the package's firmware is left alone. In Python, airhand.update(serial=None, firmware=None, progress=None) does the same, with the same update extra, and returns the new identity; give firmware to install an image you built.

If an update goes wrong, the dongle keeps firmware that works:

  • The new firmware runs on trial. A client's version request, which every Dongle() sends, keeps it. If no client talks to it within 60 s, or it stops responding for 30 s, the dongle goes back to the firmware it had.
  • An upload that stops halfway leaves the old firmware in place. Run airhand update again.
  • If the dongle never comes back, hold the SW1 button while you plug it in. It starts in update mode, and airhand update installs the firmware again.

Paired devices stay paired through an update.

Serial protocol

Every language can use the dongle: it is one line per request on a USB serial port. See docs/protocol.md.

Platform notes

Device Notes
iPhone, iPad Turn on AssistiveTouch for the pointer. A slow drag can count as a tap: move at least 0.75 screen heights per second. iOS has no Back key.
Android Open the dongle with Dongle(touch=True) (firmware 0.1.2 or later): Android ignores where a mouse points, so taps and swipes go as touches. Back and Home work with no setup. On the OnePlus 15 we tested, key("meta") opens the app drawer and key("meta+tab") opens Recents.
macOS, Windows, Linux Use the wheel to scroll; a drag selects text on a computer.
TVs and set-top boxes Use arrow keys, enter and the media keys.

Tested on an iPhone 12 with iOS 26 and a OnePlus 15 with Android 17. Results from other devices are welcome as issues or pull requests.

Build the firmware

The firmware is a Zephyr app for nRF Connect SDK v3.4.1, in firmware/. One build makes both the app and MCUboot, the bootloader that installs updates:

west build -b nrf52840dongle/nrf52840 -d build firmware
airhand update --firmware build/firmware/zephyr/zephyr.signed.bin

The bootloader package for the first install comes from the same build:

nrfutil nrf5sdk-tools pkg generate --hw-version 52 --application-version 1 --sd-req=0x00 \
  --application build/mcuboot/zephyr/zephyr.hex airhand-bootloader.zip

Only MCUboot goes in through the factory bootloader: it checks a CRC of what it flashed on every boot, so it must never hold the slots that MCUboot rewrites. The firmware version is in firmware/VERSION; keep it equal to the package version in pyproject.toml.

The protocol core, firmware/src/proto.c, has no Zephyr dependency. The tests build it for your computer and drive it through the Python client:

pip install -e . pytest
pytest

License

Apache-2.0. See LICENSE.

The released firmware, in the release assets and in the Python package, also contains Zephyr (Apache-2.0) and parts of the nRF Connect SDK, such as the Bluetooth LE controller and the HID service, under the Nordic 5-Clause license. Those parts may only be used with Nordic Semiconductor chips.

Metadata

Release files for airhand 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airhand 0.1.6
File Size Uploaded Provenance Actions
airhand-0.1.6.tar.gz 190.3 kB With provenance Details for airhand-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for airhand 0.1.6
File Interpreter ABI Platform Actions
airhand-0.1.6-py3-none-any.whl Python 3 none any Details for airhand-0.1.6-py3-none-any.whl

Total release size: 359.9 kB

Release files / airhand-0.1.6.tar.gz

Download URL airhand-0.1.6.tar.gz
Size 190.3 kB
Tags Source
SHA-256 checksum
How to use checksums
936cf035dde3ef01065910e4af1c272e1711b77e4974d00ea364b7234015c22d
BLAKE2b-256 checksum
How to use checksums
15848deedd95f13c1f12a421ec1267130e9fc4a70101dc712850da06621dc355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / airhand-0.1.6-py3-none-any.whl

Download URL airhand-0.1.6-py3-none-any.whl
Size 169.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdbe2f391208dfa05bd08e6229dd459d34d2c9bc57091f0ac1935056e9a9fed3
BLAKE2b-256 checksum
How to use checksums
6b7debb1d00e652e0455f510b401158ee6ecb1f78dad82ecc5c55e2941d59abe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for airhand 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for airhand-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page