Verified: Raspberry Pi and 3G Sierra Wireless 250u Aircard from Sprint

I am writing this quick post as I recently had a very difficult time getting the Sierra Wireless 250u 3G USB modem from Sprint working on my Raspberry Pi. I also had seen anyone else on the web or forums having success with this combination. It turns out my main issue was that I was not using a powered USB hub. The Raspberry Pi’s only output about 100mA out of their USB ports and the 3G modem requires much more than that.

sierra wireless 250u and raspberry pi

After I started using a powered USB hub, the configuration was straight forward. I am using the Wheezy version of Raspbian as my OS. This Belkin 7 Port Hub works out of the box.

The first thing I needed to do was check to make sure my device was recognized.

lsusb

You should get a print out similar to this,

lsusb-sierra

The important line we are looking for is:

Bus 001 Device 010: ID 1199:0301 Sierra Wireless, Inc.

Now that we have verified that the device is being recognized by the rPi, we need to install our dialer, WvDial. WvDial is a Point-to-Point Protocol dialer, it will enable a modem and start pppd in order to connect to the Internet.

sudo apt-get install wvdial

Then, edit the configuration file:

sudo nano /etc/wvdial.conf

I replace the entire contents of my file with the following:

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = USB Modem
Phone = #777
Username = ''
Password = ''
Carrier Check = no
Stupid Mode = 1

Now, test the connection:

sudo wvdial

A succesful connection looks like this:

--> WvDial: Internet dialer version 1.61
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Jul 11 18:46:50 2013
--> Pid of pppd: 3395
--> Using interface ppp0
--> local IP address xxx.xxx.xxx.xxx
--> remote IP address xx.x.xx.xxx
--> primary DNS address xx.x.xxx.x
--> secondary DNS address xx.xx.33.x

There is a manual from Sprint located here if you have any troubles connecting, or just comment on the blog and I’d be happy to help debug with you. Thanks for reading.

Read More

How to Tether Your Raspberry Pi with your iPhone 5

If you have been reading my blog lately you know that I have done a lot of projects involving Raspberry Pi‘s, the $35 dollar credit card sized Linux computer. Because of its small size, I recently started of thinking of projects that would allow me to be mobile with the Pi.

That led me to this post.

There are plenty of resources online about tethering the iPhone 5 with the graphical interface, but I wanted to be able ‘hotswap’ my Raspberry Pi’s Internet connection without command line, and without the graphical interface. Plug and play, essentially.

I was able to get this working last night using Raspian (a free operating system based on Debian optimized for the Raspberry Pi hardware) and a few scripts.

Prerequisites

Make sure your iPhone is disconnected and proceed to install the following iPhone and file system utilities. Open up a terminal or SSH into your Pi and run the following commands:

sudo apt-get install gvfs ipheth-utils
sudo apt-get install libimobiledevice-utils gvfs-backends gvfs-bin gvfs-fuse

After these are installed, and with your iPhone still not plugged in, lets take a look at our available interfaces. Run the following commands:

ifconfig -s

If you have a standard installation, you should see two interfaces, eth0 and lo.

tether iphone 5 raspberry pi

The reason we did this step was to make sure we correctly identified the name of the iPhone’s network interface. Now that you have this list you can turn on your iPhone’s Personal Hotspot and then plug it into your Raspberry Pi’s USB port, and issue the same command.

ifconfig -s

iphone raspberry pi

Your Pi should now recognize your iPhone is plugged in and assign its network interface a name, usually eth1. Now we need to edit our interfaces file to allow for hotswapping and dchp.

Unplug your iPhone and then open up your network interfaces file

sudo nano /etc/network/interfaces

and add the following lines, where eth1 is the name identified above.

allow-hotplug eth1
iface eth1 inet dhcp

Save and close the interfaces file.

Graphical Interface

If you are using the graphical interface, you are now done and the above commands were all that were necessary to use your iPhone as an Internet connection!

You can test this by starting your desktop environment

startx

Then unplug your Ethernet connection, start your Personal Hotspot, and plug in your iPhone. A popup message saying a “Removable medium is inserted” , that is safe to close. Then open a terminal, and run the following command:

ping google.com

You should be connected to the Internet!

Command Line

In my testing, tethering with command line only will only work when the iPhone is mounted. To do this, we need the ifuse package:

sudo aptitude install ifuse

and create a mount directory for the iPhone

sudo mkdir /media/iPhone

Now we can disconnect the ethernet of the Pi, turn on the iPhone’s Hotspot , and plug in then mount the iPhone.

sudo ifuse /media/iPhone

The Internet should now be tethered from your iPhone. Remember, while using command prompt only, the iPhone must manually be mounted each time it is plugged in using the ifuse command.

Putting It All Together

Now that we know how to tether the phone in the graphical interface, and the command line interface, we can add a script(thanks to users djpod and benebeck on the raspberrypi.org forums) that will automatically mount the iPhone it is plugged in.

To automate the process, I put the following script named iphoneconnect in /lib/udev/:

sudo nano /lib/udev/iphoneconnect

#!/bin/bash
umount /media/iPhone #when the iPhone is unplugged, it is not automatically unmounted.
ifuse /media/iPhone
ipheth_pair

Remember to make the script executable

sudo chmod 755 /lib/udev/iphoneconnect

The final step is to edit the file ’90-iphone-tether.rules’ in the ‘/lib/udev/rules.d’ directory.

sudo nano /lib/udev/rules.d/90-iphone-tether.rules

This is the script that runs automatically when ever we plug in the iPhone, and we want to edit it to call the script we created (/lib/udev/iphoneconnect) instead of what it currently calls (/lib/udev/ipheth_pair). To do this, we just edit the 5th line of the file replacing ipheth_pair with iphoneconnect.

The file should look like this


# udev rules for setting correct configuration and pairing on tethered iPhones
ATTR{idVendor}!="05ac", GOTO="ipheth_rules_end"

# Execute pairing program when appropriate
ACTION=="add", SUBSYSTEM=="net", ENV{ID_USB_DRIVER}=="ipheth", SYMLINK+="iphone", RUN+="iphoneconnect"

LABEL="ipheth_rules_end"

Thats it! Your Raspberry Pi will now automatically Tether your iPhone without Graphical Interface and without Command line!

 

 

 

iPhone Tethered Raspberry Pi

 

My command line speed tests averaged at about 1.5mb/s download over Verizon LTE neat Boston, MA.

wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
Read More