Home | pfodApps/pfodDevices | WebStringTemplates | Java/J2EE | Unix | Torches | Superannuation | | About Us

Forward Logo (image)      

Bluetooth Connections
Via USB Bluetooth

by Matthew Ford 11th January 2012 (originally posted 1st August 2012)
© Forward Computing and Control Pty. Ltd. Ltd. NSW Australia
All rights reserved.

How to set up a USB Serial Bluetooth Connection to your Computer
Windows, Mac or Linux

This page will cover setting up a serial Bluetooth connection from pfodApp
TM for Android to a Windows computer via a USB serial Bluetooth Module. This same method can also be used for connecting to Mac and Linux. Although I am use pfodApp as the connecting device, this method will also work of other devices wanting to connect to a terminal session on the computer via bluetooth.

Update: SparkFun is no longer selling Bluetooth Modem - BlueDongle USB sku: WRL-08180. Mentioned under Connecting to Windows 7, Mac and Linux (Obsolete). The alternative USB dongle seems to have some issues, so I am suggesting an alternative approach. Bluetooth to RS232 to USB.

Connecting to Windows, Mac or Linux via a Bluetooth-RS232-USB

This approach has the advantage that it uses the same Bluetooth module that you will use for your micro-computer projects. The only additional bit you need is a USB to 5V RS232 adaptor. I choose the SparkFun BOB-00198 - Breakout Board for CP2102 USB to Serial mainly because it was simple and had drivers for Window, Mac and Linux. For the Bluetooth module I choose the SparkFun WRL-10268 - Bluetooth Mate Gold as its pinouts almost exactly matched the CP2102 breakout board. You could also use the less expensive Silver module but you will need to change the wiring to suit.

NOTE: the photos and circuits shown on SparkFun's website for the Silver module are NOT the correct ones. The pinout is different from the Gold module.

These two units can be used in 4 modes:-

  1. To connect your Android mobile to a computer terminal session by connecting the Bluetooth module to the RS232-USB module to the computer. In this mode you can quickly design the messages your pfodDevice will send to the pfodApp running on you Android Mobile and check that the screens are what you want and capture the types of messages that will be sent by the pfodApp to your pfodDevice.

  2. To connect your Android mobile, running the pfodApp, to your pfodDevice by connecting the Bluetooth module to your pfodDevice. This is the finished mode where you want to be able to control you micro-computer from you Android mobile. (This will not be covered here. Refer to the pfodDevice examples.)

  3. To connect you pfodDevice to your computer by connecting the pfodDevice to the RS232-USB module directly (no Bluetooth). This is a testing mode that you may find useful. In this mode remove the Bluetooth from your pfodDevice and connect the serial output from you micro-computer directly to the USB-Serial module.

  4. To connect to the bluetooth module directly from a serial terminal session in order to configure it by connecting the Bluetooth module to the RS232-USB module to the computer. In this mode you can send configuration commands to the bluetooth module to configure its baud rate and other settings via RS232 (and the PC terminal session)

Install the CP2102 USB to Serial Drivers

I downloaded CP210x_VCP_Win_XP_S2K3_Vista_7.exe from the Silabs website (http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx) and just ran it to install the driver. Then I plugged in the SparkFun CP2102 USB to Serial breakout board and Windows found it and assigned a COM port to it.

Update: 11th January 2013 - I tried the Mac drivers from Silabs and they did not work for me. They installed and were visible but they did not add a serial /dev/tty... device to connect to. As far as I could tell the productId was correct for Mac. So until this is sorted out I suggest you connect to Mac directly using the builtin bluetooth. See this page for the details.

Installing the PC Terminal Emulator

This assumes you are using a Windows PC. If you are using a Mac or Linux you will need to install similar terminal software to connect to the Serial port provided by the USB serial Bluetooth card. I have used CoolTerm for Mac which I downloaded from the freeware.the-meiers.org site.

To communicate with the PODapp™ via the bluetooth serial connection on your PC, you need a terminal emulator. I use TeraTerm (http://ttssh2.sourceforge.jp) but there are lots of other possibilities, including Hyperterminal

Open TeraTerm and start a new connection. Choose the COM port that matches your Bluetooth Serial Port.

Open the Setup → Terminal dialog and tick Local Echo and set New-Line Receive: to CR+LF. Local echo lets you see what you are typing and Receive CR+LF makes the display more readable.

Open the Setup → Serial Port.. and check the Baud rate is set to 115200 (the default for this card).

Connecting the USB Serial module to the Bluetooth module

I built this little connector board to connect the bluetooth module to the USB serial module. I you can find a reliable USB-bluetooth module that supports you operating system, all in one then you can use that instead.

Here is a Parts List (click photo for full size image)

I soldered up a little header that I could plug the Bluetooth module into. This lets me unplug the bluetooth module when I want to just use the USB to serial connection.

<< Click for full size pdf's

Completed Board (click photo for full size image)

Download the drivers you require from http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx

Pairing the USB Bluetooth Module from an Android phone

Open the phone's options menu

Select “Settings” and then choose “Wireless & Networks”

Select “Bluetooth settings” This screen lets you disable bluetooth, change the name of your phone, scan for new devices and most importantly make you phone discoverable or NOT discoverable to other bluetooth devices. On scanning for devices the phone finds the FireFly USB Bluetooth module.

Click the “FireFly” device to pair with it and enter the modules PIN. The default is 1234

Click OK. The USB bluetooth module is now Paired, but not connected.

Connecting pfodApp™ to TeraTerm

You need to start TeraTerm before connecting from your mobile phone, because the pfodApp™ sends the getMainMenu message, {.}, immediately after the connection is established.

Start the pfodApp™ on your mobile phone and connect to your PC.

Press the (+) button to add a pfodDevice.

Selecting the “FireFly” device opens the pfodDevice configuration screen where you can Edit the display name and set a connection Timeout in mS. 1000 = 1sec, 2000 = 2sec etc. Here I have changed the device name to PC and set it never to timeout by setting 0 timeout.

Pressing the “Save” button, saves these setting and displays the pfodDevice list again.

Click the “PC” item, connects the the computer's USB bluetooth module.

The TeraTerm window shows the {.} message from the pfodApp.

And the pfodApp shows “Waiting for response...”

You can now type pfodDevice messages into the terminal window and the pfodApp on the phone will display them. For example entering
{.PC Main Menu|o~on|u~up|d~down}

Is displayed by the pfodApp on the phone as a menu list for the user to select from.

See the pfodSpecification.pdf for details of all the pfod messages and see the pfod main page for example pfodDevices.

Connecting to Windows, Mac or Linux via a USB Bluetooth Module (Obsolete)

The Bluetooth to USB serial adapter I use was from SparkFun, Bluetooth Modem - BlueDongle USB sku: WRL-08180 with a compatible miniB (5pin) USB cable (e.g. sku: CAB-00598). This card is based on the FTDI chip set. http://www.ftdichip.com/Drivers/VCP.htm provides Virtual Com Port (VCP) drivers for Windows, Mac and Linux. I used the Windows driver.

To install the drive, I unzip the CDM20814_WHQL_Certified.zip file to a directory and then plugged in the USB serial Bluetooth card. In the device manager (click on Start and type device manager in the search box) and look for a COM device with an ! mark. Right click on it and choose Update Driver software... and Browse to the directory where you unzipped the CDM20814_WHQL_Certified let Windows install the appropriate driver.

Go back to the Device Manager. It should now show you a COM port number for this device. In this case COM8.

Right click on the USB Serial COM device and choose Properties and the Port Settings tab and make sure the port speed is set to 115200 which is the default speed for this card.

Next Install the PC Terminal Emulator, as described above.

The General Purpose Android/Arduino Control App.
pfodDevice™ and pfodApp™ are trade marks of Forward Computing and Control Pty. Ltd.

Forward home page link (image)

Contact Forward Computing and Control by
©Copyright 1996-2020 Forward Computing and Control Pty. Ltd. ACN 003 669 994