Connect Your Raspberry Pi To Cellular Via Hologram's Network

Connect Your Raspberry Pi To Cellular Via Hologram's Network
Tutorials
Reuben Balik
April 17, 2015
Raspberry Pi

NOTE: An updated version of this tutorial is available in our documentation.

Many people prefer to build their cellular project off of the familiar Raspberry Pi rather than the Konekt Dash. Don't worry—you're not hurting our feelings. As you may have noticed, one of the rewards in our Kickstarter Campaign is a Raspberry Pi kit that includes the Raspberry Pi 2 Model B along with everything you need to get up and running on the Konekt network.The following tutorial should help you take a Raspberry Pi from unboxing to Internet in less than an hour.

Raspberry Pi hooked up

Ingredients for connecting your Raspberry Pi to cellular

Items with a * are included in the Kickstarter Raspberry Pi kit.

  • Raspberry Pi 2 Model B*
  • 8GB or greater MicroSD card*
  • 2.4A USB power supply and cable*
  • Huawei e303 3G USB Dongle*
  • Monitor with HDMI input
  • USB Mouse and Keyboard

Instructions for connecting your Raspberry Pi to cellular

First, a few caveats:

  • This is a quick and dirty method that will get you on the network as soon as possible.
  • It requires the use of the GUI (which means monitor, keyboard, and mouse) and isn't scriptable.
  • It requires you to download a package via the Ethernet port on the Pi.

Now that you've read the fine print, let's get started.

  1. Download and install the Raspbian image to your micro SD card following the instructions on the Raspberry Pi site.
  2. Insert the Konekt SIM card into the USB Dongle. The cover slides off easily and there's a slot on top for the SIM. It'll look like this when you have it installed correctly:
USB dongle
  1. Put the microsd card into the slot on the back of the Pi.
  2. Plug the monitor, keyboard, mouse, Ethernet cable, and USB dongle into the Pi and then power it on.
  3. Since this is a new image, you'll be greeted with the RPi configuration utility. It's up to you what you want to change in here. I always go through the internationalization settings and switch from the British keyboard layout to the US layout.
  4. Once you're finished there, you'll be sent to a command prompt. Let's start up the GUI by typing startx
  5. Open up a terminal window and typesudo apt-get updatesudo apt-get install usb-modeswitch
  6. Answer yes to any questions that come up. This will install the utility needed to switch the USB dongle from storage mode into modem mode.
  7. Reboot the Raspberry Pi and run startx again
  8. Open a terminal window and type ifconfig. You should see an entry for eth1 similar to the image below. This is the interface for the USB modem.
Terminal window screenshot
  1. Type sudo dhclient eth1. This will assign it an IP address.
  2. Open up the web browser and go to 192.168.1.1
  3. You should now be in the USB modem configuration web application. If you are asked for a PIN, type in the PIN written on the front of the SIM card. (The larger piece of the card from which you punched out the micro-SIM.)
  4. Go to Settings and Profile Management and create a new profile called "Konekt" with the apn "apn.konekt.io"
  5. Go to Mobile Connection, switch to "Auto" mode and turn on the setting to allow for roaming.
  6. Click Home. Hopefully all went well and you are now connected to a cellular network.
  7. Let's test it out. Unplug the ethernet cable from the Pi, open up a new tab in the web browser and try to go to http://hologram.io/test.html
  8. If it doesn't work, you probably need to add a new default route. In the terminal window, typesudo route add default gw 192.168.1.1 eth1

You should now be able to connect to the internet with the 3G USB Modem and the Konekt network!

Automation

Once you have this working, you probably don't want to have to go through this process each time. We already configured the modem to connect automatically when it is powered on, now we just want Linux to setup the interface each time. To get that to happen, edit the file in /etc/network/interfaces (sudo leafpad /etc/network/interfaces) and add these two lines after the line that says iface eth0 inet dhcp:allow-hotplug eth1iface eth1 inet dhcpOnce you do this, you should get a working cellular internet connection every time you power up which means that you'll be able to use the Pi unconnected from a monitor and keyboard.I hope this was helpful. We'll keep putting out more tutorials and documentation to walk you through every step of building your IoT device using Konekt technology. I'm eager to hear your feedback. If you have any questions or comments, leave them below or on our community forum. Also, you can get the latest update on how our hardware is coming along right here, and of course, make sure to check out the Konekt Dash Kickstarter for more info on our Cellular Dev Kit if you haven't already!

Update 4/22/2015:
Changed the test URL from google.com to hologram.io/test.html. This new page uses barely any data so you don't have to worry about using half your data allotment loading the Google homepage. Alternatively you could just ping google.com or konekt.io as that will use very little data.

Need some inspiration? Check out our collection of tutorials.

Get started with Hologram today

  • Talk to an IoT expert
  • Receive a free SIM
  • Customize your plan