Installing 3G modem

If you have 3G modem, you can easily connect it to your precious RPi and have internet everywhere you go. This can be first step to turn your RPi into wireless 3G router or you can just do it to make sure, that wherever you go, XBMC would be able to download subtitles for the movie :) So, here are step by step instructions… If you need to buy 3G modem, make sure that it is well supported by RPi – this article was tested using Huawei 220. Verified peripherals can be found here

Before we start, connect your modem to powered USB hub and connect the hub to your RPi. Now you can turn on RPi.

I always recommend running package update before we start installing anything:

No we need to install ppp:

Now we need a client to connect to the internet – name of the program is sakis3G.

[14-June-2013] sakis3g stopped working for me in raspbmc. If you also have problems see bottom of the article where I use wvdial.

SAKIS3G version

Since at the time when this article was created, web site was not working, you can download sakis3g from our server. From RPi shell you can download it like this:

I suggest you copy the file to /usr/bin/modem3g directory and unpack it:

Sakis3G is smart enough to read internet settings from your sim card – all you need to do is to point it to use the right connection setting.

Here is what we get without any further configuration (for now):

Internet is a APN setting from my SIM card. In order to use it you can start sakis3g with the command as in example above and adding connect word, but personally I suggest creation of /etc/sakis3g.conf file with single line:

Please note that the line can be different for your operator/APN setting. In case (for some reason) sakis3G is not able to detect your internet APN setting you can enter in conf file all other necessary information. In this case follow instructions from ./sakis3g man sakis3g.conf

When you’re done with creation of /etc/sakis3g.conf you can now run:

To disconnect just run:

If you don’t want to play with conf file you can always start sakis3G in interactive mode (even in console):

wvdial version

WVDIAL is less intuitive then sakis3g and I find it quite hardcore but so far I haven’t found more decent replacement.
First, we need to install wvdial:

Once installed we need to create a config file for it (/etc/wvdial.conf). Content of this file may be a bit different for some of you (if it is, let me know) but here is mine:

Section [Dialer Defaults] is automatically created when wvdial is installed. I have added section [Dialer play], because my GSM operator is PLAY MOBILE :). [Dialer play] section overrides settings from [Dialer Defaults] if there are any conflicts. Let me try to explain what [Dialer play] config items mean:

Full list of options can be found here:

Now we can connect (I suggest starting it in a separate shell thus & at the end; “play” is a name from a config file):

Now you’re connected!… but how do disconnect?

Please note the line “[1] 3143” – 3143 is your connection process PID. You need it to disconnect properly by issuing the following command:

When I was testing this I realized that you should not be connected to the internet (i.e. via eth0) when modem connection is initiated. For some reason RPi would not get proper DNS even if you disconnect eth0 after you connect with the modem, so: first disconnect your lan cable and then connect.

Let me know is something is not working for you (use Discuss below)

Configuration for PLAY was found here.

Here is your raspberry pi ampilight system!
  • Jacek

    Dear Readers!

    I have just realized that (for some reason) sakis3g stopped working and throws an error:

    ./sakis3g: 296: ./sakis3g: /tmp/sakis3gz.1600.sakis3g: Permission denied

    No idea why… I will fix this tutorial to use wvdial in a few days.

    Sorry :(

  • zhii dai

    very helpful,thank u. i’v met the same question.

  • vorameghana

    3G modem connects any PC to Internet through high speed mobile broad band connection. A 3G device broadcasts Internet signal through air waves instead of sending it using telephone or cable line.

  • Pingback: Raspberry Pi and 3G Dongle | Mathew Jenkinson()

  • Ivor Smorenburg Aguado

    I made this script so you can execute (need internet connection first time to download stuff) and then will configure umtskeeper and 3gsakis, it will make the connection, is working with my carrier Tuenti and huawei k3772 dongle, so you have to modify the line 51 to connect with your setting hope it will be helpfull =)!J9UFiBIZ!VsW4GWTcnqABHAAqG7UayUxz_aVHYlwSbvmowQXD2so

  • Bas Bruins Slot

    Hi Jacek,

    Thanks for your tutorial. I tried applying it to my Huawei E220 with Vodafone. The sim has a data-only subscription. It requires a pin-code to activate. I found a piece of wvdial.conf on another site, but it also doesnt seem to work. What more could I try?

    [Dialer Defaults]
    Init1 = AT
    Init2 = AT+CPIN=”0000″
    Init4 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    Init3 = AT+CGDCONT=1,”IP”,”internet”
    Phone = *99***1#
    ISDN = 1
    Username = internet
    Password = internet
    Modem = /dev/ttyACM0
    Baud = 460800
    Stupid Mode = on

    • Jacek


      That may be a bit silly question but can you disable PIN protection? (you can try putting the card into the phone and remove PIN protection)
      Does E220 led blink? If yes, what color and what frequency?


      • Bas Bruins Slot

        This is kindoff embarrasing… It’s a sim from my company, and apparently they closed the subscription on the sim last week…

        Now I still don’t know if it works haha.

    • andycrofts

      Think modem should be changed from:
      Modem = /dev/ttyACM0
      Modem = /dev/ttyUSB0

  • Tristan Murray

    Does it actually require a powered hub? I need it to not :/
    If it does, does anybody know one that doesn’t?

  • Svazquezr

    Hi, this is my version to install 3G modem with Raspberry Pi, it is in Spanish but could help to some who wants to use the Google Translate, and it could be easily without Google Translate because it has images to guide…

  • Saúl Vázquez

    I just would like to confirm that it was made a blog name change for Professional issues and here is the correct link: for configuration 3g modem and i would like to apologize to all those who experience discomfort is caused by the same. Greetings. :)

  • Dan

    I installed sakis3g but haven’t used it to connect/disconnect. Have managed to set up and use wvdial successfully, although I should try sakis3g, it looks simpler. I have an automated process that dials, sends a file and then disconnects, problem is each time you run ‘sudo wvdial &’ you get assigned a new PID so you can’t automate the ‘sudo kill -1 xxx’ unless you can make the xxx a variable, but then how do you capture it at the time it’s assigned. I ended up just using ‘sudo killall wvdial’ which seemed to do the same job.

    @tristan_murray:disqus I am using a Huawei E173 and it works perfectly connected directly to the RPi’s USB.

  • Franek

    Thanks for the link :)

  • Iman F

    Hi Jacek
    it’s a great Tutorial
    but I want to ask, if we want to unused conecction internet or shutdown raspberry, before unplug USB Modem, how to safely remove usb modem on raspberry pi?
    like in windows, there are feature for safely remove hardware and ejectmedia

    • Jacek

      I have never tried it. I hope that Google can help you. Let us know if you find a way to do that :)

  • Dave Jones

    Hi. Great tutorial thanks. sakis3g worked for me, no problem. I installed on raspbmc. My question: How can I start sakis3g on raspbmc in the background? There’s no terminal and I cannot ssh in once the 3g connection is up

  • Ricardo Rojas S.

    Excelente tutorial! Además te permite crear un acceso directo en tu escritorio de Raspbian, para los que no quieren escribir sus lineas de comando en la consola. Thank!

  • Amateusz

    Great. I used Nokia 6230i which is a modem over USB (ttyACM0), and sakis3g couldn’t make the phone establish a connection. The round way with wvdial wasn’t that long and this program has just done it. Tip: authors config works for this phone (AT commands), just change the device. Just great! (~też w playu ;) )

  • Julian Grammer

    Thanks for a painless solution to what was previously a painful problem. worked immediately with unlocked huawei E1550 on 3 network. Originally failed on EE network, but I’ve since discovered that my plan does not allow use of that SIM in a dongle – only mobile data from a phone.

  • Marcos Pasquin

    Hello, Do you think this set up will we be ok to do remote desktop and download small files from far away .
    Thank you

  • mudit

    i have installed rasbian jessie on my raspi 2.I am trying to connect to 3g using sakis3g. Mode Switch was successful but when i try to connect to 3g,it shows error “failed to connect” after displaying “Locating tty”.,it doesn’t ask for apn or password or anything..I am using huawei mobile broadband(EC315). Plz help…

  • PiAnywhere

    Hey, This powerful HAT gives you 4G, 3G or GSM mobile data, GPS, Bluetooth and a rechargeable power source for your Raspberry Pi.

    check it out…