Connect Your Raspberry Pi To Cellular Via Hologram’s Network
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.
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.
- Download and install the Raspbian image to your micro SD card following the instructions on the Raspberry Pi site.
- 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:
- Put the microsd card into the slot on the back of the Pi.
- Plug the monitor, keyboard, mouse, Ethernet cable, and USB dongle into the Pi and then power it on.
- 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.
- Once you’re finished there, you’ll be sent to a command prompt. Let’s start up the GUI by typing
- Open up a terminal window and type
sudo apt-get update
sudo apt-get install usb-modeswitch
- 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.
- Reboot the Raspberry Pi and run
- 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.
sudo dhclient eth1. This will assign it an IP address.
- Open up the web browser and go to 192.168.1.1
- 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.)
- Go to Settings and Profile Management and create a new profile called “Konekt” with the apn “apn.konekt.io” It should look like this:
- Go to Mobile Connection, switch to “Auto” mode and turn on the setting to allow for roaming.
- Click Home. Hopefully all went well and you are now connected to a cellular network.
- 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
- If it doesn’t work, you probably need to add a new default route. In the terminal window, type
sudo 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!
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:
iface eth1 inet dhcp
Once 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.