USB cellular modems (such as the ubiquitous Huawei E303, E173, and E3372) enable Raspberry Pi 4 projects to send SMS notifications, handle emergency alerts, and provide cellular backup connectivity. However, modern USB modems initially boot into a virtual CD-ROM storage mode (ZeroCD) to deliver Windows drivers, requiring usb-modeswitch to toggle them into serial modem mode.
usb-modeswitch • Gammu SMS Gateway
1. Installing usb-modeswitch and Gammu
sudo apt-get update
sudo apt-get install usb-modeswitch usb-modeswitch-data gammu minicom -y
2. Switching from Mass Storage to Modem Mode
Check lsusb to identify your device vendor and product ID:
# Example: ID 12d1:1f01 (Mass Storage Mode)
lsusb | grep Huawei
# Mode-switch into serial modem mode (12d1:1001 or 12d1:14db):
sudo usb_modeswitch -v 12d1 -p 1f01 -M '55534243123456780000000000000011062000000100000000000000000000'
Confirm the modem serial nodes are created under /dev/ttyUSB0, /dev/ttyUSB1, and /dev/ttyUSB2.
3. Sending a Test SMS via Gammu
Configure ~/.gammurc:
[gammu]
port = /dev/ttyUSB0
connection = at115200
Send an automated test message:
echo "Alert: Raspberry Pi online!" | gammu sendsms TEXT +1234567890