3G Internet on Raspberry Pi - Success!
https://shkspr.mobi/blog/2012/07/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 InformationInterface: P-t-P (ppp0)Connected since: 2012-07-13 07:36Kilobytes received: 2Kilobytes sent: 2Network ID: 23410Operator name: giffgaffAPN: giffgaff.comModem: K3565Modem type: USBKernel driver: optionDevice: /dev/ttyUSB0IP Address: 10.136.6.52Subnet Mask: 255.255.255.255Peer IP Address: 10.64.64.64Default 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!