PocketWand
Turn any phone into a motion controller for your Python program. The phone streams its rotation through its web browser, so there's no app to install, and it works on iPhone and Android, on any network (campus Wi-Fi included).
Try the demo
pip install "pocketwand[demo]"
pocketwand demo
- A window opens with a QR code (it takes a few seconds to get a public link).
- Scan it with your phone's camera and open the link.
- Tap Enable motion and allow access.
- Point your phone at the screen and move it. The phone on screen copies it.
Press R (or the Recentre button on the phone) to make "pointing at the screen" count as straight ahead again.
pocketwand print does the same without a window and prints the Controller state to the terminal.
Use it in your own Game
import pocketwand
room = pocketwand.Room() # starts the server and tunnel, prints a QR code
room.on_join = lambda c: print("joined slot", c.slot)
while True:
c = room.controller(0) # never None; an empty Slot reads as disconnected
if c.connected:
c.orientation # Quaternion(w, x, y, z)
c.orientation.matrix() # 3x3 rotation matrix
yaw, pitch, roll = c.euler # degrees
c.button # True while the on-screen button is held
# c.recenter() makes the current facing count as straight ahead
Frames. Orientation rotates the phone's frame (+X right edge, +Y top of the phone, +Z out of the screen) into the world frame (+X right, +Y towards your screen, +Z up). Recentring only changes heading, so tilt always matches gravity.
Several phones. Every phone that opens the link gets its own Slot (room.controller(1), …). A phone that reconnects gets its old Slot back. room.controllers lists the connected ones.
State is updated on a background thread; reading it from your game loop every frame is safe and cheap.
How it works
Room() runs a small web server on your computer and opens a free Cloudflare quick tunnel to it (the cloudflared program is downloaded automatically on first run). The phone opens the page over HTTPS, which iOS requires before a page can read motion sensors, and streams its orientation back over a WebSocket. Both sides only make outgoing connections, so firewalls and campus client isolation don't get in the way.
Needs Python 3.10+ and an internet connection.
Metadata
Release files for pocketwand 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pocketwand-0.1.3.tar.gz | 16.5 kB | With provenance | Details for pocketwand-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pocketwand-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pocketwand-0.1.3-py3-none-any.whl |
Total release size: 32.8 kB
Release files / pocketwand-0.1.3.tar.gz
| Download URL | pocketwand-0.1.3.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bcf21a7dcbdcc1884860798b2b773fe3cf2cf27ceb9e39d8f81058d1c1a315aa
|
|
BLAKE2b-256 checksum How to use checksums |
e25ab9854dbe5056f71f1df1377d18397e79aea546bc2c0f0303988c917afb4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 22, 2026.
Transparency logRelease files / pocketwand-0.1.3-py3-none-any.whl
| Download URL | pocketwand-0.1.3-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04cdc136e69208f4cf70c57828f418fd8c7d5eb482d1bcc8f855a6311433b85d
|
|
BLAKE2b-256 checksum How to use checksums |
4aa52064d2e7a63ee2da82fea412184460592335b2aa3a484bc1d2dba55ae057
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 22, 2026.
Transparency logSecurity for pocketwand 0.1.3
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.
Attestation for pocketwand-0.1.3.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 Sep 22, 2026.
Transparency logA 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.