04 - Connecting the Raspberry with 3G
Tags: #3g #dongle #huawei #modem usb #raspberry pi #sakis #tutorial #kiosk
Hello reader, happy 2013! ;)
In this tutorial we will learn how to connect the raspberry to the internet using an USB 3G modem.
Little by little our open kiosk project is progressing : last week we moved our first steps configuring the Raspberry Pi and we learned how to print a receipt. Now we want to be able to place the kiosk everywhere we want, regardless of the availability of a Wi-Fi connection.
To complete this tutorial you will need :
- A Raspberry Pi (rpi) with Raspbian (the default distribution) connected to the internet via ethernet (learn to make the first setup here).
- An USB 3G modem. I used a common dongle, the Huawei E220: it costs 35$ from amazon. Other USB modems compliant with the raspberry are listed and updated on the official page. If this tutorial worked for you too with a different modem, please drop me a line in the comments.
- A SIM card enabled for 3G surfing.
- An external powered USB hub to connect the dongle (2) to the rpi (1). You need some extra power since the 3G modem requires more energy than the rpi can provide via the USB slot.


Now plug the usb modem, the keyboard and the mouse to the powered USB hub (4) and connect it to the rpi (1).

Blinking (blue) = The WCDMA network is normal.
Blinking twice every 2.7 seconds (green) = E220 is searching for a network or no network is available.
Blinking once every 2.9 seconds (green) = The GSM network is normal.
On (green) = The GPRS data service is established.
On (cyan) = The HSDPA data service is established.
On (blue) = The WCDMA data service is established.
Off = Someone misses you.
In my case the LED is blinking blue, indicating that “the WCDMA network is normal”.
Now turn on the Raspberry, make sure you are connected to the internet (ethernet or WiFi) and open the terminal. First of all we need to download and install the point-to-point protocol (ppp) on your machine by typing :
sudo apt-get install ppp
Now, following the example of another tutorial, we will use the sakis3g script to connect the rpi to the internet using the USB modem.
mkdir ~/3g && cd ~/3g
Now download, decompress and make executable, the last version of sakis3g for arm platform:
wget "http://www.sakis3g.org/versions/latest/armv4t/sakis3g.gz"
gunzip sakis3g.gz
chmod +x sakis3g
then simply run the script by typing
sudo ./sakis3g --interactive
TIP: at this point the ethernet cable is redundant: you can un-plug it!
Finally select the option “Connect with 3g” and press the OK button as shown in the screenshot below:

The script will try to identify your 3G APN automagically (it worked fine with my gateway - H3G Italia), otherwise you can input your own custom settings.
At this point you should receive a confirmation dialog that you are online, and you can verify it with a ping or simply browsing the internet.

To see more detail about your connection you can type
sudo ./sakis3g connect info
which will output something like this:

Now that you are online you can do whatever you want, e.g. you can be the first to flattr this blog, take lessons of leadership, learn how to code or think about where to go with your portable 35$ computer now online.
To conclude I want to thank the firsts 500 (and counting) visitors of this blog during its first week. This was completely unexpected and made me want to keep writing these small tutorials while reporting the progress of my project. Thank you for feedbacks, comments and donations (yes, someone actually gifted 0.1 bitcoins to keep this blog going!!!).

The open source community is amazing and you guys keep me motivated. Thank you! Next week I will play around with JavaFX to see if I can make something efficient out of it for the kiosk.