Sunday, May 5, 2013

BlueDUN & BlueVPN - What do you need to connect?

BlueDUN+ / BlueDUN emulate the hardware modem on your Android phone. They allow your phone to share wifi or mobile connection over the bluetooth channel with other devices like PCs,tablets or navigation systems.  The bluetooth DUN (dial-up network) service is turned on, in order to enable the external device to access the Internet.
Android 2.3.* / 3.* :
Android >= 4.*  :

BlueVPN+ / BlueVPN  open a VPN connection through the bluetooth or USB channel and allow to navigate the internet without a WiFi or a built-in 3G module.
They requires one of:
 - Android smartphone/tablet with BlueDUN installed and running
 - GPRS phone with Dial-Up Networking (DUN) support
 - USB Stick with 3G or PSTN Modem [BlueVPN+]
Android 2.3.* / 3.* :
                            Android >= 4.*  :

1. TABLET (USB host port) & 3G STICK or PSTN (Line) Modem






BlueVPN+, connect your Tablet to internet with a USB modem (3G or PSTN)

The BlueVPN+ app allows the use of 3G or PSTN modems attached to USB host port.  Not all tablets have the USB or microUSB port but they are provided only with a proprietary connector;  in these cases you need a OTG cable or adaptor from the special connector to USB female connector.


A) Make sure your USB device is switched to modem feature only and the auto running is disabled:

The following procedure must be executed before using the USB stick with BlueVPN

1) Connect the modem to a PC running Windows and make sure it works.

2) Download the  Hyper Terminal  application, extract the zip file and run  hypertrm.exe

[ for Windows XP  you can find HyperTerminal under  Star t>Programs>Accessories>Communications>HyperTerminal ]

3) In the "Connection Description" write any Name, say "Huawei" for example, and click OK. 

4)  Wait for the appearance of the window "Connect To" and in the "Connect using:" option select the name of your USB modem ( for example:  "HUAWEI Mobile Connect - 3G Modem" ) ;  click OK.

5)  Close the next window by pressing the "Cancel" button.

6)  On the toolbar of the program, press the last icon "Properties";  that opens the "Properties" window.
Select the  "Settings" tab and click the "ASCII Setup" button;  put a tick in the checkbox "Echo typed characters locally"
Click OK two times for closing the ASCII setup window and the Properties window.

7) In the main window you should see a flashing cursor:   turn on the CAPS LOCK,  type the command "AT" and press ENTER.  If comes the answer  "OK"  means the terminal is connected to the modem. 

8) Introduce one of the following 

For Huawey modems:

  AT^U2DIAG=0      (device-only modem)
  AT^U2DIAG=1       (the device as a modem + CD-ROM)
  AT^U2DIAG=255   (the device as a modem + CD-ROM + Card Reader)
  AT^U2DIAG=256   (the device as a modem + Card Reader).

For using the modem with a tablet the USB stick has to be configured as "device only modem"
Type the command  AT^U2DIAG=0 and press ENTER.

For ZTE modems:

   AT+ZCDRUN=8   (disable flash cd-drive)
   AT+ZCDRUN=9   (enable flash cd-drive)

9) After the response "OK" from the modem, close the window Hyper Terminal, answering "Yes" to the proposal to interrupt a session and refusing to stay connected.

10) Make sure that CD-ROM emulation is disabled.   To do this, disconnect the modem from the USB port and then reconnect it in the same port.   In "My Computer" should not appear a drive for the USB stick.

If you need to recover the modem to its original state, you have to repeat the whole procedure, but using the command AT^U2DIAG=255 (the device as a modem + CD-ROM + Card Reader).

All these actions are no more required since BlueVPN+ version 1.5:
The new versions include a file with parameters  for  most popular devices and sends the code for switching automatically the USB stick to the modem feature.   Probably you will need to confirm twice the USB exclusive access message because after the switch the device is disconnected and immediately reconnected with a different ID.

B) You need a powered USB hub if your Android device supplies low USB power

On some tablets there is often not enough power available for attached USB devices.
Wireless modems are among the devices with the highest power demand (500 mA straight).  Usually, only some larger tablets can provide that much power on their host ports (with Samsung, even the 10.1" devices are reportedly power-limited).  Smaller ones often have their limit at 100 mA which rules out using a large array of devices. One notable exception is the Nexus 7 which works fine with many 3G sticks attached directly.  To bypass the problem you can use a (self-)powered hub:

or alternatively a mobile power battery charger like that (Tekkeon TekCharge MP1820) showed in this video:

NOTE:  some USB devices require some time after the modem switch before accepting AT commands; in this case it is possible to increase the Connection Timeout parameter.

BlueVPN+  common configurations:

a) Phone with Bluetooth Modem:  [ also valid for BlueVPN ]

Modem compatibility:   generally OFF        ( if enabled removes the <cr><lf> before AT commands )
Modem Line Feed:    generally ON              ( if disabled removes the <lf> in AT commands )
AT Initialization:  E0V1&C1&D2
Connection Timeout:   3000 ms                    ( repeat the AT initialization if not received a reply after some ms )
Inter-character delay:   0 ms                         ( increase the value only for very slow devices )
Modem speed:    [not important]
LCP Compatibility:   generally OFF
BlackBerry Compatibility:  generally OFF  (ON for Blackberry phones and if you get issues during negotiation )
Phone Number:    *99***1#  or  *99#   (  #777 for CDMA )
Access Point:   service provider  APN  ( <empty> for CDMA 
Authentication Type:  Password Authentication  ( or Challenge-Handshake )
UserName:  account for the service provider (generally the email) / <empty>
Password:   password for the account / <empty>
Primary / Secondary DNS:  (automatically assigned) 
Bluetooth Insecure Socket:   OFF  (ON if you get issues with bluetooth channel) 
DUN service channel:    0  (number >0  if you get issues with bluetooth channel) 

b) Android Smartphone with BlueDUN:  [ also valid for BlueVPN ]

Modem compatibility:   generally OFF        ( if enabled removes the <cr><lf> before AT commands )
Modem Line Feed:    generally ON              ( if disabled removes the <lf> in AT commands )
AT Initialization:  [not important]
Connection Timeout:   3000 ms                    ( repeat the AT initialization if not received a reply after some ms )
Inter-character delay:   0 ms                         ( increase the value only with very slow devices )
Modem speed:    [not important]
LCP Compatibility:  OFF
BlackBerry Compatibility:  OFF
Phone Number:   [not important]  
Access Point:   [not important]
Authentication Type:  None
UserName:   <empty>
Password:    <empty>
Primary / Secondary DNS:  (automatically assigned) 
Bluetooth Insecure Socket:   OFF  (ON if you get issues with bluetooth channel) 
DUN service channel:    0  (number >0  if you get issues with bluetooth channel) 

c) PSTN Modem:

Modem compatibility:   generally OFF        ( if enabled removes the <cr><lf> before AT commands )
Modem Line Feed:    generally ON              ( if disabled removes the <lf> in AT commands )
AT Initialization:  E0V1&C1&D2
Connection Timeout:   3000 ms                    ( repeat the AT initialization if not received a reply after some ms )
Inter-character delay:   0 ms                         ( increase the value only for very slow devices )
Modem speed:   less or equal to 115200 bauds
LCP Compatibility:  OFF
BlackBerry Compatibility: OFF
Phone Number:   number of service provider
Access Point:  <empty>
Authentication Type:  Password Authentication
UserName:  account for the service provider (generally the email) / <empty>
Password:   password for the account / <empty>
Primary / Secondary DNS:  (automatically assigned)

d) USB Stick Modem:

Modem compatibility:   generally ON         ( if enabled removes the <cr><lf> before AT commands )
Modem Line Feed:    generally ON              ( if disabled removes the <lf> in AT commands )
AT Initialization:  E0V1&C1&D2
Connection Timeout:   3000 ms                    ( repeat the AT initialization if not received a reply after some ms )
Inter-character delay:   0 ms                         ( increase the value only for very slow devices )
Modem speed:   460800 or  921600 bauds
LCP Compatibility:  OFF
BlackBerry Compatibility: OFF
Phone Number:   *99***1#  or  *99#   
Access Point:  service provider  APN
Authentication Type:  Password Authentication
UserName:   <empty>
Password:    <empty>
Primary / Secondary DNS:  (automatically assigned)
Modem switch code:   required only if the device is not included inside the internal list; the text is similar to the following 


The message content strictly depends on the device brand and modem:  you can find some examples here:

For the APN list please refer to the following document:

Sunday, June 3, 2012

BlueVPN+, connect your Android device to internet with a GPRS modem phone

In the previous post we saw how to pair two Android devices and share the internet connection between them with BlueDUN installed on the master and BlueVPN installed on the slave.   In particular we described how install and configure the BlueVPN:  this app implements a bluetooth dial up client, also called reverse DUN feature.  
However, there are situations where you need to connect an Android device, for example a tablet, and you don't own a second Android device (generally a phone), but you have only a GPRS [General Packet Radio Service] phone (like many common BlackBerry, Nokia, Samsung ...phones) with tethered modem capability.
Till now, you has been able to use this phone as an external modem to connect a laptop computer to the Internet but not to connect the Android device.
The last release of BlueVPN for Android ICS (4.0.x) enables the internet connection of Android devices through dial up modem phones and so bypasses this limitation.

To setup the connection you may follow the same steps described before:  enable the bluetooth on both Android and no-Android device and create the BT pairing.    For an unknown Android limitation it is strongly recomended to remove any space in the Bluetooth device names before the pairing ( for example:  rename "Nokia E65" to "NokiaE65" )

The main differences are in the setting parameters:

Modem compatibility:    some modems don't allow multiple lines for AT commands; if you enable this option the AT commands are not prefixed with <cr><lf> ("carriage return" and "line feed")
For example:    compatibility disabled:  <cr><lf>AT<cr><lf>  ;  compatibility enabled:   AT\<cr><lf>

Modem line feed:    if you disable this option the AT commands will use only the "carriage return" character (<cr>) otherwise thery will use both the "carriage return" and "line feed" (<cr><lf>)
For example:    compatibility disabled:    <cr>AT<cr>  ;     compatibility enabled:   AT<cr>

AT Initialization:  it is the modem initialization string, the default is E0V1&C1&D2  but you can change it according to your modem specifications

Connection Timeout:  is the time after which the app will resend the same data if it doesn't receive the replay for the first AT command or first LCP / NCP initialization packet.

Inter-character delay:   some devices are slow in processing characters so we need to wait some milliseconds between each of them (e.g. sending AT is equal to send 'A', wait few milliseconds, send 'T', wait few milliseconds, etc.)

LCP compatibility:  it is an option to force the PPP-LCP negotiation,  you need to enable this option only in extremely rare cases

Blackberry compatibility:  enable this option if you are connecting a Blackberry phone as modem

Bluetooth Insecure Socket:  enable this option only if you get issues with the bluetooth connection

DUN service channel:  represents the channel for the bluetooth DUN profile;  change the value and set a number like 2, 3 , 4 or 6 if the connection doesn't work with the default value 0 (auto-assigned)

Access Point:   while BlueDUN doesn't need any particular configuration because it routes the data packets to/from the Mobile 3G or Wi-Fi existing connections, for your phone to connect over GPRS, you'll need to tell the phone which APN (Access Point Name) to use.  
GPRS is a service supplied by mobile phone network operators and the APN is used to work out where to route data requests.  Most operators have different access points for different services, and you'll need to pick the right one, or things won't work; generally the Internet Access point is used for web browsing, email and instant messaging, etc.    Here is the World's GPRS APN list.
For CDMA (Code Division Multiple Access) connections keep the Access Point value blank.

Phone Number:   GPRS doesn't use a dial-up number (as GSM data calls do), but a conventional dial up Phone Number (*99# , *99***1# or something similar) should be set for the modem negotiation.
For CDMA usually the number is #777.

Authentication:   the authentication step is generally required even if the username and password are not defined, so you may select the authentication type = PAP (default) or CHAP.   UserName and Password are sometimes required by certain mobile operators and you have to insert the right ones for the user authentication (otherwise leave them blank).

DNS:  finally, you may need to set the Primary and alternative (Secondary) DNS addresses; they are used to resolve the domain names and are generally assigned automatically during the connection setup when equal to  If you force these parameters it is possible that the service provider cannot resolve the internet URLs and the connection doesn't work.

Note:  dialing and connection is supported by the wireless service provider and extra fees or additional charges might apply as this is going through the carrier's network.

BlueVPN has been tested with BlackBerry 9300, Nokia phones (E65, E66, N8-00 Belle, C60-01), Samsung SGH-L760.

Log reports:

You can help the app development in these way:
1. Open the BlueVPN settings and activate the options "Enable Logger" + "Log To File"
2. Go back and tap the GPRS phone name on the paired device list (start new connection)
3. If connection fails or after some time, open the BlueVPN settings again and click the last item [Send Files for Debug] for sending all the generated log files ( named application.log ) by email

Known issues:

A) The BlueVPN app seems locked on Modem or LCP negotiation messages

1. Pair the GPRS phone with a Windows PC and create a bluetooth modem connection
2. Open a command prompt on Window PC (cmd) and type in the order the following commands:
  • netsh
  • ras
  • set tracing PPP enable
3. Connect to internet the PC with your GPRS phone
4. Send by mail the file  /Windows/tracing/PPP.log  and the application.log (generated as described above)

B) The BlueVPN app shows the connected message (and the stop button) but suddently goes back to the paired device list

Some Android device manufacturers (Sony  for example) do not include the
VPN TUN module in the Android 4.0.x version that is installed on the device. This module is similar to a device driver. Without the module installed, a VPN tunnel cannot be established from the device.
To check if your device supports the VPN you can install the CatLog - Logcat Reader! app;
In case of unsupported VPN, an error message that appears similar to the following example is written to the catlog report when you tap the connection button on BlueVPN app:

E/VpnJni  (  189): Cannot allocate TUN: Bad file number
E/F5EdgeClient( 1391): Failed to establish VPN
E/F5EdgeClient( 1391): java.lang.IllegalStateException: Cannot create interface

You can install the TUN module by installing the "TUN.ko Installer" app:

Please contact the manufacturer's support for more information.

Best Practices:  Use only letters and numbers for Bluetooth device names (no special chars or spaces)

C) After the upgrade to Android 4.1 or 4.2 (Jelly Bean), BlueVPN doesn't connect when click on remote device name

  - remove the pairing with the remote device on Android settings and create it again.
  - click over the icon on the right of paired device name
  - enable the option "Use for internet access" (don't worry if the it remains unchecked )

Saturday, May 5, 2012

BlueDUN: Connect Windows 7 PCs to internet via bluetooth through Android phones

This post shows how to install and configure Bluetooth and pair your computer with an Android mobile phone to enable the internet connection.

Prerequisites are that you have already installed the bluetooth adapter on your windows 7 computer and turned on the bluetooth interface.

The pairing process can be started both from computer and phone. If you choose to start from phone you need also to enable in the Bluetooth Settings  the option: "Allow Bluetooth devices to find this computer".
In this example, I will choose to start the pairing from your computer.

In the notification area, click on the small arrow to reveal a whole set of additional icons. Then, right click on the Bluetooth icon and click on "Show Bluetooth Devices"

Now you can see the list of the previously paired devices, but, before clicking "Add a device" to create a new pairing with your phone it is necessary to turn on the BlueDUN service on phone.

Open the BlueDUN app and enable the "Discoverable" option on preference panel (click the menu button to access to the preferences); now when you start the service you should get the message "Bluetooth permission request" asking you to enable the bluetooth visibility status for a limited time. 

If the BlueDUN service is running on the phone, you can click the "Add a device" button on PC; this starts the "Add a Device" wizard, which automatically scans for new devices, including Bluetooth ones.
After a few seconds, your phone should show up in the list of available devices. If it doesn’t, then you need to make sure Bluetooth is enabled on the phone and the phone is set as discoverable.

Select your phone and click Next.

The wizard displays a code that you need to type on your mobile phone, so that the pairing is completed.

On your mobile phone, you are notified that your computer wants to connect via Bluetooth. Press OK, then type the code.   Once the code is entered, the pairing is created and Windows automatically searches for drivers for all Bluetooth profiles available on your mobile phone, then installs them.

To check the discovered and installed BT profiles, you can right-click the phone you’ve just added and choose Properties:

Note:  the "Dial Up Network (
DUN)" profile will be available on phone only when the BlueDUN service is running; if you pair the devices in a different condition, you will not be able the create a new internet connection on PC.   In this case, remove the old pairing and create a new one following the above steps.

Make sure the DUN profile is also selected and click OK to confirm.
Now it is the time to create a new internet connection to access the internet throught the  bluetooth phone tethering:  right-click again your phone and then choose "Dial-Up Networking" > "Create a dial-up connection…"

after clicking that, it will ask for what Modem device to use in your dial-up choose the last one, if it doesn’t work, try the others...

now enter the mandatory dial-up number ( for example  *99***1#  is the mostly used ), and enter a name for your dial-up connection… no need for username and password with the BlueDUN app …

after entering the details, click Connect, it will try to dial the number in your phone and registering your connection to networks server, and after that it will test your connection…

On the BlueDUN app you should see the "Modem negotiating.." message and soon after the panel with connection statistics indicating the connection was established with success.

Now your done! Click close button to close the window, and Open your browser to start surfing the web, Enjoy!


Saturday, April 7, 2012

BlueDUN: MB Comand OnLine and Android phones

The bluetooth pairing between Android phones and the MB comand online allows the users to share phone contacts and perform telephone calls.  In addition to Navi(gation), Audio, Tel(ephone), Video and System menu-options, you can see another icon:  the web navigation.  
Selecting this menu option, the user can open a web browser and insert URL for web navigation, or access the Comand OnLine functions including weather forecast, facebook, point of interest and more... 

The comand online needs a bluetooth DUN (dial up network) service but Android phones don't support it natively (because it is an old technology), so you have to install an app to activate this service.

The BlueDUN app for Android enables the bluetooth DUN service on your phones; this short guide shows how it is possible to open the web access for MB Comand OnLine:

1. Remove the old pairing between the Navi and the phone
If you have not recently purchased your car, it is quite possible that you have already paired the phone with the Comand to make phone calls.  When you create the Bluetooth 
connection between two devices, each of them searches and stores all the services available on the other device, then when you try to open a web link you may get the message  "Connected phone does not support data communication".   

No problem, it is normal, you have just to return to the initial situation, like if the two devices had never met themselves.  In other words, you have to remove the pairing:   select the Tel menu option / Telephone item on the bottom sub-menu / Bluetooth telephones / scroll the phone list and select the phone to remove / click the white icon on the right / De-authorise option and finally confirm.

2. Open BlueDUN,  Start the DUN Service and create a new pairing

After removing the pairing you'll need to create a new connection between the phone and Comand: normally you should activate the bluetooth interface on your phone and make it discoverable by other devices.  The BlueDUN app automatically enables the bluetooth, but you must check the "Discoverable" option in the properties panel (click the menu/left hard-button to show it):

BlueDUN requires a valid internet connection to start, so, when you click the "Start Service" button, the first message you can see is "Testing Internet connection...".   The app emulates a modem features but it doesn't perform a true dial up call, when the device client requests information, BlueDUN forwards these messages to the wifi or mobile (HSDPA/EDGE/GPRS) data connection and it forwards back to the client all replies.

If the BlueDUN screen shows the status "Waiting Bt Client.."  you are ready to pair again the Comand and the phone following the same steps:   select the Tel menu option / Telephone item on the bottom sub-menu / Bluetooth telephones / search for discoverable devices.

3. Select a Provider and setup the connection parameters
Once the Comand has stored the phone BT services, including the DUN, you don't need to pair them again, but the first time you try to open a web link you will get this message:  "No provider selected or provider data is incorrect. Please check settings".      You need to assign a Provider for the web connection and you can choose one from provider list of your country.

Connection parameters (Phone number, access point, used ID and Password) are not important, so don't care about them.  The only parameter that has effect is the DNS address:  if you enter a wrong IP you may not be able to access the MB server, so it is better to leave them as automatic assigned.  In this case BlueDUN will use the Google's default primary DNS IP (8:8:8:8) and secondary DNS IP (8:8:4:4).

4. Access to Comand OnLine Apps or to a web page
Previous steps should be executed only the first time, in normal usage you can select the web navigation icon and open an URL or the Mercedes Benz Apps menu.

It is important to notice that Comand OnLine doesn't access directly to internet web pages but downloads them from the Mercedes Berz VPN server, this means that download speed is considerably slower respect to the phone browser because it depends on MB server congestion.

I suggest to use the phone connected to a Wi-fi network (such as the home or office wifi access point) when you use the Comand Online the first time for accessing the on-line services:   the navigator gets from the server many data for configuring the menu and the apps and the phone must have a stable connection otherwise you need to restart the process again if the connection drops.

Moreover, you have to remember to start the BlueDUN service on the phone before opening a www link, otherwise you will get the message "Function not possible at the moment".   For this reason, you may activate the "Auto-Start" (and "Auto-Resume") option on BlueDUN property panel;  in this manner the DUN service will be always on while the app is running.

If after several attempts, you can not connect, always getting the message "Connection failed" message, it means that bluetooth channel cannot be reused. 
Try closing the connection by clicking the disconnect icon at the bottom right on the Comand, turn off the bluetooth interface on the phone and finally restart the BlueDUN service.

In the preference panel you may also change the Bluetooth Channel:   the default is number 0 [auto-assigned], but if it seems that you cannot start the bluetooth DUN service, enter a value in the range 1-30.  Generally this has not effect for new version of Android because the DUN channel is always auto-assigned.

Another parameter very important for the connection success is the UDP packet delay;  this parameter represents the time delay between each packet sent to the UDP server.  Its default value is 50ms but you can increment it (for example set 100ms or 150ms) if the phone has connection issues.   [Deprecated on new versions]

If none of the previous actions has success, please enable the "UDP Compatibility" option in the property panel, this option increases the connetion timeout and reduces the download speed, but allows the Comand to connect online.  [Deprecated on new versions]