I have purchased this 4G HAT and I'm using it with this module in a raspberry 4. I use the USB connection.

I installed a ppp connection and everything is working correctly. My problem is: how do I send AT commands? I want to test several things, such as send sms or put the module in sleep mode.

I tried solutions like the ones shown here. However I don't know which device I should choose (in the example ttyACM0) and I tried a few but it gives the error:

serial.serialutil.SerialException: [Errno 16] could not open port /dev/ttyUSB3: [Errno 16] Device or resource busy: '/dev/ttyUSB3'

EDIT. The output for lusb:

pi@raspberrypi:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 2c7c:0125 Quectel Wireless Solutions Co., Ltd. EC25 LTE modem
Bus 001 Device 004: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 003: ID 2a7a:9a18  
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

and dmesg (the section of correspondent to the GSM card)

[    3.212448] usbcore: registered new interface driver usbserial_generic
[    3.212527] usbserial: USB Serial support registered for generic
[    3.234675] usbcore: registered new interface driver cdc_wdm
[    3.239163] usbcore: registered new interface driver option
[    3.239260] usbserial: USB Serial support registered for GSM modem (1-port)
[    3.239749] option 1-1.4:1.0: GSM modem (1-port) converter detected
[    3.248897] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB0
[    3.250162] option 1-1.4:1.1: GSM modem (1-port) converter detected
[    3.252576] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB1
[    3.253795] option 1-1.4:1.2: GSM modem (1-port) converter detected
[    3.255273] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB2
[    3.257057] option 1-1.4:1.3: GSM modem (1-port) converter detected
[    3.257961] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB3
[    3.299767] qmi_wwan 1-1.4:1.4: cdc-wdm0: USB WDM device
[    3.300850] qmi_wwan 1-1.4:1.4 wwan0: register 'qmi_wwan' at usb-0000:01:00.0-1.4, WWAN/QMI device, 5a:d7:9a:8e:3c:e9
[    3.309017] usbcore: registered new interface driver qmi_wwan
  • You question title is a bit to vague. You 4G module can do a lot things, but I would suggest to narrow down to text SMS (what you specified), forget voice etc, and also focus on fastest LTE, forget slow guys like GMS etc. So if you agree, I can edit the title for you, to make it more specific, to something like this: "How can Rpi4B python use USB/UART/Serial AT commands to control a 4G/LTE module to text SMS?" You comments and counter suggestions welcome. Ah, lunch time, I need to go. See you later. Cheers.
    – tlfong01
    Commented Feb 25, 2020 at 4:44
  • 1
    When you plug your 4G Hat into the Pi using USB what shows up when you type ‘lsusb’ and ‘dmesg’? It should show you which port has been assigned.
    – CoderMike
    Commented Feb 25, 2020 at 8:56
  • 1
    @CoderMike, added the output for the commands. Meanwhile, I found that if running with sudo, I don't have that error. However, the script doesn't send any message. Just hangs and do nothing.
    – Miguel
    Commented Feb 25, 2020 at 10:19
  • 1
    Thats weird, why do 4 usb ports get connected?
    – CoderMike
    Commented Feb 25, 2020 at 11:00
  • Ah, let me see. I would like to know how you connect Rpi to the SixFab module. Are you doing the ninja trick of barebone USB direct connect to barebone USB as shown in Appendix B of my penzu reading log? penzu.com/p/9fb61b9c.
    – tlfong01
    Commented Feb 25, 2020 at 13:41

2 Answers 2


I have the same product. If you haven't yet found out it is /dev/ttyUSB2 port almost certainly based on your screen shot. Try apt install minicom. And start it with sudo minicom -s. Go to 'serial port setup'. Change selection labeled A to /dev/ttyUSB2 and change selection F to no. Hit enter next, with 'Change ...' field blank and you back one menu. Save as 'dfl'. Their idea of 'default'. Then just select 'Exit' into program. Here most likely you won't see keyboard inputs because 'echo' is off on module. If you see ur keyboard inputs you can enter AT commands. The pdf of AT commands you can google. Osmocom website, some where in it, also has tech stuff about EC25. Mind the AT commands you enter b/c hard to know which command changed something you didn't want changed. Oh going back few sentences, if don't see ur keyboard inputs enable Microcom 'echo' by 'ctrl + a, then z to see menu,then e to enable echo and puts u back to blank screen that isn't at all helpful but playing around few times you'll get it. If you want to use adb look on github cat named 'ngohaibac' has repository bout '... ADB issues'. My experience wasn't exactly like his but googling error msg you'll figure it

  • 2
    Please structure the text into paragraphs, it is unreadable!
    – MatsK
    Commented Apr 12, 2020 at 14:33

/dev/ttyUSB3 is likely busy because it is used by pppd. Run  lsof /dev/ttyUSB3 to confirm.

If you need to send AT commands while using the PPP connection (typically, as a part of the startup sequence), you should add those commands to pppd configuration scripts (located in /etc/ppp/chatscripts/ if memory serves).

If you want to test various AT commands interactively, you should stop pppd. You won't have the PPP connection, but /dev/ttyUSB3 will not be busy and you'll be free to used it as you please.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.