ELRS Python Interface
import asyncio
from elrs import ELRS
from datetime import datetime
PORT = "/dev/ttyUSB0"
BAUD = 921600
async def main() -> None:
def callback(ftype, decoded):
ts = datetime.now().strftime('%H:%M:%S.%f')[:-3]
print(f"[{ts}] {ftype:02X} {decoded}")
elrs = ELRS(PORT, baud=BAUD, rate=50, telemetry_callback=callback)
asyncio.create_task(elrs.start())
value = 1000
while True:
channels = [value] * 16
elrs.set_channels(channels)
value = (value + 1) % 2048
await asyncio.sleep(0.1)
if __name__ == "__main__":
asyncio.run(main())
Tested with the Radiomaster Ranger Nano.
Radiomaster Ranger Nano
- Connect to the Wifi hosted by the Ranger Nano and go to
http://10.0.0.1/hardware.htmland setRX: 3TX: 1j after it is configured make sure that after power cycling it, you send commands to it within a certain time. it seems to go into the wifi-hosting configuration mode some time after powerup if it does not receive commands.
ELRS forwarding
Use e.g. Radiomaster Ranger Micro. (This is tested with 3.5.5, flash using the ExpressLRS Configurator):
- Connect to the WiFi hosted by it
- Go to 10.0.0.1
- Set the passphrase to match the one on your desired model
- Set the same passphrase in betaflight by copying the 6 numbers from the site:
set expresslrs_uid = {6 numbers}thensave(both in the CLI) - Go to 10.0.0.1/hardware.html
- Disable the Backpack
- Set
CSRF.RX=3andCSRF.TX=1(this works for both Radiomaster Ranger Micro and Jumper Aion ELRS 2.4G TX Nano and is reported to work for other modules like the BetaFPV ones as well) - After it is configured make sure that after power cycling it, you send commands to it within a certain time. it seems to go into the wifi-hosting configuration mode some time after powerup if it does not receive commands.
- run
elrs /dev/ttyUSB0 921600 --ch 1337(replace path with the assigned port on you PC). This should send a1337value to the receiver. Note that this is sent in these ranges
RC_CHANNEL_MIN = 172
RC_CHANNEL_MID = 992
RC_CHANNEL_MAX = 1811
and should be normalized to 1000 - 2000 in betaflight
Metadata
Release files for elrs 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| elrs-0.0.7.tar.gz | 5.5 kB | Details |
Release files / elrs-0.0.7.tar.gz
| Download URL | elrs-0.0.7.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26494e2b527f6fd7a1b33b3ad7dde5c76122acce00228505099d4e462036fbd4
|
|
BLAKE2b-256 checksum How to use checksums |
77ea361d1eac54cc6a72ee6e6e139c7a27d3fb4d5d3668dbb0fe7fc5b74cc4c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|