3G Internet on Raspberry Pi - Success!
This is a bit of a brain dump of how I got a 3G USB dongle working on the Raspberry Pi. Following on from getting the Raspberry Pi to send SMS.
That's The Power Of Love
The first thing to say is use a powered USB hub! I had lots of problems getting the modem working when it was plugged directly into the Pi. A 3G signal takes more power than the Pi's USB sockets can supply.

In the above image, you can see that the Raspbery Pi is plugged into the mains - via a 1.8A plug.
The USB cable has two male ends. The black plug goes directly into the Pi for data. The red plug goes into the mains via a 1A plug (an Amazon Kindle adapter).
I used a USB Y Cable to supply power and data.
I also tried plugging both plugs into the Pi - that didn't work either. You need a separate powered hub.
Rather than use two plugs, I'm going to try to find a mains plug with two USB sockets. Each socket needs to supply at least 1A. Something like this looks like it should do the trick.
Or, you can use a cable like this.
Put one male USB plug into the PI and the other into a power supply. The dongle fits into the female USB socket.
P-p-p-p-pick Up A PPPD
In order to get our network connected, we need to install the ppp package.
sudo apt-get install ppp
If You Think I'm Sakis, And You Want My Body...
I tried using wvdial and numerous other ways to connect to 3G. None of them worked reliably. In the end, I turned to sakis - the All-In-One script for connecting 3G modem.
Sakis says it is:
"The easiest way to have your 3G/UMTS/GRPS connection up and running."
I can't argue with that!
Installation is very simple:
First, download the latest version. The Raspberry Pi runs on an ARM processor, so this is the version we download.
wget "http://www.sakis3g.org/versions/latest/armv4t/sakis3g.gz"
The script is compressed. Unzip it.
gunzip sakis3g.gz
Finally, we want to make the file executable so that we can run it.
chmod +x sakis3g
Running sakis is quite straightforward. It has a basic GUI which will work even if you're just using the command line.
sudo ./sakis3g --interactive

Sakis has a fairly comprehensive list of connection details - it should find yours automatically and present you with this screen.

If it doesn't know your connection settings (if you're on GiffGaff for example) you can manually enter them.
All being well, after a few seconds, you should see this screen.

You can now exit sakis. You will stay connected.
To check the details of your connection, run the following command:
sudo ./sakis3g connect info
You'll get back something like this:
K3565 connected to giffgaff (23410). Connection Information Interface: P-t-P (ppp0) Connected since: 2012-07-13 07:36 Kilobytes received: 2 Kilobytes sent: 2 Network ID: 23410 Operator name: giffgaff APN: giffgaff.com Modem: K3565 Modem type: USB Kernel driver: option Device: /dev/ttyUSB0 IP Address: 10.136.6.52 Subnet Mask: 255.255.255.255 Peer IP Address: 10.64.64.64 Default route(s): 10.64.64.64
That's it! You can now access the Internet via your 3G modem.
Surfin' Safari
One last tip for you! There's no need to start your window manager to surf the web. There's a brilliant lo-fi web browser called Lynx.
You install it by typing:
sudo apt-get install lynx
You run it by typing:
lynx http://www.bbc.co.uk/news
(or whatever website you want to visit).

So, that should be everything you need to get the Raspberry Pi connected over a USB 3G dongle. Have fun!
If you want to stay a command line commando, you can always use Links2. It supports simple graphics. http://www.aboutlinux.info/2007/02/links2-cross-platform-console-based-web.html Although it may have been depreciated / taken out of the repository by now.
I'll take a look at that - thanks!
Magnificent! Thank you for this tip.
Ever since I ordered my Raspi, Ive been tossing and turning my brain on how I can connect to 3G with it.
Hi there,
I've been reading a lot about Raspi, being a former A-Level computer science student (back in the early/mid 1990s). It's a great idea. But after hearing more on the Guardian tech weekly podcast I got wondering, would is be possible to also create programming simulators for iphone/ipad/android as another simple way to get kids back into the fun of programming? Using some simple gamification to create interest.
Hi!
I need some help to connect a vodafone usb modem with my raspberry.
Are you installed an external library? I'm working with Wheezy and Sakis3g has some issues to connect it..
Thanks!
What issues?
Hi,
if I try to connect the HUAWEI E220 it works fine but with ZTE K3765-Z sakis3G show me an error "Failed connection"
how do I access this w/o a internet?
hi
I am trying to setup my E220 modem.
May i know which version OS are you using?
I am using ArchLinux.
Thanks
Rgds
Richard
I used Wheezy - the Debian build.
Thanks..
Tried that but it did not work will with webcams.
Will get another sd card for wheezy....
thanks
Is there a way to share this internet connection with other (Windows) PC's on my LAN?
I'd like to know this aswell
Have a look at this Tutorial, guys:
http://elinux.org/RPI-Wireless-Hotspot
Might work for u....
Hello,
I've successfully installed sakis and get it worked perfectly. I've also installed no-ip client to get a dynamic IP and it works. I easily connect through lan via ssh and tightvnc but i cannot get access to ssh ot vnc via the 3G connection even if i use the direct IP read from ip addr
I've tried also without the lan connection, no-ip resolve the dns as I see it changes after a while, but no connection at all.. any suggestion?
Are you trying to SSH *in* to your Pi via 3G?
It's likely that your network provider is blocking the ports needed. Try moving your SSH daemon to port 80, or 8080.
changed to port 80. it's a vodafone sim that works perfectly with the samsung galaxy tab. no access, only via lan. network connection timeout.. i've also tried to change route priority to ppp0, no success.. as the no-ip client sends correctly the ip to their dns servers, the 3G internet connection works.. anyway i've tried to connect directly to the ip shown with ip addr (which is the same that appears after a while issueing a ping to the dns)
really strange....
this is the ip addr output regarding the ppp0 interface..
3: ppp0: mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 3
link/ppp
inet 37.183.99.123 peer 10.64.64.64/32 scope global ppp0
ok. I've fixed it. the main issue is that if you connect through a 3G USB dongle you don't have a public IP address but a network one. so you need a reverse connection. to do that, just act that way:
suppose you are trying to connect via a windows machine with a fixed ip and with a port forwarding in the router for port 22, with user USER and password psw
on raspberry machine, execute this command after the 3G connection:
ssh -R yyyy:localhost:22 [email protected]
where yyyy is a free port, xxx.xxx.xxx.xxx the fixed ip of the windows machine. once connected, authenticate with the windows USER psw. use sshpass -R yyyy:localhost:22 -p 'psw' [email protected]
install sshpass with apt-get install sshpass
replace psw with the windows USER password
you can use a ssh server (a free one such bitvise ssh server) running on the windows machine to get the connection.
on the windows machine, using a ssh client issue the command
ssh localhost -p yyyy where yyyy is the same port of the raspberry connection. you will get reverse access to the raspberry pi machine connected to the internet through a 3G USB dongle..
that's all. works perfectly.
right now i don't have Internet in my raspberry pi, is it possible to download sakis3g.gz & copy on a Pen-drive & install it on raspberry pi,
Step by Step Instruction will be helpful as i'm totally new to linux.
Thanks & regards,
Sanjay
Yes. You can download the file on the usb stick - or directly on to the SD card. Then install it.
Full instructions can be found on the site http://www.sakis3g.org/#binaryfree
how to get raspberry pi to automatically connect to 3g network on every boot up?
I tried to follow this guide http://www.sakis3g.org/versions/latest/guruplug/guruplug.html
but no luck :( it seems that my modem does not get into proper mode first, but if I run sakis3g it switches automaticaly and it connects, however with /etc/udev/rules.d/ files it does not...
Take a look at this Page which will show you how to run commands automatically on startup http://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html
Note, you may also need to follow this guide so you don't have to enter your password every time http://wiki.sakis3g.org/wiki/index.php?title=Sakis3G_with_sudo
Hi Terence!
First of all, thank you for posting these instructions.
They helped me setting up the GPRS connection from my raspberry pi tremendously! :)
One question though...
You mentioned at the beginning of your post that a powered USB hub has to be used.
I plugged the Huawei Vodafone modem directly into the USB slot of the RPi (without the powered USB hub) and it works fine. It successfully connects to the internet and I'm able to do all the browsing and stuff.
Since I'm using the latest revision of the RPi (rev 2, the one made in the U.K., bought in september 2012), have you perhaps heard if the USB powering problem has been fixed for that revision? Or is it possible that I'll will be experiencing the random dropping of my GPRS connection?
Hi Marko,
It's possible that the new boards give more power. If you're on 2G (GPRS) that also uses less power, so that might be the reason.
T
Hi Terence
Thanks for the article and heads up. Unfortunately we are getting an error message with our huawei hilink on O2. It basically says, "Failed to connect". Any ideas please?
Thanks
Rich
Is it plugged into a powered USB hub?
Do you have credit on your SIM?
Are you allowed to use dongles on your mobile tariff?
Any more specific errors?
Terence, you really are a life-saver :) I was troubleshooting ZTE MF688 for a week because device was obviously restarting when I made wvdial connection. It's so simple, I just plugged 3G modem into powered USB hub and it worked. Thanks for the advice!
Will it work also for EVDO modem? Thanks.
It should do. Try it and tell us :-)
I am actually waiting for my Raspi, I'll try it once it arrived. Thanks.
Hi, could this work on Raspbian with Vodafone Mobile Broadband K3770, HSPA USB Stick (Huawei Technologies)? (It's a pay-as-you-go service which I have topped up.)
I have the first revision Pi. I don't yet have a powered hub, trying the above steps with it plugged directly into the Pi, the device showed in the list, but gave "failed to connect" when selected. Is a powered hub all that's needed to fix this?
I haven't tried Raspbian yet. However, if the device is showing in the list it should work once you get a powered hub.
Powered hub is definitely a preferred solution, Y cable is not - "except" if you plug the red USB connector into another device, to get some extra power. I my case I've tried to plug it in TV (0,5A) and it worked. I have also plugged RPi into TV (1A) and it still worked.
Hi, could this work on Raspbian with Vodafone Mobile Broadband K3770, HSPA USB Stick (Huawei Technologies)? (It’s a pay-as-you-go service which I have topped up.)
I have the first revision Pi. I don’t yet have a powered hub, trying the above steps with it plugged directly into the Pi, the device showed in the list, but gave “failed to connect” when selected. Is a powered hub all that’s needed to fix this?
Hi, do you know how send SMS to mobile ?
I have a project that need to send information to my mobile by SMS while a switch is pressed on.
Thanks
Take a look at my other blog post - http://shkspr.mobi/blog/2012/06/raspberry-pi-and-frontline-sms/
Hi Terence,
love the article, great desktop pic!
I've been thinking about installing my raspberry pi in the car with 3g. What I would like to be able to do is read information about the strength of tower signals around me with the intent of locating the car. Have you any idea if I can read this information from a stick (don't have one yet, any suggestions would be welcome)?
Also saw the other great piece about sending SMS's. All cool stuff!
It depends on the stick but, yes, in general - you can see signal strength.
Why not use GPS to locate the car? You can use a USB GPS receiver to locate the car and the 3G dongle to either send you information by smms, email or some other means over the internet
trying to access the sakis3g.org site now since two days but is seems to be down, is there another way to get that file somewhere?
Seems to be back up now.
Its down again. Well, is there another way to get that file somewhere?
yes it's back, sorry for the confusion. wish everyone would use code hosting like github for such projects.
Hello. I am trying to connect a Pantech UML 290 to my rpi running wheezy I have tried everything but killing myself to get connected.
Sakis 3g kept throwing a modem does not have gsm capabilities at me and when I tried - - no probe it gave me a pin error. I have also tried wvdial but it does not work on arm as it should. have also tried ppp chat script but it keeps throwing a connect script error at me
Could you please help me?
Is the dongle on a powered hub?
Does your SIM have a PIN lock?
Does the dongle work in another device - say, a laptop?
Well the dongle works fine on my laptop with vza . It is on a powered hub. And in vza I have disabled pin.
Any ideas ananyone? I have already tried ppp which gives me connect script failed. I have a project due within a week .please help out folks
This was a great tutorial! But how can I connect automatically when I reboot my Raspberry pi? Im planning to run my Pie without a monitor...
Best regards Marius
Hi im trying to connect my ZTE MF665C but every time i select in the option for which device it comes and says failed to connect, i have no idea whats wrong.
i have it connected to a usb powered hub
Some modems show up as a USB drive first (so you can load the drivers on to your Windows machine).
Take a look at USB-Modeswitch to see if that will help.
Thanks for sharing this. I am interested in doing this with a prepaid SIM card that charges per txt and MB of data. As such, I want to eliminate unwanted background network access-- e.g. even when I am not using my Macbook, there are a lot of small internet accesses that I can snoop using netstat. Is this a problem with the Raspberry Pi? I want to leave the RPi on 24/7 and only plan on sending ~5 SMS messages per month at 10 cents each and am worried that the low level data usage will overwhelm the savings from $10 per 3 mo plan.
Could you possibly run netstat to snoop your internet connection for a while and give me an idea of how much background activity there is?
With the default install, I think the only internet access should be from the update checker - which you can disable. If you only care about SMS, you don't need to use data at all.
Hey. First off, nice post. By far the clearest I've found on the subject. Not having much joy getting 3g going on my pi though. I get 'failed to connect' everytime. I'll list my process-
Using Huawei E3231 on 3 (UK)
Latest wheezy raspbian (fresh install and updated)
Dongle works as expected under windows
lsusb = ID12d1:1f01 (is that the issue?)
Followed your instructions
Get same error everytime
I'm still pretty new to all this so I'm finding it hard to even search for a solution. I'm trying to get my head around usb_modeswitch.
Unfortunately, I've not come across any reports of this device working with R-Pi. There must be a solution though(fingers crossed). Any ideas? Cheers
There are some fairly detailed instructions on how to get this working on the Raspberry Pi website http://www.raspberrypi.org/phpBB3/viewtopic.php?t=18996&p=210958
Do make sure you're running on a powered USB hub.
Cheers mate, I'll give it a go. Don't know how I managed to miss that post. Running my pi's and peripherals form a converted PC psu so no problems with power. Nice one for the quick reply.
Hi again. I tried the recommended post. Didn't get far though. Couldn't get the thing to perform a switch. It states you use the command- /usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00 to switch with sg3_utils. I get- do_scsi_pt: Bad address.
I don't know what the numbers represent in this command but I'm assuming it's that. I've posted a message on the other post(waiting for reply) but I thought I'd try my luck here as well. Cheers
got the 3G working on arch in I think 10mins with this, THANK YOU!
first of all i want to say that this project is really useful BUT i got no joy connecting my huawei e1750 over 3g. when i start sakis it asks what to do and i say connect to 3G but the response is Embedded Usb-ModeSwitch binary is not valid for your architect. You need to recompile for devices to switch properly: ./sakis3g recompile.
I am possitive I downloaded the link you gave, also i use raspbian.
if any advice thank you very much
As the message says, you may need to recompile it. The guide is on the wiki http://wiki.sakis3g.org/wiki/index.php?title=Sakis3G_compilation
I just managed to do it on Arch linux with the 3G USB dongle. Check it here:
http://www.facebook.com/photo.php?fbid=10151174131440974&set=o.363813467010036&type=1&relevant_count=1&ref=nf
Cool! Have you written it up anywhere?
Worked for me, using a Huawei E169 on 3UK.
I'm curious to know what speeds people are getting? I ran a quick speed test which showed 1MBps but that could be down to network congestion/weak signal.
I'm using a later Pi and mine works without a powered hub. The second USB slot is used for the keyboard/mouse via a PS/2-USB adaptor.
hello http://www.sakis3g.org is not online from more of a week :(
can you post thise file ?
thanks
Hello,
Yes, sakis3g.org is down for now. Is there a way to contact them ? Or to get the files anywhere else ?
I found an alternate source for Sakis3G utility here:
http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=904
I did not test it cause I cannot for now, but if anyone can, feedback is welcome
http://www.sakis3g.org is actually back now! Great, was looking for it myself too.
Is it possible to send sms while keeping the 3G internet connection open or do I have to close it?
It did work simultaneously... my 3g router (huawei) was listed as 3 lsusb devices, the lsusb2 accepts AT commands...
Will this automatically reconnecting when/if the connection is lost, or would I need to manually reconnect by running the sakis3g script again?
You will have to run a script to check if it is connected and then reconnect if not.
Is there anyways to automate this? I find if I leave the connection open too long I have to reconnect, I would like it to maybe try and reconnect on its own if the connection is lost.
Hi Terence,
What are your thoughts with tethering an android phone via usb and using it as a modem for the pi?? Will the same steps you described above apply??? I have a Motorola phone running gingerbread and I want to send trigger commands to the pi. I have a few specific questions and I'm not sure where to start. Any help would be greatly appreciated.
Best Regards,
Mark C.
Hi Mark,
There are two things you need to know first.
1) Does your phone support tethering via USB? (There should be an option in the settings menu)
2) Does your carrier allow tethering? (Some don't, or will charge you extra for it)
If the answer to both questions is "Yes" then it should work just fine.
There are a couple of good looking tutorials at
http://www.linuxstall.com/android-tethering-using-android-to-access-internet-on-your-linux-machine/
http://blog.ecafechat.com/android-usb-tethering-ubuntu-12-04/
Good luck and let us know how you get on!
Terence
Hi Terence,
first of all, a great howto - thanks a lot!
My project would be: to open my garage by a simple phone call, using a pi and a usb modem.
Do you perhaps know what I need to doe here? Receiving calls and checking IDs is simply done by AT commands? How can I tell if a call is about to happen, I mean how to recognize if a ring the modem? Do I have to poll something constantly, or is there a trigger somewhere when the modem rings?
Thanks a lot in advance!
Regards, Zoltan
First of all, you will need to find a USB dongle which will accept voice calls - many won't. You'll also need a SIM which your network provider has enabled for voice.
The SIM I do have, and also a few dongles - do you perhaps know how to check if they have the feature? Or could you perhaps recommend a few specific modells?
So, checked my Huawei 1750 with DC-unlocker, it is voice enabled.
Any Ideas where/how to start? :)
for that project you could simply get a cheap $20 phone and use the speaker signal to control your garage
Yeah, thought of that, but it won't be that elegant and customizable that I would prefer. And hey, where is the fun and the joy of discovery in that? ;)
Will ZTE MF669 work as well?
Nice write up. Thanks for sharing. An easier way to get started with 3G and RPi is using a TP-LINK TL-MR3040. Plug the 3G modem into the TP-Link's USB and the RPi and the TP-Link's with an Ethernet cable and you're good to go.
http://www.tp-link.com/en/products/details/?model=TL-MR3040