Integration tools and scripts for Quectel RM530 5G modem with Raspberry Pi using ECM mode
Project description
RM530 5G Integration
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:
- Detects modem and checks current USB mode
- Switches to ECM mode (if needed)
- Configures NetworkManager
- Activates the connection
- 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 modempyyaml >= 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
- CHANGELOG.md - Version history and migration guides
- CONTRIBUTING.md - Contributing guidelines
- Package Documentation - Detailed guides and references
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.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
- Issues: GitHub Issues
- Documentation: See the docs directory
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
235acfac335aa13d53a0dcadec9c34b9c64b883ace8c66675a9bf8164a614b28
|
|
| MD5 |
0d5531a724f5447938388609745262b5
|
|
| BLAKE2b-256 |
d6fb6ca32433e7c2b0c64c5da52d9330451c5de0efe0133635048f455ea5a006
|
File details
Details for the file rm530_5g_integration-4.0.1-py3-none-any.whl.
File metadata
- Download URL: rm530_5g_integration-4.0.1-py3-none-any.whl
- Upload date:
- Size: 63.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
729c599204343775585a1eebb0b78fe3fa6841838e1b31970cae121ec29ac8e0
|
|
| MD5 |
96ae62e13311eadd017a1f4c72ea9319
|
|
| BLAKE2b-256 |
ff8cced14c4893036df4526f9a3c745bbd343fcd0cb9884e3477c91dbb1b6649
|