Using AT Commands with the Huawei E303

Using AT Commands with the Huawei E303
Reuben Balik
July 29, 2015
Huawei E303

Last updated: February 5, 2020

Many of our customers using the Huawei E303 want to move beyond the HiLink feature of the modems described in our other tutorials and gain more low-level control by using AT commands. This method is more complicated, but can allow you to programmatically send SMS or disconnect the radio.

This Huawei E303 AT Commands tutorial was created on the BeagleBone Black, but most of the steps will apply to any Linux system and there are some notes for Windows users at the end.

Quick Navigation

  1. Switching the Huawei E303 into Serial Mode
  2. Creating a PPP Session
  3. Sending SMS
  4. Other useful commands
  5. Notes on Windows (#notes-on-windows)
  6. Other Useful Links (#other-useful-links)

Switching the Huawei E303 into Serial Mode

Before sending any AT commands to the modem, you need to switch it from the default HiLink mode into serial mode. Follow these instructions to get to that point:

  1. Boot up your BeagleBone, SSH to it, and login.
  2. We need to disable USB mode switching so that the modem doesn’t get stuck in HiLink mode when we plug it in. To do this, edit the file /etc/usb_modeswitch.conf and set DisableSwitching to 1. Here’s what it should look like if you’re using the nano editor:
screenshot of configuration
  1. Save the file and reboot the board by typing reboot
  2. Plug in the USB modem and type lsusb. You should see a line in the output like this:

    Bus 001 Device 002: ID 12d1:1f01 Huawei Technologies Co., Ltd.
  3. The 12d1:1f01 indicates that the modem is in storage mode and we need to switch it to serial mode. To do that, type this command:

    usb_modeswitch -v 0x12d1 -p 0x1f01 -V 0x12d1 -P 0x1001 -M "55534243000000000000000000000611060000000000000000000000000000"

    To confirm that it worked, type lsusb again. The line should now show:

    Bus 001 Device 003: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem

    Note: Some users have reported that this only works with the -I flag on the command. If the modem doesn’t switch into 12d1:1001 mode, try rerunning the above command with -I.
  4. Now we need to connect to the modem . Type screen /dev/ttyUSB0. This will give you a blank screen session. Note that to disconnect and exit screen you need to type Ctrl+A and then k (There are many other utilities besides screen that will work for this as well, including minicom, but screen is included in the BeagleBone OS image.)
  5. To confirm that you’re actually talking to the modem, type AT . You should get an OKresponse. (If you can’t see what you’re typing, type ATE1 to turn echo on.)

Creating a PPP Session

Once you have access to send AT commands, you can use the Linux PPP daemon to establish an internet connection.

  1. Type the following commands exactly. You’ll want to wait for an “OK” response after each one so don’t copy and paste this whole block at once.


    If all goes well, your window should look like this:
Screenshot of window
Does your window match ours?
  1. Exit the screen session by hitting Ctrl-A and then k (Say yes if it asks if you’re sure.)
  2. Now you can start up a PPP server with this command:

    pppd debug -detach noauth defaultroute /dev/ttyUSB0 9600 > ppp.log &
  3. You should now be online. Let’s try pinging an IP address to be sure:


Sending SMS

Using AT commands you can easily send an SMS message from your device. (Note that SMS may incur additional charges.)
Starting from your screen session connection to the modem:

  1. Send AT
  2. Switch into text SMS mode (easier than the other mode) by sending AT+CMGF=1
  3. Prepare the message by sending AT+CMGW="+<phone number="">" The phone number includes the country code so to send an SMS to the US number 773-555-1234 you would send the command AT+CMGW="+17735551234". If it worked, you should get a >prompt.</phone>
  4. Type in your message at the prompt and hit Ctrl+Z to end the message.
  5. After you hit Ctrl+Z you should get a message back in the format +CMGW: X where X is a number. This number is needed in the next step.
  6. Send AT+CMSS=X where X was the number from the previous step.
  7. If all goes well you should get a +CMSS response followed by an OK. Your SMS should have sent!

Here’s a screenshot of a complete transaction:

Screenshot of complete transaction

Other useful commands

There are tons of commands for controlling various aspects of the modem behavior. Here is just a small sample:

  • ATI gives some useful information about the modem
  • AT^U2DIAG=0 will force the modem into serial modem mode every time it’s plugged in. Use AT^U2DIAG=375 to get back into HiLink mode
  • AT+CFUN=7 will turn off the radio and AT+CFUN=1 will turn it back on

Notes on Windows

Connecting to the modem to send AT commands on Windows is a little more complicated. When the modem is connected and is in HiLink mode you can go to the URL in any browser and the modem will switch into serial mode. However, this is only half of the solution. You need to install the Huawei Mobile Partner software and then you need to actually edit some of the driver files that it comes with in order to get Windows to mount the modem on a COM port. Instead of putting all of those instructions right here, there’s already a great tutorial for editing these files at another site.

Other Useful Links

I’d recommend the following links for more information on all of this. There is some great information out there on other useful AT commands and tips for automating and scripting the whole process.

Get started with Hologram today

  • Talk to an IoT expert
  • Receive a free SIM
  • Customize your plan