I have a situation where I need to install a cellular modem, from the console, in a remote weather station which is being powered by a Rapsberry Pi. I did a bit of shopping and bought an UNLOCKED Huawei e353 GSM device from Amazon. The e353 works with T-Mobile and AT&T in the United States as long as you have an appropriate data plan and you are actually within range of their towers. I got this setup and working in the house so far and all looks good. I’m hoping my experiences and the information resources I’ve found might be of help to someone else out there.

Tigo-Huawei-4g-Adapter

Important Note: I’ve discovered if you plug the stick in after the Raspberry Pi is booted, the Pi will reboot anyways because of the power draw. You can get around this problem by using a USB hub, or by finding a way to power the USB stick separately from the Pi but still connecting the data and ground lines to the Raspberry Pi. Until you fix this, you will have a hard time having success with the rest of this information.

In order to run the Huawei e353 you’re going to need a some utilities. The first is usb_modeswitch, the second is the PPP daemon and third, if it’s not already installed, the lsusb utility. To install these, log into the Pi and use the commands ‘sudo apt-get install usb-modeswitch’ and also ‘sudo apt-get install ppp’ if you need libusb you should run the same command with libusb.

I should note that I am using the Wheezian image direct from Raspberry Pi, it’s an older version I needed to be compatible with the wview weather station software, which is used to monitor the weather station hardware. It seems these cellular sticks are compatible across several Wheezian releases though specific functionality such as QMI (device acting as a network card without all this dialer and PPP stuff) may require newer versions for full support.

It’s also important to keep in mind that this is just one of several methods for connecting your Pi with a cellular modem like the e353. Please read and bookmark this page, do your research and if you decide this is the best option, come back, read the instructions and then attempt it yourself. If you found a better solutiong, please, let me know. There is also a program called wvdial, and one called Sakis3g. The Sakis3g website is up and down more than a yo-yo it seems, so you usually have to download it from the Sakis3g github site. If you are running a windowed environment there are several other utilities available as well, some of them built in already, but I have no experience with them.

When you first plug the Huawei e353 broadband modem into your Raspberry Pi, it should power up and initially start showing a green LED with a double flashing light. If a network is in range and your SIM is good it will switch to flashing green or flashing blue depending on network type. This is a good start. If you run the command lsusb you should see the following line or something very similar in the list of USB devices.

The modem is currently in mode 1446 which is mass storage mode and this won’t work for connecting to cellular GSM/GRPS broadband, using the serial method. If you do a ‘ls /dev’ you should also notice there are no ttyUSB# devices listed (where the number is something like 0,1,2,3). In order to get the device into a mode where you can access the serial ports you will need to run usb-modeswitch on the device.

You’ll need to install the proper config file for usb-modeswitch. cd to the /usr/share/usb_modeswitch directory and extract the file called configPack.tar.gz using the command ”sudo tar -xzvf configPack.tar.gz” then do an ls of the directory, a bunch of colon separated hex numbers will show which is good.  now type in the command “sudo cp 12d1\:1446 /etc/usb_modeswitch.d” to copy the config file for our modem over there.  That config file is actually for a lot Hauwei modems, so if you’re not using the e353 this process may still work for you.

At this point, go ahead and restart the Pi using “sudo shutdown -r now” leaving the e353 cell stick plugged into a USB port. I’ve discovered if you plug the stick in directly to the Pi USB Port after the Raspberry Pi is booted, the Pi will reboot anyways. You can get around this problem by using a USB hub, or by finding a way to power the USB stick separately from the Pi.

Once the pi has rebooted and you log back in, do a lsusb command and you should see the following line. USB_Modeswitch has automatically configured the device in the right mode for you to communicate with it.

You can now see that the Huawei e353 has switch modes to 1506, you’ll probably have also noticed that the description has changed as well as the model number. This is just educational as it doesn’t affect what we are doing as far as the setup. As long as the Vendor ID is 12d1 and the Product ID is 1506 you can keep moving forward. If you’re not using the e353 stick, it may show a different number, just proceed to the next step and let’s see if we have some com ports available.

If you run the command ‘ls /dev’ you should see some new ttyUSB ports such as the following.

ttyUSB0
ttyUSB1
ttyUSB2

On the e353, ttyUSB0 is the modem command port where you can send Hayes type AT commands to the modem to connect to your service provider.  You can use screen to check the communications but you don’t HAVE to, it’s up to you. If you use screen, you’ll need to install it first using ‘sudo apt-get install screen’ and the run it from the command line as ‘screen /dev/ttyUSB0 9600’  once it comes up just type ‘AT’ and hit enter and you should see the response ‘OK’

If everything’s going good so far we need to configure pppd. The next step may sound a bit odd at first, but it will make sense further on. First change directory to /etc/ppp (cd /etc/ppp) and type in ‘sudo mv options options.backup’ next type ‘sudo touch options’. You now have a backup of the original ppp options file for future use, and with the touch command you have created a new blank options file.

Using your favorite editor ( I use ‘Joe’ (sudo apt-get install joe) and the save command for that is CTRL-K (release CTRL-K) then X, CTRL-K then H alone for help) to edit the new options file with the following information(ex, ‘sudo joe /etc/ppp/options’):

Then save it (varies depending on your editor. )

In the /etc/ppp directory you also need to create a file called umts.chat which contains the following information, this is the chat script for PPPD to initiate the connection.  The important line is AT^NDISDUP line.  With T-mobile there are a few different APNs which can be used and it’s very important to know the difference.

The first two APNs epc.tmobile.com and fast.tmobile.com are designed for use by smartphones and allow data roaming to other providers networks such as AT&T. If you don’t have a data roaming plan with T-mobile your costs can go sky high. If you are using another provider other than T-Mobile you’ll also need to research them as well, it’s not my responsibility to determine the contractual responsibilities you have signed for! Depending on your plan you may or may not be responsible for roaming charges. It is your responsibility to find out what your plan is and how you want to use roaming. 

TMobile provides another APN, pcweb.tmobile.com this APN is specifically for computer broadband devices ranging from broadband access points to broadband sticks and the like.  I have not been able to roam when using this APN and am locked to the T-mobile network only. This is the situation in my case and you should be verifying it’s true in your case. Things may change, so make sure that is still the case either through contacting T-Mobile or through your own research. It’s also good to keep an eye on the T-Mobile account page to make sure you are not accruing billed roaming minutes or anything else throughout the period you are using the cellular modem. (Especially important if it’s a remote device that will be connects for a long time!)

It’s also interesting to note that T-Mobile’s page, at the time of the writing of these instructions, states that they have a DOMESTIC mobile roaming plan (does not include international) that allows limited data roaming at no additional cost to your existing data plan. You can find this in the T-Mobile Domestic Data Roaming FAQ but again, it is your responsibility to determine if this applies to you or not or if you will be charged for your data usage and do the right research. I can only state my case, which may be unique and not apply to you. T-Mobile’s chat support, from the support page, is really very helpful and friendly although they will not be able to help you with any specifics of setting up a device that they have not provided, they can provide information on APNs, etc.

For the sake of this information and better odds of connect I used the epc.tmobile.com APN below.  For my setup where I get a good T-Mobile signal I actually used pcweb.tmobile.com which won’t roam and leaves the domestic roaming data for use by my other cell phones on my plan.

And then save this as well. You should be able to try things out and see if they’re working. Type in the following command:

An alternate method for connection that I’m not totally clear on is to actually dial the data service withlines like

This works for some folks, but I had no luck with it but was also facing other technical hurdles which I had to solve (was roaming, didn’t know which APN to use, etc) at first.
Now, the nodetach option means that pppd will not detatch from the terminal so you will see all the status information and everything else (but not be able to do anything else). To disconnect you can type ‘killall -HUP pppd’ in the console and you can also just unplug the e353 cellular modem.

Your e353’s light should go from blinking green or blue to a solid light (green or blue depending on your network connection). If your modem is blinking double green flashes at you, make sure the SIM card is inserted properly and in good working condition. You can check the SIM card by going into screen (screen /dev/ttyUSB0 9600) and typing AT+CSQ (signal quality command)and it will spit back a number, or it will say ‘+CME ERROR: SIM failure’ if there is something wrong.

You should now be able to disconnect your Ethernet cable and ping websites via the broadband adapter, if not, check out the troubleshooting tips below.  It’s also important to note that pppd with this configuration will replace your DNS with the cellular network’s DNS servers. The addresses are stored /etc/resolv.conf (no e) edit this and take note of the addresses for future reference. If you need to go back toyour Ethernet DNS servers but don’t remember what they are you can add a line ‘nameserver 8.8.8.8’ which is Google’s DNS and easy to remember in case of emergency.

Troubleshooting suggestions:

Can I Disable Roaming?

I’ve been looking into that but have not found an answer, I would imagine it’s set through an AT command but I’ve not been able to find it, and online searches are not really helpful so far.  One person said that you might try to disable roaming on the device using the Windows software and that this setting would stay through to it’s use on another OS, but I don’t want to install the Windows software, last time it added a bunch of serial ports and somehow corrupted my Arduino IDE installation with them (too many, badly defined, not sure…)

What are APNs?

APN = Access Point Name, each network has one or more of these and you use your networks APN even if you are connected to another carrier’s network. If you are a T-mobile user, but roaming on an AT&T network, you would use the T-Mobile address (at least in my experience, using the AT&T APN leads to fail).

The APN’s that I know for T-Mobile are pcweb.tmobile.com (broadband, non-roaming at the time of this post, but may change), epc.tmobile.com and fast.tmobile.com (for LTE devices). No username or password required.

The APN that I know of for AT&T is ‘internet’ and possibly a username of ‘internet’ and password of ‘internet’. I don’t have an AT&T account so I can’t confirm that the username and password is required.  Refer to the  pppd documentation for adding those if needed.

How do I Tell which Cell Networks are Available?

Run screen (screen /dev/ttyUSB0 9600) and type in AT+COPS=?  (then wait a bit while the modem collects information)

How Can I Tell if I’m Roaming (and Signal Strength, GPRS Coverage, etc.)?

You can issue the AT+CIND=? command to show a list of statuses, ‘roam’ is the fifth status. 0 = not roaming, 1 = roaming as you can see in the list. To actually get the status use AT+CIND?

e353’s LED is Double Flashing the LED in Green

The double flash means that there is no network available. This could be for several reasons, but if you know you are in an area with cell service from your provide or a network you are allowed to roam on, you should check and make sure your SIM card is installed properly and not damaged. Disconnect the modem from your USB port, and re-insert the SIM card, then re-insert the modem into the USB port and see if things change. The reception quality on the e353 is not as great as my little flip phone. While I can get T-Mobile at home on the flip phone, I cannot connect to a T-Mobile tower from the e353 unless I’m closer to a T-Mobile tower. Use the AT+CSQ (Retrieve Signal Quality)command in screen to see if your SIM card is being properly read.

e353 Status Light Shows Connected to Network but I Can’t Ping or Use My Web Browser.

It’s possible your DNS servers are not set properly. Try to ping to a well known IP address such as ‘ping 8.8.8.8’ and see if you get a response, if you do, your DNS is not set properly. You can temporarily add ‘nameserver 8.8.8.8’ to your /etc/resolv.conf file to see if you are then able to connect to a website, and if that works you know your connection is good but you need to find a solution for your DNS servers.

Connecting to a network via the AT^NDISDUP=1,1,”<APNHERE>” command will connect you to the network, but unless pppd is working properly you will not get an actual internet connection.  Also on T-Mobile’s network, if you connect to pcweb.tmobile.com for your APN, but you are connected to another network, such as AT&T, you will be able to connect but get no response because pcweb.tmobile.com only works on T-Mobile towers for broadband data access and, as of the writing of this post, does not roam.  Taking into consideration the possibility of high roaming charges, depending on your plan, you can try using the epc.tmobile.com or fast.tmobile.com (LTE) APNs instead. You can disconnect via AT^NDISDUP=1,0

Can I Send SMS Messages with My Cellular Modem?

Yes you can, and receive them too! This is sometimes what people play with before going for full data connectivity. Look for a program called gammu, it’s pretty straightforward place to start.

I just can’t seem to connect and nothing seems to be working right, what else can I try.

You can try using screen (screen /dev/ttyUSB0 9600) and type in the AT commands from your modem chat script by hand one by one and see if one of them is generating an error. In some cases and with some modems and some providers, you might try adding ,”0.0.0.0″ to the NDISDUP line, so it reads as AT^NDISDUP=1,1,”<yourapn>”,”0.0.0.0″ and see if that works for you, on some modems this generates an error, on others it works fine.

Type ‘ifconfig’ at the console, what does it look like? The PPP0 adapter, when connected, should look like the picture below (click to zoom) if things are working right.

ifconfig

Check your routing table, it should look something like this (click to zoom).  If your default gateway is still set for your LAN/Ethernet connection type ‘sudo route del default’ then type ‘sudo route add default gw 10.64.64.64’ and see if everything is working. In your pppd config it should be set to ‘replacedefaultroute’RoutingTable

Additional Resources

A list of standard Cellular Modem Commands (Various, none specific to Hauwei I could find, look for ‘3g AT command set’ or ‘GSM AT command Set’ to get started. There are a TON of commands which you can use.

Some useful information on the ArchLinux Page

LinuxQuestions.org discussion of troubleshooting broadband modem connection problems (and where I got a lot of the info for my setup!)

I hope this info at least got you started with this particular device and maybe some other kind. This page will be updated as I learn more, if you have some good input, please share it. I’m all up and running now but I know others are going to be trying to find this information as well. I’ll let you know if I try the other methods and have good luck with them as well.

I ran into some problems with this modem, mostly in it’s range to the cell tower. I also set this up with an unlocked ZTE MF180 and it works as well. Newer and newer devices will come out which support the fast technologies, however the same basic principals of getting them to work should remain the same.

 

Tags: , , , , , , , , , , , , , ,