Home‎ > ‎HowTo‎ > ‎

Connect to Internet using a Huawei Mobile Broadband Modem

Bifferboard already has built-in support to network connectivity and there may be a way of getting wireless connectivity working using a specific USB wifi adapter and appropriate  Linux drivers, but some times one may require to leave bifferboard in some remote place without having network access or wifi coverage! A good solution would be to use a USB Mobile Broadband Modem (HSDPA USB MODEM / 3G Mobile Internet Modem) to get Internet connectivty and be able to remote monitor/control Bifferboard. Here are some useful examples:

- Monitor remote sensor reading (sensors connected to Bifferboard over SPI/I2C/Serial Bus)
- Get remote access to Bifferboard USB Webcam (use mjpeg-streammer to serve Images/Streaming over http protocol)
- Remote controll GPIO input/outputs from internet, making it possible to turn On/Off some remote equipment - Home Automation
- Online tracking of vehicules or objects (when using a Serial GPS module connected to Bifferboard)
- Micro 3G/HSDPA Internet Router (require iptables to share/bridge Internet connection from ppp0 to eth0 interface)
- Work as an SMS Gateway module (receives sms requests over ethernet and run AT commands on USB Modem)

This tutorial will only cover Huawei Mobile Broadband Modems (only tested with E220 and E156G models but it should be OK for other Huawei models).

To implement the following tutorial it is required to be able to:
i) Compile Firmware: http://sites.google.com/site/bifferboard/Home/howto/compile-firmware
ii) Flash kernel and copy rootfs to USB Pendrive: http://sites.google.com/site/bifferboard/Home/howto/flash-kernel

It also requires some extra hardware:
a) USB Pendrive required for the rootfs
b) USB Hub (4 Ports)
c) Huawei Mobile Broadband Modem E220 or E156G

1) Before compiling the new firmware from i) it is required to (Linux desktop machine - cross-compiling enviornment):

> cd bifferboard
> cd openwrt
> make menuconfig

Check: Network -> ppp
Check: Network -> pppt

Check: Kernel modules -> Network Support -> kmod-ppp
Check: Kernel modules -> Network Support -> kmod-pppoe

Check: Kernel modules -> USB Support -> kmod-usb-serial
Check: Kernel modules -> USB Support -> kmod-usb-serial -> kmod-usb-serial-options

Check: Utilities -> comgt

# Check: Utilities -> huaweiaktbbo (NOT REQUIRED - may be required for other models)
# Check: Utilities -> usbmodeswitch (NOT REQUIRED - may be required for other models)

Exit -> Save -> Yes

> cd ..
>make remake V=99

2) Flash kernel and copy rootfs

Please check step ii)

3) Chat and PPP config files

Note: the following configuration files may be different from your country Mobile Broadband Internet providers, please feel free to update/add your settings to this wiki!

Before attaching your USB modem to Bifferboard there are still 2 scripts that need to be created:

Mobile Operator: TMN

- Chat:
>nano /etc/chatscripts/tmn3g.chat

'' 'ATZ'
'OK' 'ATV1E0'
'OK' 'AT+CGDCONT=,"ip","internet"'
'OK' 'ATD*99#'

- PPP (may require to mkdir peers dir):
> nano /etc/ppp/peers/tmn3g
connect-delay 10000
user tmn@tmn.pt
lcp-echo-failure 4
lcp-echo-interval 65535
connect '/usr/sbin/chat -v -t3 -f /etc/chatscripts/tmn3g.chat'

4) Connect to Internet

Now its time to connect your USB Mobile Broadband Modem to Bifferboard and check if the harware is being recongnised!
If you have a serial console attached you will see that it will have some messages, one of them will refer that Serial Modem is recognised!
Running dmesg command will also give you some hints to check if the hardware is OK.

(USB Modem Status - green led blinks)
Next step would be to run comgt to authenticate/register the modem into the Mobile Operator:
>gcom -d /dev/ttyUSB0

If your SIM card is password protected it will ask you for your pin number (4 digits).
After this you should get a message with the confirmation that you are authenticated into mobile operator network.

Now lets initialize chat and ppp to get Internet connection active:
>/usr/sbin/pppd call tmn3g
(I wasn't able to get logs from connections, so if something goes worng it's a bit dificult to understand here it got lost! If anyone knows a way of getting this working feel fre to update)
(USB Modem Status - green led stops blinking - blue led on)

After the connection you should be able to check for proccess in memory, using htop or top (even ps -ax), you should see ppp and chat running! If it disapears after a while then something must be wrong and your connection is aborted by the Mobile Operator.

Next step would be to check if new network interface is available:

You should see now a new interface called ppp0. Please check is dynamic IP address and default gateway for the final steps.

Internet is now connected but it is necessary to 'Inform' Bifferboard of the new interface (set it as the default gateway):
> route

check your actual default gateway from previous command in order to replace it with mobile broadband:

- remove actual:
> route del -net default gw

- add default gateway from ppp0 network interface
> route add -net default gw

And that's it! It is now time to remove your network cable from bifferboard and test access from internet!
From a PC connected to the Internet please check if you have access to Bifferboard:

// NN