The ESP32 iPhone Agent lets an AI vision model control a stock iPhone through a $7 ESP32-S3 board, AirPlay screen mirroring, and AssistiveTouch. USB-C iPhones plug into the board directly; Lightning models need a Lightning to USB Camera Adapter. The setup runs on macOS or Linux and requires no Mac, developer account, jailbreak, or installed app on the phone.
This article is based on repository documentation and source review, not hands-on testing. No live flashing, calibration, or agent runs were performed.
What the ESP32 Bridge Adds to iPhone Automation
Most iPhone automation depends on XCTest or WebDriverAgent, which require a Mac, Xcode, a signed runner app, and an Apple developer account that expires every seven days for free-tier users. The ESP32 iPhone Agent uses the same paths a person uses: AirPlay supplies the screen, and USB HID plus iOS AssistiveTouch turn mouse clicks into on-screen taps.
The architecture is three layers. UxPlay running on the computer mirrors the phone screen through a GStreamer pipeline that delivers JPEG frames. The ESP32-S3 board shows up as a standard USB mouse and keyboard and connects to the server over Wi-Fi to execute simple line commands such as move, click, type, and home. An OpenAI-compatible vision model acts as a planner and actor, writing short plans and picking the next action from each screenshot.
The server tracks pointer position, and before each tap marked precise it wiggles the pointer, finds it on the mirrored screen, and corrects any miss, refining the calibration as it goes. After each see-think-act round it checks whether the screen actually changed and tells the model, so a missed tap is noticed and retried instead of built upon. When a batch of actions includes a tap followed by typing or a key, the server waits for the screen to settle and checks whether the screen changed before continuing. Repeated actions trigger a replan, and a dropped link or unparseable model reply is recovered from. The board releases all buttons and reconnects on its own if the Wi-Fi link drops, and a watchdog restarts the board if it stops responding.
Required Parts, Host Setup, and Network Assumptions
You need an ESP32-S3 board whose USB-C port is wired to the S3's native USB. The project was tested with the plain Seeed Studio XIAO ESP32S3 without pre-soldered headers—not the Sense camera version and not the Plus—which costs about $7 from Seeed or ¥40–50 on Taobao in China. USB-C iPhones plug in directly; Lightning models require a Lightning to USB Camera Adapter. The phone powers the board. Use a USB-C hub with power pass-through if the phone should keep charging while the board is plugged in.
The computer can be macOS or Linux, on the same network as the phone. Python 3.10 or later is required. UxPlay, GStreamer, and the Python server all run on the computer. Any OpenAI-compatible chat API that accepts images can be the brain—a cloud API such as OpenAI gpt-4o-mini, or a locally hosted model served by vLLM, SGLang, llama.cpp, or Ollama.
The phone needs AssistiveTouch turned on and must mirror its screen to the receiver. No app is installed and no jailbreak is required.
The project is MIT-licensed.
How the Control Loop Works
The planner model writes a short plan of at most six steps from the goal and the current screen. The actor model then looks at each new screenshot and picks the next action.
Supported actions:
tap X Y— a normal tap at screen coordinates.tap X Y precise— the server locates and corrects the pointer first, about one second slower, for small or tightly packed targets such as list rows, checkmarks, toggles, or small icons.swipe X1 Y1 X2 Y2path X1 Y1 X2 Y2 X3 Y3 …for drawing strokes through 2–20 points.circle X Y Rtype TEXT— ASCII only.key COMBO— for exampleenter,cmd+h,cmd+space.home,back,wait,replandone ANSWERorfail REASON
Coordinates are integers 0–1000 relative to the screenshot. The actor can give several DO lines—up to six run in order—whenever the next actions do not depend on seeing the result, such as ticking several visible checkboxes or days, or several drawing strokes. Those batched actions run before screen-change feedback is collected, so not every action in a batch is individually validated before the next one starts.
The board connects to the computer over Wi-Fi and executes simple line commands. On connecting it sends hello <last reset reason> <uptime ms>; then the server sends one command per line over TCP and the board answers ok or err <reason>. Commands include ping, home to push the pointer into the top-left corner, move <dx> <dy> at a constant pace so iOS pointer acceleration stays predictable, press / release / click, scroll <v> <h>, type <text> for ASCII text, and key <combo>.
While the phone is locked its USB port sleeps. The board then tries to wake it and otherwise answers err phone usb asleep instead of waiting.
First Safe Demo: Basic Navigation Instead of Account Actions
All commands start from a clone of https://github.com/onehumanbeing/esp32-iphone-agent at the repository root.
Flash the Board
- Install arduino-cli and the ESP32 core 3.x.
- Copy the secrets example to the correct location:
cp hardware/hid_bridge/secrets.example.h hardware/hid_bridge/secrets.h - Edit
hardware/hid_bridge/secrets.hand fill in your 2.4 GHz Wi-Fi SSID, password, and the IP address of the computer that will run the server. - Run
hardware/flash.sh. Optional arguments:[serial port]and--debug.
Install and Configure the Server
- Install UxPlay:
# macOS: brew install uxplay # Debian / Ubuntu: sudo apt install uxplay gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav - Set up the Python environment:
cd server python3 -m venv .venv .venv/bin/pip install -e . - Copy
.env.exampleto.envand setLLM_BASE_URL,LLM_MODEL, andLLM_API_KEY:Example for OpenAI:cp .env.example .env # Edit .envExample for a local model:LLM_BASE_URL=https://api.openai.com/v1 LLM_MODEL=gpt-4o-mini LLM_API_KEY=your-api-key-hereLLM_BASE_URL=http://localhost:8000/v1 LLM_MODEL=Qwen3.8-Flash-Next LLM_API_KEY= LLM_EXTRA_BODY='{"chat_template_kwargs": {"enable_thinking": false}}' - Start the server:
set -a && . ./.env && set +a .venv/bin/python -m hidagent - Open
http://<computer-ip>:8890in a browser.
Connect the Phone and Calibrate
- Turn on AssistiveTouch: Settings → Accessibility → Touch → AssistiveTouch.
- Plug the board into the phone. A round pointer appears and the web page shows "controller connected."
- Open Control Center, tap Screen Mirroring, and select iPhone Agent. The live screen appears in the web page.
- In the web page open Manual controls → Calibrate. The server moves the pointer, finds it on the live screen, and calibrates itself in a few seconds. If it cannot see the pointer it asks you to click exactly on it.
Run a Harmless First Task
Type a harmless goal such as "Open Settings and go to Wi-Fi" into the task box and press Start, or click one of the examples. The live log shows every plan, thought, and action with timings. The step wall displays the screenshot the model decided on for every step annotated with its tap or swipe plus the model's reasoning and how long thinking and acting took.
Keep the emergency stop (Esc or the web UI button) within reach. The agent acts with your hands, so watch it and stop it if it does something unexpected.
The web UI also offers manual controls: click to tap, drag to swipe, scroll to scroll, and manual Home, Back, typing, and keys. Taps are marked with a red ring and a spreading ripple; swipes and strokes with a yellow path. A Motion switch turns the animation off. Taps the model marked precise (pointer checked before tapping) are labelled in the log.
Screenshots, Model Endpoints, and Network Control
Each model call sends the current screenshot to the configured LLM_BASE_URL. If you use a cloud API, the provider sees every screen the agent captures. iOS does not mirror passcode entry, Apple Pay, or DRM video, so those screens are never sent. Mirroring stops when the phone locks; keep auto-lock off while the agent works.
The board listener binds to 0.0.0.0 on DEVICE_PORT 7300 by default, and the web API exposes unauthenticated control endpoints on the server port. Run the server on a trusted network, or add firewall rules to restrict access to those ports.
Debug mode with HIDAGENT_DEBUG=1 logs every board command with latency and saves one folder per agent run holding every model call (prompt, raw reply, latency), every action, and the screenshot each model call saw under ~/.hidagent/traces/. Avoid running the agent on screens or networks where those traces could leak secrets.
Known Limitations
Keyboard input is ASCII only. Re-calibrate after changing AssistiveTouch tracking speed. Landscape apps are not supported yet; drawings and taps there land in the wrong place. On Linux machines with several network interfaces limit Avahi (mDNS) to the interface on the phone's network if the phone does not list the receiver.
The agent operates on portrait apps whose screens mirror through AirPlay. The architecture depends on coordinate-based screen vision rather than iOS accessibility APIs or application state, so it works in games and apps that expose only pixels but may be less reliable than tooling that reads the accessibility tree.
If you want everything on your own hardware the project was developed with nvidia/Qwen3.8-Flash-Next-NVFP4 served on two NVIDIA DGX Sparks with tensor parallelism and an OpenAI-compatible API. The setup delivered about 1.3 seconds per action and 2 seconds per plan with thinking mode off. Any other OpenAI-compatible server with a vision model works the same way.
How This Compares with Other iPhone Control Approaches
| Project | Approach | Required on Phone / Host | Difference from ESP32 iPhone Agent |
|---|---|---|---|
| XCTest / WebDriverAgent | iOS accessibility automation | Mac, Xcode, signed runner app, developer account | ESP32 iPhone Agent needs no Mac, Xcode, signing, or app on the phone |
| VersaiOS | UxPlay + ESP32-S3 Bluetooth mouse + vision model | ESP32 tethered to computer over USB serial; desktop GUI, mainly Windows | ESP32 iPhone Agent connects over Wi-Fi and offers a web UI |
| ja1chen/actell | Agent app on iPhone, screenshots and taps via CoreDevice debug channel | Developer Mode, pairing + Developer Disk Image, Xcode self-signing | ESP32 iPhone Agent needs no Developer Mode, no app on the phone, and no signing |
| AidenAI-IO/aiden-firmware | Dedicated board: HDMI capture + USB keyboard/mouse + multimodal model | HDMI capture chip and dock; mainly Android | Uses AirPlay instead of HDMI capture, so no capture hardware |
| yoyicue/glassbox | PicoKVM HDMI capture + USB HID, observe/decide/act/verify loop | macOS controller and PicoKVM | Runs on Linux with a single ESP32-S3 |
| boboabw/phone-agent | ESP32-S3 Bluetooth HID + AssistiveTouch, agent runs as an iPhone app | Mac + Xcode to build and sign the app | Nothing to install on the phone |
| dovydaskel/Iphone-control-for-social-media | ESP32 Bluetooth mouse with OpenCV pointer correction, scripted posting | Mac | Similar closed-loop pointer idea; ESP32 iPhone Agent adds a vision-model planner/executor |
| VKCOM/devicehub | ESP32 Bluetooth mouse for iOS device farms | Farm infrastructure | Device-farm tooling, no AI agent |
Frequently asked questions
Can I run this without a Mac?
Yes. The server runs on macOS or Linux and the phone needs nothing installed, so you can set up and operate the entire stack on a Linux machine as long as it is on the same network as the phone and can run UxPlay and the Python server.
What happens if the Wi-Fi link drops?
The board releases all buttons and reconnects on its own. The server pings the board every two seconds so an unplugged or silent board shows as disconnected within seconds. A watchdog restarts the board if it ever stops responding.
Does the agent work with Chinese or emoji input?
No. Keyboard input is ASCII only. The roadmap mentions non-ASCII text input such as Chinese through the iOS pinyin keyboard as a planned feature, but it is not supported yet.
Next Step
Clone the repository and run the harmless Settings/Wi-Fi validation task before trying real apps or accounts. Keep the emergency stop within reach while the agent operates.
Verification status: Supported by official documentation only under the conditions below; not reproduced in a test environment by IGPROD. Checked 2026-10-14.
Applies to: ESP32 core (3.x).
Conditions:
- A macOS or Linux computer is still required to run UxPlay and the server.
- The computer must be on the same network as the phone.
- The vision model must be an OpenAI-compatible chat API that accepts images.
- AssistiveTouch must be enabled on the iPhone.
- USB-C iPhones plug in directly; Lightning iPhones need a Lightning to USB Camera Adapter.
- The ESP32-S3 board must have its USB-C port wired to the S3's native USB.
- The ESP32 firmware needs 2.4 GHz Wi-Fi credentials and the server computer IP.
- Some screens such as passcode entry, Apple Pay, and DRM video are not mirrored.
- Mirroring stops when the phone locks, so auto-lock should stay off while it works.
- Keyboard input is ASCII only, and landscape apps are not supported yet.
Related guides
- Talorys: a personal AI agent in your Cloudflare account: another agent you run yourself.
- Earshot: CPU audio tools for AI coding agents: speech in and out for agents without a GPU.
Leave a comment
Your email address will not be published. Required fields are marked *