Base Station Setup
The base station is a Python CLI that connects to a RYLR LoRa module via serial, receives images from the ESP32-CAM, and provides interactive commands.
Requirements
Section titled “Requirements”- Python 3.10+
- A second RYLR896/RYLR998 module connected via USB-to-serial adapter
pyserialpackage
pip install pyserialBasic usage
Section titled “Basic usage”python tools/lora_receiver.py --port /dev/ttyUSB0This starts the base station with default settings:
- Station address: 0
- Camera address: 1
- Network ID: 0
- Spreading factor: 9
- Output directory:
./images
Full options
Section titled “Full options”python tools/lora_receiver.py \ --port /dev/ttyUSB0 \ --address 0 \ --camera 1 \ --network 0 \ --sf 9 \ --bw 7 \ --cr 1 \ --output ./images| Flag | Default | Description |
|---|---|---|
--port | (required) | Serial port for RYLR module |
--baud | 115200 | Serial baud rate |
--address | 0 | This station’s LoRa address |
--camera | 1 | Camera’s LoRa address |
--network | 0 | LoRa network ID (0–16) |
--sf | 9 | Spreading factor (7–12) |
--bw | 7 | Bandwidth: 7=125kHz, 8=250kHz, 9=500kHz |
--cr | 1 | Coding rate (1–4 maps to 4/5–4/8) |
--output | ./images | Directory for saved JPEG files |
Interactive commands
Section titled “Interactive commands”Once running, the CLI accepts these commands:
| Command | Shortcut | Description |
|---|---|---|
capture [addr] | c | Request immediate capture from camera |
status | s | Request status report (heap, uptime, RSSI) |
ping | p | Simple keepalive check |
config key=value | cfg | Update camera config at runtime |
list | ls | List received images |
show [num|name] | — | Open an image (defaults to most recent) |
help | h | Show help |
quit | q | Exit |
Configuration keys
Section titled “Configuration keys”These keys can be set remotely via the config command:
config period=30000 # Periodic capture every 30 seconds (ms)config motion=1 # Enable motion detectionconfig motion=0 # Disable motion detectionconfig threshold=20.0 # Motion threshold percentageTransfer progress
Section titled “Transfer progress”During an image transfer, the CLI shows a progress bar:
[RX] New image: id=1 320x240 8432 bytes (51 frags) CRC=A3F2 RSSI=-45 SNR=9 [################--------------] 53% (27/51)After completion:
[RX] Image saved: ./images/2025-01-29_14-32-01.jpg 8432 bytes in 12.3s (686 B/s) 320x240 CRC OK Total images: 1