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!
allaun says:
juanRIOT says:
Ever since I ordered my Raspi, Ive been tossing and turning my brain on how I can connect to 3G with it.
Jimbob says:
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.
SRullo says:
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!
SRullo says:
if I try to connect the HUAWEI E220 it works fine but with ZTE K3765-Z sakis3G show me an error "Failed connection"
richard says:
I am trying to setup my E220 modem.
May i know which version OS are you using?
I am using ArchLinux.
Thanks
Rgds
Richard
richard says:
Tried that but it did not work will with webcams.
Will get another sd card for wheezy....
thanks
Andrew says:
Stefan says:
novalis says:
http://elinux.org/RPI-Wireless-Hotspot
Might work for u....
Ferdinando says:
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?
It's likely that your network provider is blocking the ports needed. Try moving your SSH daemon to port 80, or 8080.
Ferdinando says:
really strange....
Pranao Walekar says:
Ferdinando says:
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
Ferdinando says:
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 USER@xxx.xxx.xxx.xxx
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' USER@xxx.xxx.xxx.xxx
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.
ahmed wahdan says:
thank you for your tutorial
i will try it soon
but can i open other ports for other services?? web access for examble (port 80)
i have some other problems with Raspberry pi
can you send me your E-mail or facebook account.
Opening ports depends on your Mobile ISP. You should speak to them.
I can't provide support for the Raspberry Pi - you should visit http://www.raspberrypi.org/phpBB3/
Thanks
T
sanjay says:
Step by Step Instruction will be helpful as i'm totally new to linux.
Thanks & regards,
Sanjay
pi says:
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...
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
Marko Novak says:
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?
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
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
Do you have credit on your SIM?
Are you allowed to use dongles on your mobile tariff?
Any more specific errors?
Damage says:
khingcat says:
khingcat says:
Mequa says:
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?
Damage says:
Mequa says:
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?
fcastril says:
I have a project that need to send information to my mobile by SMS while a switch is pressed on.
Thanks
Henry says:
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!
Richard M says:
NiBa says:
Amogh says:
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?
Does your SIM have a PIN lock?
Does the dongle work in another device - say, a laptop?
Amogh says:
Amogh says:
Marius says:
Best regards Marius
Michael says:
i have it connected to a usb powered hub
Take a look at USB-Modeswitch to see if that will help.
Peter says:
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?
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
Do make sure you're running on a powered USB hub.
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
exstud says:
lepidas blades says:
I am possitive I downloaded the link you gave, also i use raspbian.
if any advice thank you very much
FD says:
http://www.facebook.com/photo.php?fbid=10151174131440974&set=o.363813467010036&type=1&relevant_count=1&ref=nf
Nick B says:
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.
can you post thise file ?
thanks
lauhub says:
Yes, sakis3g.org is down for now. Is there a way to contact them ? Or to get the files anywhere else ?
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
GekkePrutser says:
exstud says:
exstud says:
Tony says:
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.
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
Zoltan M. says:
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
Zoltan M. says:
Zoltan M. says:
Any Ideas where/how to start? 🙂
exstud says:
Zoltan M. says:
Neil says:
I installed RasPBX (a Debian based Asterisk / FreePBX distribution), and configured the chan_dongle package.
Michal says:
http://www.tp-link.com/en/products/details/?model=TL-MR3040
wget "http://sourceforge.net/projects/vim-n4n0/files/sakis3g.tar.gz"
Giuseppe says:
I started sakis3g but i am not able toi connect to internet
in the command line I show "Fixing connection "
I have a Olivetti Olicard 100
thanks
Giuseppe
Giuseppe says:
Bus 001 Device 006: ID 0b3c:c000 Olivetti Techcenter Olicard 100
I don't know how to use usb_modeswitch
Giuseppe
http://lawrencematthew.wordpress.com/2013/08/07/connect-raspberry-pi-to-a-3g-network-automatically-during-its-boot/
Cyan says:
RobotZombie (@NecBalaam) says:
Dario Cillerai says:
- do not use USB Y cable;
- connect the hub to the 1A plug (an Amazon Kindle adapter) via an ordinary USB cable.
- connect the Raspberry pi to the hub using a male-male cable.
Thanks
In general, a hub shouldn't feed back power, and male-male cables shouldn't be used. But it *could* work.
Dario Cillerai says:
I prefer not to risk and I've just ordered the Y cable you have advised!
Also Raspberry Pi arriving next week, I hope.
I'll let you know how it ends.
Dario Cillerai says:
Bye!
Gnichi M says:
Jochen says:
My aim is for the Pi to connect to 3G and share that connection out via LAN, this goes into a hub, which will provide LAN and WLAN access for all other devices in the house.
Can this be done?
stakhanov says:
Now, everything is fine at boot-time and/or when hotplugged, but when I leave the Pi running then after anything between a few hours and 3 or 4 days, the interface just seems to vanish.
I thought it might be to do with power so, as suggested, I plugged the dongle into a powered USB hub, rather than the Pi directly. But it's still not solving the issue. Do you have any pointers for me on that? Any help would be much appreciated!
kyle says:
Bill says:
Sam says:
JoeBob says:
You can also find a clone on GitHub https://github.com/Trixarian/sakis3g-source
xavier says:
I just installed a fresh raspberry pi model B with a zte usb key and i got the following message :
embedded usb-modeswitch is not valid for your architect. You need to recompile for devices to switch properly.
start by issueing ./sakis3g recompile
Thats what i did but it didnt work. it tells me that a library, usb.h and a developpement kit libusb are missing.
What can i do and were can i get that ?
Adding... I had numerous problems getting sakis3g just right on my Pi, from crickets at sakis3g.org to compliation problems. This post ( http://insembedded.wordpress.com/2014/03/27/setup-3g-on-raspberry-pi-using-sakis3g/) fixed all that.
But then I kept getting connection failures from within sakis3g. So, I scrolled back to the top and started over with a powered USB hub, rather than directly connecting my dongle to the Pi. That worked! Never underestimate the power of power. 🙂
But... introducing the hub sort of shot my mobile project in the foot. I was trying to use a relatively old AT&T USBConnect Quicksilver device that works great on my laptop. But I suspect that it something of a glutton. So, I'm wondering if anyone has found a "low-power" 3G/4G dongle that works off of Pi power?
clementine says:
Also did you try boosting the pi's usb current for your old dongle?
http://www.modmypi.com/blog/boost-usb-current
Sorath Asnani says:
I have to send MMS via Raspberry Pi. Any suggestions which GSM modem or 3G dongle could be used for sending MMS? Is 3G dongle able to send MMS?
Any help is appreciated.
Thanks.
Sufi says:
I am trying to use E173 Huawei on my raspberry but its just ont creating the ttyUSB1 and ttyUSB2
I spent few days surfing internet for similar problem, and I ended up doing everything without result
I belive my dongle is detected as a mass storage, and I tried commneds swtiching failed,
please let me know if if there is straight forward stetp to :
change the dongle from Cd rom to modem.
thanks
sufi
Sufi says:
Also look at UMTSkeeper....pretty well does everything GSM, on the Pi. I used it - worked fine!
http://mintakaconciencia.net/squares/umtskeeper/
Sufi says:
I used the dongle on fully installed linux on a nother machine, the dongle comes successfully as modem. but when I take it back to the Asteriaknow box, it is just isisting come as CD rom. please help;l
Let me know.
the e169 is detected fine as a modem. the raspbx is picking i successfully
but its not picking in bouchd calls, any help is appreciated.
I ve created trunk
created route
created sip
configured properly, but its not picking the call.
could you please let me know the steps to enable voice for Huawei E 169
under linux command line, I ve seen AT commands on the web
but when I run in the connand line it says not found.
Sufi says:
I have managed to use the 3G huawi 169 modem on raspbx. It's detected successfully as modem. But freepbx is failing to register the trunk. I used custom option I used Trunk configuration options. But no success. Any clue ?
atat says:
is your usb modem installed properly?
i suppouse that it is found in 'lsusb'.
ssh to your rasberry.
type
ls /dev/ttyUSB*
is there anything (like ttyUSB0 or ttyUSB1 or so)?
if it is not,
did you modprobe it?
for your dongle command should be
modprobe usbserial vendor=0x0af0 product=0x5000
if you have not installed modprobe, just 'apt-get install' it.
if it is all ok and ttyUSB is located in /dev,
is dongle properly set in
nano /etc/asterisk/dongle.conf
near the bottom of dongle.conf find paragraph [dongle0]
uncomment and set path for audio and data (audio=/dev/ttyUSB0 say..).
if you are not sure for ttyUSB device, leave audio and data commented and uncomment and enter
imei and/or imsi numbers.
at least imei you will find printed somewhere on your dongle.
after restart all, log in to asterisk cli
asterisk -rvvvv
from cli type
dongle show devices
your dongle should be listed.
if it is not, check again all settings.
maybe your dongle is locked... google 'unlock 3g dongle'.
if dongle is listed, 'exit' from cli and check settings in raspbx gui.
Googly says:
gazaeyesight says:
Thank you
oldnick says:
I want to know if it is possible to use voice and data (3G internet) at the same time.
I have already use raspbx with voice incoming.
Please advice
Terence Eden says:
oldnick says:
Terence Eden says:
clementine says:
Thanks for this blog post and for maintaining an active discussion forum on this topic.
I'm trying to establish which is the best 3G dongle for my pi project.
My criteria are : 1) low power consumption, 2) cost
My pi is battery powered, and I would like to use a 3G dongle I can plug directly into the pi's usb port.
Has anyone tried to boost the USB current in the pi and succeeded in plugging a 3g usb dongle directly (cf: http://www.modmypi.com/blog/boost-usb-current)?
Any suggestions welcome!
Clementine