quectel.py is a lightweight command‑line tool to run quick health checks on a Quectel EC25/EG25‑G (and similar) modem over a serial interface. It logs key AT command outputs and performs basic network diagnostics (e.g., checking the usb0 interface and running a ping through it). Logs can be written to the console and optionally to a file.
This script opens a serial connection to your Quectel modem, sends a sequence of AT commands, and runs a few host‑level checks. It is helpful for bring‑up, field tests, and quick triage when a modem seems unresponsive or the data link is unstable.
What it does at a glance:
- Opens
/dev/ttyUSB*(defaults to/dev/ttyUSB2) at a configurable baudrate. - Sends a series of AT commands (e.g., basic identification and signal/registration checks).
- Checks Linux networking for the cellular data interface (e.g.,
usb0). - Attempts a connectivity test (e.g.,
pingto a known host usingusb0).
- Python: 3.8+
- Python package:
pyserial(pip install pyserial) (Usually, pyserial comes with python) - OS tools (Linux):
ip,ping - Module Plug-in: Need to plugin the module first.
Run with defaults (prints to console only):
python quectel.pySpecify a log file (writes everything to the console and to the file):
python quectel.py -w modem_diagnostics.logUse a custom serial port and baudrate:
python quectel.py -p /dev/ttyUSB3 -b 115200 -w out.log| Flag | Name | Type | Default | Description |
|---|---|---|---|---|
-w, --write |
log_file |
str |
None | Write logs to the specified file in addition to the console. |
-p, --port |
port |
str |
/dev/ttyUSB2 |
Serial port device for the modem. |
-b, --baudrate |
baudrate |
int |
115200 |
Serial baudrate used to talk to the modem. |
Tip: If you’re not sure which port to use, check with
dmesg | grep -i ttyUSBorls -l /dev/ttyUSB*after plugging in the modem.
This tool provides a fast, repeatable way to validate modem responsiveness and basic connectivity. Start with the defaults, then customize the serial port, baudrate, and log file as needed.