PUPRemote
PUPRemote lets microcontrollers present themselves as LEGO Powered Up sensors. It includes a low-level LPF2 emulator and a higher-level remote-procedure-style API for quick sensor prototypes.
Table of Contents
Features
- Emulate LEGO LPF2 sensors from MicroPython boards
- Higher-level RPC-style API (
PUPRemoteSensor,PUPRemoteHub) - Supports both synchronous (
process()) and asynchronous (process_async()) modes - Works with Pybricks, SPIKE 2, and Robot Inventor hubs
- Example scripts for LMS-ESP32, OpenMV, and Pybricks
- Optional lightweight
pupremote_hub.pyfor Pybricks-only deployments
Supported Platforms
- LMS-ESP32 firmware (bundles
pupremote.pyandlpf2.py) - OpenMV (copy
pupremote.pyandlpf2.pyonto the board) - Pybricks hubs (use the smaller
pupremote_hub.pywhen space matters) - Other MicroPython-capable boards with LPF2 physical connection
Installation
LMS-ESP32 firmware
- The firmware already contains
pupremote.pyandlpf2.py. - Copy an example (for instance
examples/esp32_dummy_data/pup_demo_esp32.py) to the board asmain.py. - Connect the LMS-ESP32 to your hub (e.g., SPIKE Prime port A) and reboot.
OpenMV
- Copy
src/pupremote.pyandsrc/lpf2.pyto the OpenMV board. - Deploy an example such as
examples/openmv_simple/main.py. - Run from the OpenMV IDE or reboot to start.
Pybricks hubs
- Copy
src/pupremote_hub.pyto the hub (use this smaller file instead of the fullpupremote.py). - Upload an example such as
examples/openmv_simple/pybricks_spike.pyand adjust imports tofrom pupremote_hub import PUPRemoteHubif needed. - Run the program from the Pybricks app.
Quick Start
LMS-ESP32 demo
Copy to the LMS-ESP32 as main.py and reboot:
# examples/esp32_dummy_data/pup_demo_esp32.py
from pupremote import PUPRemoteSensor, SPIKE_ULTRASONIC
def msg(*argv):
return "demo"
p = PUPRemoteSensor(sensor_id=SPIKE_ULTRASONIC, power=True)
p.add_command('msg', "repr", "repr")
while True:
p.process()
OpenMV demo
Copy src/pupremote.py and src/lpf2.py to the board, then run:
# examples/openmv_simple/main.py
from pupremote import PUPRemoteSensor, ESP32, SPIKE_ULTRASONIC
from time import sleep_ms
p = PUPRemoteSensor(sensor_id=SPIKE_ULTRASONIC, platform=ESP32)
p.add_channel('cntr', to_hub_fmt="b")
while True:
p.process()
p.update_channel('cntr', 1)
sleep_ms(20)
Pybricks demo
Place src/pupremote_hub.py on the hub and reference it:
from pybricks.parameters import Port
from pybricks.tools import wait
from pupremote_hub import PUPRemoteHub
pr = PUPRemoteHub(Port.A) # 'A' or 1 also work
pr.add_channel('cntr', to_hub_fmt="b") # Same as on the sensor side
while True:
print(pr.call('cntr'))
wait(100)
Compatibility Notes
- Async/Sync modes: Use
process()for synchronous polling in loops, orprocess_async()+call_multitask()for concurrent async operations with callback queues. - Pybricks has a known 32-byte packet limitation. Pass
max_packet_size=16when constructingPUPRemoteHuborPUPRemoteSensorto avoid checksum errors. - For Pybricks, prefer
pupremote_hub.pyto save space (it only containsPUPRemoteHub). - LMS-ESP32 firmware already includes dependencies; do not re-upload
pupremote.pyorlpf2.pythere.
Project Structure
src/core implementation (pupremote.py,pupremote_hub.py,lpf2.py)examples/runnable demos for LMS-ESP32, OpenMV, and Pybricksdocs/Sphinx docs with API referencesimg/project assets (logo)
Development Notes (MicroPython first)
- Target runtime is MicroPython; verify every proposed import exists there (e.g.,
inspectis unavailable—avoid it). - Prefer
ustruct,uasyncio, andmicropython.const; gate CPython-only helpers behindtry/except ImportError. - Keep memory and dependency footprint small; avoid modules that pull in large transitive imports.
Contributing
Contributions and protocol refinements are welcome. Please open an issue or PR with your ideas or projects built on PUPRemote.
License
GPL-3.0. See the LICENSE file for details.
Metadata
Release files for pupremote 2.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 |
|---|---|---|---|---|
| pupremote-2.1.3.tar.gz | 143.7 kB | Without provenance | Details for pupremote-2.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pupremote-2.1.3-py3-none-any.whl | Python 3 | none | any | Details for pupremote-2.1.3-py3-none-any.whl |
Total release size: 171.8 kB
Release files / pupremote-2.1.3.tar.gz
| Download URL | pupremote-2.1.3.tar.gz |
|---|---|
| Size | 143.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55f4fbee47c4650100c9fda352c3def327f32189451bcc13c0a1b4234f511b8d
|
|
BLAKE2b-256 checksum How to use checksums |
dcebb0c5262cdea01bc2ed9feb43484ceabc415ff96af103141ead69a1df7847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / pupremote-2.1.3-py3-none-any.whl
| Download URL | pupremote-2.1.3-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
991b8e70741b7887ac5637b9292ed4c0d62580a009de49dffba53a9a6b2009af
|
|
BLAKE2b-256 checksum How to use checksums |
5f69942c513cd9f17d239993b75c41b2a67c5335bbb0a52bb8c1217797171bbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for pupremote 2.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.