33cmバンドReyax Rylrr998LORA®モジュールを使用した2ウェイテキストメッセージ用のPythonプログラム。
ここにはスレッドはありません。非同期の非ブロッキングI/O呼び出しのみがあります。
注:Rylr998をReyax Ryls135 USBに1.8V/3.3V/5V TTL UARTブリッジに接続することをお勧めします。このハードウェアとRaspberry Pi 4(または5---まだテストされていない)を使用すると、ソフトウェアは/boot/config.txtを変更せずにDigIPIアプライアンスソフトウェアと互換性があります。
警告:Windowsにはwindows-cursesが必要です。これは、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®モジュールを揚げることができます。私は問題を抱えていませんでした、木材をノックしましたが、MITライセンスには保証なしに含まれています。接続を確認してください!いかなる状況でも、Rylrr998LORA®モジュールに5Vを適用しません。わずか3.3V。
シリアルポート上のログインシェルが無効になっていることを確認しますが、シリアルポートが有効になっています。 sudo raspi-configでは、インターフェイスオプションを選択し、シリアルを選択します。 「いいえ」から「ログインシェルをシリアル上でアクセスできるようにしますか?」と答えます。 「はい」に答えてください。「シリアルポートハードウェアが有効になるのが好きですか?」に答えてください。
Appendingで/boot/config.txtでBluetoothを無効にします
disable-bt=1
enable-uart=1 Bluetoothサービスを無効にします
sudo systemctl disable hciuart.serviceuart1有効にします。 /etc/rc.localでこれを行いますsudo dtoverlay uart1Reyax Ryls135 USBを1.8V/3.3V/5V TTL UARTブリッジにすることをお勧めします。Amazonおよびその他のサプライヤーから入手できます。
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ジャンプスタート:非同期プログラミングとノンブロッキングI/Oを使用したコルーチン(Vol。7、7 Vols。、Python Concurrency Jump-Startシリーズ)。 2023年1月22日、https://superfastpython.com/python-asyncio-jump-start/ ISBN-13 979-8361197620から取得
呪い - 文字セルディスプレイの端子処理
「Reyax rylrr998 rylr498lora®at command Guide」(c)2021 Reyax Technology Co。、Ltd。 2023年1月22日、https://reyax.com//upload/products_download/download_file/lora_at_command_rylrr98_rylr498_en.pdfから取得
LORA®マークとロゴは、Semtech Corporationまたはその関連会社の商標です。

このスクリーンショットは、 rlyr998.pyプログラムを実行しているMovaxtermセッションを示しています。黄色のテキストは送信者のテキストです。受け取ったテキストはマゼンタです。 rylrr998.pyが受信したテキストを検出すると、メッセージが十分に長い場合、「lora」インジケーターが緑色に点滅します。テキストの送信は、「ロラ」インジケーターを赤く点滅させます。最後に受信したメッセージのADDR(アドレス)、RSSI、およびSNR値が表示されます。テキストメッセージは40文字に制限されています(このバージョンでは)。
これは進行中の作業です。 Python Curses Libraryを使用してIRCのようなディスプレイ機能を追加するのに時間がかかります。ゆっくりと故意に、すべてのスマートルとともに、ゆっくりと解雇され、これを専門的に行っていればブラックリストに登録されます。私が大学にいた場合、程度と略奪的な私立の学生ローンのボートをかけずに、略奪的な私立の学生ローンを積極的に追放しました。私が学者だった場合、払い戻しと脱ロックされました。私はSemtech Corporationに所属していません。