Skip to main content

Integration tools and scripts for Quectel RM530 5G modem with Raspberry Pi using ECM mode

Project description

RM530 5G Integration

Python Version License: MIT PyPI version CI Status

Python package for integrating Quectel RM530 5G modem with Raspberry Pi using ECM (Ethernet Control Model) mode.

Overview

This package provides automated tools and comprehensive documentation for setting up a Quectel RM530 5G modem in ECM mode on Raspberry Pi. ECM mode provides native Linux integration with better stability and performance compared to QMI mode.

Features

  • ๐Ÿš€ One-Command Setup - Complete modem configuration in a single command
  • ๐ŸŽฏ Intelligent Modem Detection - Automatic detection across all USB modes
  • ๐Ÿ” Mode Detection - Detects current modem mode and switches only when needed
  • ๐Ÿ“Š Signal Quality Monitoring - Real-time RSSI, RSRP, RSRQ, and SINR metrics
  • ๐Ÿ“ˆ Connection Statistics - Bandwidth monitoring and connection stats
  • ๐Ÿฅ Health Monitoring - Automatic connection health checks and alerts
  • ๐Ÿ”„ Retry Logic - Robust error recovery with exponential backoff
  • โš™๏ธ Configuration Management - YAML-based carrier profiles and settings
  • โœ… Production Ready - Comprehensive testing and CI/CD pipeline
  • ๐ŸŽฏ Type Safe - Full type annotations for better IDE support

Installation

pip install rm530-5g-integration

From Source

git clone https://github.com/anand2532/rm530-5g-integration.git
cd rm530-5g-integration
pip install .

Development Installation

git clone https://github.com/anand2532/rm530-5g-integration.git
cd rm530-5g-integration
pip install -e ".[dev]"

Quick Start

Basic Setup

# Setup with APN
sudo rm530-setup --apn airtelgprs.com

# Or use carrier name (automatic APN from config)
sudo rm530-setup --carrier airtel

The setup command automatically:

  1. Detects modem and checks current USB mode
  2. Switches to ECM mode (if needed)
  3. Configures NetworkManager
  4. Activates the connection
  5. Verifies the setup

v4.0 Improvements: The setup now intelligently detects your modem's current mode and only switches when necessary, preventing unnecessary resets and improving reliability.

Check Status

# Check connection status and statistics
rm530-status

# Check signal quality
sudo rm530-signal

# Monitor connection health
rm530-health --once

Commands

Command Description
rm530-setup [--apn APN | --carrier NAME] Complete setup (ECM + NetworkManager)
rm530-status [--interface usb0] Check connection status and statistics
rm530-signal Display signal quality (RSSI, RSRP, RSRQ, SINR)
rm530-health [--once | --live] Monitor connection health

Configuration

Create ~/.rm530/config.yaml for carrier profiles:

carriers:
  airtel:
    apn: airtelgprs.com
    preferred_interface: usb0
    dns: [8.8.8.8, 1.1.1.1]
  jio:
    apn: jionet
    preferred_interface: usb0
    dns: [8.8.8.8, 1.1.1.1]

defaults:
  route_metric: 100
  autoconnect: true
  ipv4_method: auto
  connection_name: RM530-5G-ECM

Python API

Basic Usage

from rm530_5g_integration import RM530Manager, Modem, ModemMode

# Initialize manager
manager = RM530Manager()

# Complete setup (automatically detects and switches mode)
manager.setup(apn="airtelgprs.com", carrier="airtel")

# Check status
status = manager.status()
print(f"IP Address: {status.ip_address}")
print(f"Bytes Sent: {status.bytes_sent}")

# Get signal quality
signal = manager.signal_quality()
print(f"RSSI: {signal.rssi} dBm")
print(f"Network Type: {signal.network_type}")

# Verify connection
if manager.verify():
    print("Connection is working!")

Advanced: Manual Mode Detection

from rm530_5g_integration import Modem, ModemMode

# Check current modem mode
modem = Modem()
modem.connect()
current_mode = modem.get_mode()

if current_mode == ModemMode.ECM:
    print("Already in ECM mode!")
else:
    print(f"Current mode: {current_mode}")
    modem.switch_to_ecm_mode(apn="airtelgprs.com")
    modem.disconnect()

Health Monitoring

from rm530_5g_integration import HealthMonitor

monitor = HealthMonitor(
    check_interval=30,
    failure_threshold=3
)

# Single health check
status = monitor.check_health()
if status.is_healthy:
    print("Connection is healthy!")
else:
    print(f"Issues: {', '.join(status.issues)}")

# Start continuous monitoring
monitor.start()

Requirements

  • Python: 3.9+
  • OS: Raspberry Pi OS or Debian-based Linux
  • Hardware: Quectel RM530 5G modem
  • Software: NetworkManager (installed by default on most Linux distributions)
  • Privileges: Root/sudo access required for setup

Dependencies

  • pyserial >= 3.5 - Serial communication with modem
  • pyyaml >= 6.0 - Configuration file parsing

Optional Dependencies

  • rich >= 13.0 - Enhanced CLI output (progress bars, tables, colors)
  • sphinx >= 7.0 - Documentation generation (development)

Project Structure

rm530-5g-integration/
โ”œโ”€โ”€ rm530_5g_integration/
โ”‚   โ”œโ”€โ”€ core/              # Core functionality
โ”‚   โ”‚   โ”œโ”€โ”€ modem.py       # Modem communication
โ”‚   โ”‚   โ”œโ”€โ”€ network.py     # NetworkManager integration
โ”‚   โ”‚   โ”œโ”€โ”€ manager.py     # Main manager class
โ”‚   โ”‚   โ””โ”€โ”€ health.py      # Health monitoring
โ”‚   โ”œโ”€โ”€ config/            # Configuration management
โ”‚   โ”œโ”€โ”€ monitoring/        # Signal and stats monitoring
โ”‚   โ”œโ”€โ”€ cli/               # CLI commands
โ”‚   โ”œโ”€โ”€ utils/             # Utilities (logging, exceptions, retry)
โ”‚   โ””โ”€โ”€ scripts/           # Legacy scripts
โ”œโ”€โ”€ tests/                 # Test suite
โ”œโ”€โ”€ docs/                  # Documentation
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ CONTRIBUTING.md
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ pyproject.toml

Documentation

Troubleshooting

Run the verification tool to diagnose issues:

rm530-status

Or check signal quality:

sudo rm530-signal

For detailed troubleshooting, see the troubleshooting guide.

Contributing

Contributions are welcome! Please read our Contributing Guidelines before submitting pull requests.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Based on Quectel RM530 5G modem specifications
  • Compatible with Waveshare PCIe TO 4G/5G M.2 USB3.2 HAT+

Support


Ready to stream over 5G! ๐Ÿ“น๐Ÿš€

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rm530_5g_integration-4.0.1.tar.gz (51.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rm530_5g_integration-4.0.1-py3-none-any.whl (63.1 kB view details)

Uploaded Python 3

File details

Details for the file rm530_5g_integration-4.0.1.tar.gz.

File metadata

  • Download URL: rm530_5g_integration-4.0.1.tar.gz
  • Upload date:
  • Size: 51.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for rm530_5g_integration-4.0.1.tar.gz
Algorithm Hash digest
SHA256 235acfac335aa13d53a0dcadec9c34b9c64b883ace8c66675a9bf8164a614b28
MD5 0d5531a724f5447938388609745262b5
BLAKE2b-256 d6fb6ca32433e7c2b0c64c5da52d9330451c5de0efe0133635048f455ea5a006

See more details on using hashes here.

File details

Details for the file rm530_5g_integration-4.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rm530_5g_integration-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 729c599204343775585a1eebb0b78fe3fa6841838e1b31970cae121ec29ac8e0
MD5 96ae62e13311eadd017a1f4c72ea9319
BLAKE2b-256 ff8cced14c4893036df4526f9a3c745bbd343fcd0cb9884e3477c91dbb1b6649

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page