- Hands: the board acts as a USB mouse and keyboard. iOS AssistiveTouch shows the mouse as a round pointer.
- Eyes: the iPhone mirrors its screen to your computer with AirPlay.
- You stay in charge: the board does nothing until you press its button (armed, light on). Press it again, or choose Stop in Allternit, and the bot loses control immediately.
Only need your bot to see the iPhone’s screen or use a browser? The Allternit iPhone app does that with no board or cable: share the screen from the app, and your bot can also use the app’s own browser. Taps on other apps still need a board.
What you need
- An ESP32-S3 board with native USB and a USB-C data cable. The tested board is the Seeed Studio XIAO ESP32S3 (the plain one, not Sense or Plus). Desktop installs the USB Agent software on it for you. The board’s BOOT button becomes the arm button, and its small light shows when it’s armed.
- An iPhone with USB-C, on the same Wi-Fi as your computer. Lightning iPhones need Apple’s Lightning to USB 3 Camera Adapter. A USB-C hub with power pass-through keeps the phone charging while the board is in.
- UxPlay on your computer to receive the screen: see Install UxPlay below.
- Allternit Desktop on macOS or Linux.
The firmware
You don’t need any tools: Set up installs the USB Agent firmware that comes with Desktop, and installs a newer version when Desktop updates (the board’s row says Update available). The firmware is open source, inhardware/usb-agent of the Allternit platform repository. Developers can build and flash their own with hardware/usb-agent/flash.sh.
Install UxPlay
Homebrew has no UxPlay formula, so on macOS you build it from source. This takes a few minutes. Run these commands in Terminal:hardware/usb-agent/install-uxplay.sh in the public repo. Desktop finds uxplay on your PATH or in /opt/homebrew/bin.
On Debian and Ubuntu, run sudo apt install uxplay.
Connect an iPhone
Open Settings → Computers → Phones → Connect an iPhone.- Set up the USB Agent. Plug the board into your computer with a data cable, enter your Wi-Fi name and password (the board uses 2.4 GHz Wi-Fi), and choose Set up. Desktop finds the board by itself, installs the USB Agent software if the board doesn’t have it yet (about half a minute), then writes your Wi-Fi details and a new private key over USB. The board restarts, disarmed. If Desktop says the board didn’t reach its installer, unplug it, hold its BOOT button while you plug it back in, and choose Set up again. If macOS asks whether Allternit and
uxplaymay accept incoming network connections, choose Allow: the board and the iPhone connect to your computer over Wi-Fi. - Plug it into the iPhone. On the iPhone, open Settings → Accessibility → Touch → AssistiveTouch and turn it on. A round pointer appears. Desktop shows when the board has joined.
- Mirror the screen. On the iPhone, open Control Center → Screen Mirroring and choose Allternit. The first time, the iPhone asks for a four-digit code, which Desktop shows. After that, the iPhone remembers this computer.
- Arm and calibrate. Press the board’s button (its light turns on). Unlock the iPhone and go to a home screen, then choose Calibrate. Desktop moves the pointer, finds it on the mirrored screen and works out how far it travels.
- Try it: choose Try it: go home.
In Settings
Each iPhone shows a status that tells you what’s missing:- View shows the iPhone’s screen.
- Stop disarms the board straight away. It lets go of everything and refuses input until you press its button again.
- Forget removes the board and its key from this computer. To use it again, set it up again over USB.
What your bot can do
The tools are the same as for Android, so a bot doesn’t need to know which kind of phone it has.
When a command gets no answer, the result is
uncertain, never success. The bot is told to look at the screen before it tries again.
Bluetooth mode (no cable to the iPhone)
The board can also pair with your iPhone over Bluetooth as a keyboard and mouse named Allternit Keyboard, so nothing plugs into the iPhone. It still connects to your computer over Wi-Fi, so power it from the computer, a charger or any USB port. This works with Allternit Desktop on Windows and Linux too, because it needs no Mac.- Update the board to the latest software (it needs firmware 1.1.0 or newer), then switch it to Bluetooth mode. The board restarts and is disarmed.
- On the iPhone, open Settings → Bluetooth and choose Allternit Keyboard, within about 10 meters of the board. There is no code to type.
- Press the board’s button to arm it, as usual. The iPhone needs AssistiveTouch turned on (Settings → Accessibility → Touch → AssistiveTouch) to show the pointer.
The Settings switch for Bluetooth mode comes with a later Settings update. The Desktop app already supports it.
Safety
- Only your computer can drive your board. Desktop and the board each prove they hold the board’s key before any command is sent. Every command is signed and numbered, so it can’t be replayed. The key is set over USB, so setup needs the board in your hand.
- Arming is physical. The board starts disarmed. Only its button arms it; Allternit can disarm it but never arm it.
- It lets go when nobody is driving. If the Wi-Fi link drops, or nothing arrives from Desktop for 10 seconds, the board releases every key and button. It disarms itself after 30 minutes without use, or one minute without your computer.
- Only your phone can feed the screen. Your computer accepts AirPlay only from a phone that entered its code, so nobody else on the Wi-Fi can show the bot a fake screen.
- The board can’t tell what a tap means. A tap can open a payment sheet as easily as a settings page, and the board has no way to tell them apart. Keep it disarmed when you aren’t using it, and watch View when the bot does anything that matters.
- Bluetooth mode is no looser. The board only sends Bluetooth input while armed, and drops it the moment you disarm, the link is lost, or the iPhone disconnects. Other phones can’t pair unless you open pairing from Allternit.
- iOS doesn’t mirror some screens, such as passcode entry, Apple Pay and DRM video, so the bot can’t see them.
Limits
- Same network only. Desktop listens for boards on port 7300.
- One iPhone per board. Each board gets its own AirPlay receiver: Allternit, then Allternit 2, and so on.
- Portrait apps. Taps in landscape apps may land in the wrong place.
- Typing is ASCII only.
For developers
- Desktop code:
surfaces/allternit-desktop/src/main/phone-usb-agent.ts(manager and tools),phone-usb-agent-link.ts(the authenticated TCP link on port 7300, advertised over mDNS as_allternit-usba._tcp),phone-usb-agent-protocol.ts(USBA/1, withReferenceBoardmirroring the firmware),phone-hid-core.ts(calibration, aiming and keys, shared with the Bluetooth keyboard/mouse routes),phone-usb-agent-pointer.ts(the board as that core’s sender),phone-usb-agent-vision.ts,phone-usb-agent-provision.ts(USB serial setup) andphone-airplay.ts(UxPlay, run as its own process). - Bluetooth mode:
hardware/usb-agent/firmware/usb_agent/bt_hid.cpp(the board’s Bluetooth LE keyboard and mouse, the same report map as the Android app and the Mac tool); Desktop’sUsbAgentManager.setMode,pairBluetoothandforgetBluetoothsend themode,bt pairandbt forgetcommands, and the board’smodeandbluetoothstate is inUsbAgentInfo. - Firmware, protocol and safety model:
hardware/usb-agent/README.md. - Installing firmware: Desktop ships
resources/phone/usb-agent/usb-agent-firmware.binwith afirmware.jsonmanifest (version, SHA-256), built reproducibly byhardware/usb-agent/build-firmware.sh. The setup page flashes it with Espressif’s esptool-js over Web Serial; Desktop only lets Allternit’s own pages use serial, and only for Espressif boards (USB vendor 0x303A), picked without a chooser. - Storage: board keys are sealed with the OS keychain in
<userData>/phone/usb-agents.json; calibration is stored per board next to them. - Credits: adapted from esp32-iphone-agent (MIT); see
hardware/usb-agent/NOTICE. UxPlay is GPL-3.0 and isn’t bundled.