Cellular Beaglebone

Out of the box, the $89 beaglebone device may be readily adapted to use a USB-based Cellular data access device, such as the Sierra Wireless 250U device that works on the Ting.com network for a low $9 per month month-to-month plan providing for 100 Megabytes of remote telemetry.   These instructions tell you exactly how this is done.

The above photo shows a minimalist use of the single USB port to support a Sierra Wireless 250U device that connects the beaglebone to the internet.  In this simple configuration, no additional USB hub is needed and the cellular modem is powered from the beagle bone.  Using the BASH scripts below, you can cause this arrangement to dial up the Internet and give you an IP address from Sprint's network.  With that IP address, you can SSH or get web services from the beaglebone with no other connectivity.    

This particular Sierra Wireless 250U device shown was purchased for $75 directly from ting.com.   However, we have also purchased an identical device from other suppliers and it works just the same.

Since this is a CDMA network, there is no SIM card.   To register the device, you must read the ESN off of the device and associate it with your ting.com account on their web site.    Within seconds of registration on their web site, the device starts working.    One device worked right away.   However, I had to contact Ting.com by phone on the other device.  In either case, the activation requires only a small registration fee by credit card.   I recently noticed that ting.com no longer sells this model device directly, even though they are supported on the ting.com network.   (Ting.com is an MVNO operator on the Sprint network).

As a side note, the ting.com technical support is radically good.  They are so very helpful and very good at what they do.   I have no idea how they make money at this, but thats not my problem at the moment.

While hooking the beagle bone up to the Internet in this way, this particular arrangement only puts your beaglebone on the Internet using a cellular device instead of using a wire-line ethernet RJ45 internet or a wi-fi device.     You should know that in the event you happen to ALSO have an internet connection via the ethernet RJ45 LAN port, your beaglebone may not actually use the cellular internet connection until you hit the part in a script below that changes the default route.

It is far more interesting to use a USB hub and an additional device or two also powered by a USB hub.  We show a OneTouch Ultra2 blood glucose meter on one of the other available USB ports of this low cost 4-port hub.  We used a Digitus Slim Spider USB Hub. A standard USB-to-serial cable provided by the OneTouch manufacturer is shown.

With this arrangement the assignment of devices to /dev/ttyUSBxxx ports is dynamically made and decoding this mapping is a key first step to using any of these devices in other scripts.

The serial protocol used to get data out of the blood glucose meter is really another story on its own.   The details for doing that, and the requisite python code for doing that is here:  https://github.com/bewest/insulaudit

The USB assignments are decoded by this script  usb_discover.sh

usb_discover.sh   -- This script searches for specific USB ports as may be needed if a USB hub is used to enable the beaglebone board to connect to more than one device.  While this isn't strictly necessary if all you want to do is connect the board to the cellular network and only consume the one and only USB port on the beaglebone, we found it critical if you want to connect other USB devices and export their data to the web.

Inside this script, we use the /bin/dmesg function to get a bunch of stuff and peel off the end of the file selecting certain key words.   While we save the stuff to some environment variables, we also save the data in two files.  Since we also wanted to connect a blood glucose meter to the beaglebone (to report blood glucose data to the internet), we use the filename /etc/tty_bcm to contain the USB port for that device.   The USB port used by the cellular device is put into the file   /etc/tty_sierra for the Sierra Wireless device applicable to ppp.  

The contents of this script usb_discover.sh follows:

echo Discovering USB port assignments

export tty_bcm=`/bin/dmesg | grep "pl2303 converter now attached to" | awk ' {tty=$NF}  END { print tty}'`

export tty_sierra=`/bin/dmesg | grep "USB modem converter now attached" | awk ' { tty1=tty2;tty2=tty3;tty3=tty4;tty4=$NF }  END { print tty1}'`

echo tty_bcm = $tty_bc

echo tty_sierra = $tty_sierra

echo $tty_bcm > /etc/tty_bcm

echo $tty_sierra > /etc/tty_sierra

Now that the ports are known and saved in files, the next thing we do is write a script to join the network. This script may be triggered by a crontab entry (based on clock time), or may triggered by an init.d process (at power on time), or some other mechanism.  One other mechanism if interest is the receipt of an SMS message by the cellular modem.  Unfortunately, this particular modem does not support SMS traffic.  This join_network.sh script would likely be embedded in another script you use to poll the other data-providing devices, for example the blood glucose meter.

join_network.sh  -- This script starts the ppp daemon and triggers the USB Cellular device to set up an internet connection.   Note that we rely on prior execution of the usb_discover script above to set the options for this.   This script also updates a configuration file to contain a valid DNS nameserver and updates the default route once the internet connections is established.   If in fact you do get an IP address from the cellular network, you may use that using other internet devices to address services on the beaglebone.

The contents of this script join_network.sh follows:

export SHELL=/bin/sh

export TERM=vt100

export USER=root

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin

export PWD=/home/root

export HOME=/home/root

export SHLVL=2



#The script included jusb below gets the right USB port in an /etc/tty_sierra file



#The my_provider is a template of options lacking the usb port

cat /home/root/my_provider > /etc/ppp/peers/provider


export ttystring=/dev/`cat /etc/tty_sierra`

echo $ttystring >> /etc/ppp/peers/provider


echo First shut off ppp if it is running


sleep 5


echo Now turning on ppp

/usr/bin/pon &

sleep 30


echo Now updating the resolver with saved resolver nameservers

cp /etc/open.resolv.conf /etc/resolv.conf

cat /etc/resolv.conf

export gw=`ifconfig ppp0 |grep inet | awk '{print $3}'|sed /P-t-P:/s///`

export PPP0=`ifconfig ppp0 | grep "inet addr" | awk '{ print $2 }' | awk 'BEGIN { FS=":" } { print $2 }'`

echo PPP0=$PPP0

if [ -z ${PPP0} ]


        echo Network Failed


        echo Network Joined

        echo Adding a default route

        /sbin/route add -net gw $PPP0

        echo Network Ready


 Configuration File contents. -- Several configuration files must be correctly set for the above scripts to work.  Here is a summary:

/etc/open.resolv.conf  -- This file contains the DNS name servers that will be injected once the connection is useable.   Note that we borrowed open name servers published by google and others.   The contents of this file follows:




/etc/ppp/options -- This configuration file sets up some required ppp daemon options.  You might want to save the existing file before over writing with these contents.

logfile /var/log/ppp/log





maxfail 0

/etc/ppp/ip-up -- A script to capture some settings for environment variables.



# $Id: ip-up,v 1.2 1998/02/10 21:25:34 phil Exp $


# This script is run by the pppd after the link is established.

# It uses run-parts to run scripts in /etc/ppp/ip-up.d, so to add routes,

# set IP address, run the mailq etc. you should create script(s) there.


# Be aware that other packages may include /etc/ppp/ip-up.d scripts (named

# after that package), so choose local script names with that in mind.


# This script is called with the following arguments:

# Arg Name Example

# $1 Interface name ppp0

# $2 The tty ttyS1

# $3 The link speed 38400

# $4 Local IP number

# $5 Peer IP number

# $6 Optional ``ipparam'' value foo

# The environment is cleared before executing this script

# so the path must be reset


export PATH

# These variables are for the use of the scripts run by run-parts








# as an additional convenience, $PPP_TTYNAME is set to the tty name,

# stripped of /dev/ (if present) for easier matching.

PPP_TTYNAME=`/usr/bin/basename "$2"`


# Main Script starts here

run-parts /etc/ppp/ip-up.d

# last line

/etc/ppp/peers/gprs-connect-chat – this script works for Sprint 

# Name: gprs-connect-chat

# Purpose: GPRS PPP Connect Script

# Notes: CHAT is used to issue modem AT commands. See CHAT man pages for more info.


# Activate the device and pause before sending additional AT commands.

#'' AT+CFUN=1

'' AT


# Verify GPRS Attach prior to attempting PDP Context negotiation.

#'' AT+CGREG=1


# Define the PDP Context: Context ID, Routing Protocol, APN

# Multiple definitions can be configured by assigning each a unique CID.

# Use "isp.cingular" or "Broadband" to connect to the Cingular/AT&T orange network.

# Use "proxy" to connect to the AT&T blue network.

#OK AT+CGDCONT=1,"IP","isp.cingular" or "Broadband"


# Set the dialing string and specify which PDP Context definition to use.

OK ATD*99***1#


# Attempt to connect.


I'd be delighted to have any updates/comments/corrections.

Earle West ehwest@gmail.com

Marlboro, NJ