x Raspberry Kiosk - 04 - Connecting the Raspberry with 3G

Raspberry Kiosk

Archive   

A web-kiosk based on the Raspberry pi. Journey of a software engineer into a DIY project

Want more raspberry juice?
Ask me!

Support this blog!


Home

04 - Connecting the Raspberry with 3G


Date: January 3, 2013 at 3:11am
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 :

  1. A Raspberry Pi (rpi) with Raspbian (the default distribution) connected to the internet via ethernet (learn to make the first setup here).
  2. 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.
  3. A SIM card enabled for 3G surfing.
  4. 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.
The image below show how the (2) Huawei E220 looks like :
image
Switch off the raspberry pi, and insert the SIM card (3) into the 3G modem slot :
image

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

image

At this point the modem’s LED should start blinking. Depending on the availability of the network, you can refer to the following table to understand the LED :
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.

Lets start by creating a directory located under your home dir 
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:

image

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.

image

To see more detail about your connection you can type 

sudo ./sakis3g connect info

which will output something like this:

image

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!!!).

image

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.

If you liked this post and you want some more, you can subscribe or ...

Donate Bitcoins

or simply spread the word to makers and hackers like you

Vote on HN

Notes

  1. ambrosechua reblogged this from pikiosk
  2. webmensch reblogged this from pikiosk
  3. danbertner reblogged this from pikiosk
  4. pikiosk posted this