Skip to content

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.

  • Python 3.10+
  • A second RYLR896/RYLR998 module connected via USB-to-serial adapter
  • pyserial package
Terminal window
pip install pyserial
Terminal window
python tools/lora_receiver.py --port /dev/ttyUSB0

This starts the base station with default settings:

  • Station address: 0
  • Camera address: 1
  • Network ID: 0
  • Spreading factor: 9
  • Output directory: ./images
Terminal window
python tools/lora_receiver.py \
--port /dev/ttyUSB0 \
--address 0 \
--camera 1 \
--network 0 \
--sf 9 \
--bw 7 \
--cr 1 \
--output ./images
FlagDefaultDescription
--port(required)Serial port for RYLR module
--baud115200Serial baud rate
--address0This station’s LoRa address
--camera1Camera’s LoRa address
--network0LoRa network ID (0–16)
--sf9Spreading factor (7–12)
--bw7Bandwidth: 7=125kHz, 8=250kHz, 9=500kHz
--cr1Coding rate (1–4 maps to 4/5–4/8)
--output./imagesDirectory for saved JPEG files

Once running, the CLI accepts these commands:

CommandShortcutDescription
capture [addr]cRequest immediate capture from camera
statussRequest status report (heap, uptime, RSSI)
pingpSimple keepalive check
config key=valuecfgUpdate camera config at runtime
listlsList received images
show [num|name]Open an image (defaults to most recent)
helphShow help
quitqExit

These keys can be set remotely via the config command:

config period=30000 # Periodic capture every 30 seconds (ms)
config motion=1 # Enable motion detection
config motion=0 # Disable motion detection
config threshold=20.0 # Motion threshold percentage

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