A high-level, polarity-aware Python controller for Raspberry Pi Pico (RP2040) powered by Telemetrix.
Project description
rp2040link
rp2040link is a high-level, polarity-aware Python controller for Raspberry Pi Pico / RP2040 boards from a host computer.
It is designed for the workflow you described:
- Flash a resident firmware to the Pico (a “server” that stays online),
- Then control the Pico’s pins from the PC with a clean Python API over USB serial.
Powered by: rp2040link builds on the proven Telemetrix-RPi-Pico stack (host-side Python + Pico-side firmware) and provides a more ergonomic, modern, and safer API layer on top.
Why rp2040link?
Telemetrix is excellent, but you often want a more “application-shaped” interface:
- Per-pin polarity (active-low vs active-high) without stringly-typed APIs
- Safe startup (force outputs to a known OFF state)
- Binary/bitmask writing to 1 pin or a pin bus
- Convenience helpers: blink, pulse, groups, sync I2C/SPI reads, etc.
rp2040link is exactly that: a thin, ergonomic layer over Telemetrix.
Requirements
- Python 3.9+
- A Raspberry Pi Pico / RP2040 board
- Telemetrix Pico firmware flashed (UF2)
- USB data cable
Install
pip install rp2040link
Flash the Pico (Telemetrix UF2)
Telemetrix requires a small Pico “server” firmware (UF2). Steps (high-level):
- Hold BOOTSEL while plugging the Pico into USB (it appears as a drive like
RPI-RP2). - Drag & drop the Telemetrix UF2 onto the drive.
- The board reboots and should appear as a serial device (Linux:
/dev/ttyACM*, macOS:/dev/cu.*, Windows: COM port).
If you are unsure which UF2 to use, check Telemetrix-RPi-Pico documentation for the current UF2 builds.
Quick Start
Mixed polarity outputs (the style you asked for)
import time
from rp2040link import Pico
GP14, GP15 = 14, 15
with Pico() as pico:
pico.setup_output.active_low(GP14, initial_off=True) # ON=0 OFF=1
pico.setup_output.active_high(GP15, initial_off=True) # ON=1 OFF=0
pico.gpio.on(GP14); time.sleep(0.5); pico.gpio.off(GP14)
pico.gpio.on(GP15); time.sleep(0.5); pico.gpio.off(GP15)
pico.gpio.blink([GP14, GP15], times=20, period_s=0.2)
Binary helpers (single pin + bus)
Single pin (very simple)
from rp2040link import Pico
import time
with Pico() as pico:
pico.setup_output.active_low(14, initial_off=True)
b = pico.binary.pin(14)
b.bit(1); time.sleep(0.2)
b.bit(0); time.sleep(0.2)
b.pattern("101001", delay_s=0.05)
Bus (bitmask write)
from rp2040link import Pico
import time
with Pico() as pico:
pico.setup_output.active_low(14, initial_off=True)
pico.setup_output.active_high(15, initial_off=True)
bus = pico.binary.pins(14, 15) # msb_first=True by default
bus.write(0b10); time.sleep(0.3)
bus.write(0b01); time.sleep(0.3)
bus.stream([0,1,2,3,2,1,0], delay_s=0.15)
CLI
rp2040link ships with a small CLI for quick checks:
rp2040link ports
rp2040link blink --pins 14,15 --polarity 14:low,15:high --times 20 --period 0.2
Troubleshooting
“No such file or directory: /dev/ttyACM0”
- The Pico is likely still in BOOTSEL mode (shows as
RPI-RP2drive) OR - The cable is charge-only (no data) OR
- The port is not
/dev/ttyACM0(userp2040link ports).
Permission denied (Linux)
Add your user to dialout and re-login:
sudo usermod -aG dialout $USER
Project layout
src/rp2040link/: library codeexamples/: runnable examplestests/: unit tests (hardware-free)docs/: docs assets
Development
pip install -e ".[dev]"
pytest
Build distributions:
python -m build
License
MIT — see LICENSE.
Publishing
See PUBLISHING.md for step-by-step instructions (Trusted Publishing via GitHub OIDC or manual Twine upload).
Without with (manual connect/close)
from rp2040link import Pico
import time
pico = Pico()
try:
pico.open() # or pico.connect()
pico.setup_output.active_low(14, initial_off=True)
pico.gpio.on(14); time.sleep(1); pico.gpio.off(14)
finally:
pico.close() # or pico.disconnect()
Auto-connect options
Pico(auto_open=True)connects in__post_init__.Pico(lazy_open=True)connects automatically on first access to.board.
pico = Pico(auto_open=True) # connects immediately
# or:
pico = Pico(lazy_open=True) # connects on first operation that touches `.board`
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rp2040link-0.1.4.tar.gz.
File metadata
- Download URL: rp2040link-0.1.4.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41b25c83df1fa3abde8b265dd51ef13b96eac3322cc2e11d863b37d8e9d9f767
|
|
| MD5 |
ee10d2f3b1ba7b124b9e16f942331586
|
|
| BLAKE2b-256 |
950c06cb2b5853faa3274bb5f9c8d33380eba44e5087c7404e7aac7d2ce79a9b
|
Provenance
The following attestation bundles were made for rp2040link-0.1.4.tar.gz:
Publisher:
publish.yml on OkhtayMp/rp2040link
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rp2040link-0.1.4.tar.gz -
Subject digest:
41b25c83df1fa3abde8b265dd51ef13b96eac3322cc2e11d863b37d8e9d9f767 - Sigstore transparency entry: 786518000
- Sigstore integration time:
-
Permalink:
OkhtayMp/rp2040link@bbcabf05a0e700cdefd408e26f42b87433efb9b4 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/OkhtayMp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bbcabf05a0e700cdefd408e26f42b87433efb9b4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rp2040link-0.1.4-py3-none-any.whl.
File metadata
- Download URL: rp2040link-0.1.4-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b49df474b11dd974f4f588655c31107f58725638094eeddf364189237ac5908
|
|
| MD5 |
106ab832faaa4630f679b5fa9a600c9c
|
|
| BLAKE2b-256 |
363f0c186b636e251ff1d267f7271af883274a10a948cf72623ccb3cd2c21fa1
|
Provenance
The following attestation bundles were made for rp2040link-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on OkhtayMp/rp2040link
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rp2040link-0.1.4-py3-none-any.whl -
Subject digest:
8b49df474b11dd974f4f588655c31107f58725638094eeddf364189237ac5908 - Sigstore transparency entry: 786518006
- Sigstore integration time:
-
Permalink:
OkhtayMp/rp2040link@bbcabf05a0e700cdefd408e26f42b87433efb9b4 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/OkhtayMp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bbcabf05a0e700cdefd408e26f42b87433efb9b4 -
Trigger Event:
push
-
Statement type: