使用33厘米頻段Reyax Rylr998Lora®模塊的Python程序,用於以下方式:
這裡沒有線程,只有異步的非阻滯I/O調用。
注意:我建議將Rylr998連接到Reyax Ryls135 USB,至1.8V/3.3V/5V TTL UART橋,可從亞馬遜獲得。使用此硬件和Raspberry Pi 4(或5-尚未測試),該軟件與Digipi Appliance軟件兼容,而無需修改/boot/config.txt 。
警告:Windows需要windows-curses ,該Windows curses the python 3.11起不實現curses.set_escdelay() 。在display.py中註釋cur.set_escdelay(1) ,並自行運行。文本處理在Windows中是不穩定的,而set_escdelay()函數丟失。如果您在Windows中的WSL2下在Ubuntu或Debian下運行,您將不會遇到此問題。
usage: rylr998.py [-h] [--debug] [--factory] [--noGPIO] [--addr [0..65535]] [--band [902250000..927750000]] [--pwr [0..22]]
[--mode [0 | 1 | 2,30..60000,30..60000]] [--netid [3..15 | 18]] [--parameter [7..11,7..9,1..4,4..24]] [--echo]
[--port [/dev/ttyS0../dev/ttyS999 | /dev/ttyUSB0../dev/ttyUSB999 | COM0..COM999]]
[--baud (300 | 1200 | 4800 | 9600 | 19200 | 28800 | 38400 | 57600 | 115200)]
options:
-h , --help show this help message and exit
--debug log DEBUG information
--factory Factory reset to manufacturer defaults. BAND: 915MHz, UART: 115200, Spreading Factor: 9, Bandwidth: 125kHz (7), Coding Rate:
1, Preamble Length: 12, Address: 0, Network ID: 18, CRFOP: 22
--noGPIO Do not use rPI.GPIO module even if available. Useful if using a USB to TTL converter with the RYLR998.
rylr998 config:
--addr [0..65535] Module address (0..65535). Default is 0
--band [902250000..927750000]
Module frequency (902250000..927750000) in Hz. NOTE: the full 33cm ISM band limits 902 MHz and 928 MHz are guarded by the
maximum configurable bandwidth of 500 KHz (250 KHz on either side of the configured frequency). See PARAMETER for bandwidth
configuration. Default: 915000000
--pwr [0..22] RF pwr out (0..22) in dBm. Default: FACTORY setting of 22 or the last configured value.
--mode [0 | 1 | 2,30..60000,30..60000]
Mode 0: transceiver mode. Mode 1: sleep mode. Mode 2,x,y: receive for x msec sleep for y msec and so on, indefinitely.
Default: 0
--netid [3..15 | 18] NETWORK ID. Note: PARAMETER values depend on NETWORK ID. Default: 18
--parameter [7..11,7..9,1..4,4..24]
PARAMETER. Set the RF parameters Spreading Factor, Bandwidth, Coding Rate, Preamble. Spreading factor 7..11, default 9.
Bandwidth 7..9, where 7 is 125 KHz (only if spreading factor is in 7..9) ; 8 is 250 KHz (only if spreading factor is in
7..10) ; 9 is 500 KHz (only if spreading factor is in 7..11). Default bandwidth is 7. Coding rate is 1..4, default 4.
Preamble is 4..25 if the NETWORK ID is 18 ; otherwise the preamble must be 12. Default: 9,7,1,12
--echo Retransmit received message
serial port config:
--port [/dev/ttyS0../dev/ttyS999 | /dev/ttyUSB0../dev/ttyUSB999 | COM0..COM999]
Serial port device name. Default: /dev/ttyS0
--baud (300 | 1200 | 4800 | 9600 | 19200 | 28800 | 38400 | 57600 | 115200)
Serial port baudrate. Default: 115200pi@raspberrypi: ~ /RYLR998-LoRa$ python3 rylr998.py --pwr 22 --port /dev/ttyS0 --band 902687500 --netid 6 pip install asyncio等等。
GPIO連接如下:
警告:弄錯了,您可以油炸Raspberry Pi 4和Reyax Rylr998Lora®模塊。敲木,我沒有問題,但是麻省理工學院的許可證沒有保修。檢查您的連接!在任何情況下,在Rylr998Lora®模塊上都有5V。只有3.3V。
確保禁用串行端口上的登錄外殼,但啟用了串行端口。在sudo raspi-config中,選擇接口選項,然後選擇串行。回答“否”對“您想讓登錄外殼可以通過串行訪問?”並回答“是”,以“您喜歡啟用串行端口硬件?”。
/boot/config.txt附加
disable-bt=1
enable-uart=1 禁用藍牙服務
sudo systemctl disable hciuart.serviceuart1 。我在/etc/rc.local中這樣做sudo dtoverlay uart1我建議Reyax Ryls135 USB至1.8V/3.3V/5V TTL UART橋,可從亞馬遜和其他供應商獲得。
與GPIO相似,只有VDD進入轉換器的3.3V輸出。 RX和TX像往常一樣互換; GND進入GND。請參閱下面的圖片。


asyncio.BoundedSemaphore() 。waitForReply是足夠的。xcvr(...)開頭的以下初始化(...): eloop = urwid . AsyncioEventLoop ( loop = asyncio . get_event_loop ())
uloop = urwid . MainLoop ( widget , event_loop = eloop )
uloop . start () # main_loop.py suggests using this instead of run().在xcvr(...)呼叫中raise KeyboardInterrupt插入之前
uloop . stop ()xcvr(stdscr) ,一次是一個輸入字符,作為狀態和當前輸入字符的函數。refresh() ,而是調用win.noutrefresh()並設置一個骯髒的位。curses.doupdate()被調用,臟位是重置的。這是一個優化。Brownlee,J.,Ph.D。 (2022)。 Python Asyncio Jump-start:異步編程和與Coroutines的非塊I/O(第7卷第7卷,第7卷,Python confistrency jump-start Series)。於2023年1月22日從https://superfastpython.com/python-asyncio-jump-start/ ISBN-13 979-8361197620檢索
詛咒 - 字符細胞顯示器的終端處理
“ Reyax Rylr998 Rylr498Lora®在指揮指南”(C)2021 Reyax Technology Co。 ,Ltd。從https://reyax.com//upload/products_download/download/download_file/lora_at_command_rylr998_rylr498_en.en.pdf檢索,從https://reyax.com//upload/products_download/download/download/download_file/download_file/products_download/download/download_file/products_download/products_download/
Lora®Mark和徽標是Semtech Corporation或其分支機構的商標。

此屏幕截圖顯示了運行rlyr998.py程序的mobaxterm會話。黃色文字是發件人的文字。收到的文字是洋紅色。當rylr998.py檢測到收到的文本時,如果消息足夠長,則“ lora”指示器會閃爍綠色;文本的傳輸閃爍“ Lora”指示器紅色。顯示了最後一個接收的消息的ADDR(地址),RSSI和SNR值。短信限制為40個字符(此版本)。
這是一項正在進行的工作。我要花時間在Python詛咒庫中添加類似IRC的顯示功能,並刻意用所有的懶惰來慢慢地,慢慢地,如果我在專業上進行此操作,我將被解僱和黑名單;如果我在大學上大學,則不受學位和一大量掠奪性私人學生貸款的驅逐和驅逐出境;如果我是院士,則被拖累和解凍。我不隸屬於Semtech Corporation。