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

Forward Logo (image)      

Mac OS X Serial Bluetooth Connection
from your Mobile Phone

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

How to Make a Serial Bluetooth connection from your mobile phone to Mac OS X

The Bluetooth pfodAppTM for AndroidTM uses serial Bluetooth connections.
pfodAppTM for Android allows you to control micro-controllers, like Arduino, via bluetooth, from your Android phone. No Android programming required.

For testing purposes it is convenient to make serial Bluetooth connections between you mobile phone and a terminal session on your Mac. This page describes how to connect from an Android mobile to a terminal session running on Mac OS X. This is an alternative to the preferred method which used a USB Bluetooth connection. The preferred method can be used for Windows, Mac or Linux and also provides direct serial access to the bluetooth module for configuration.

Enable Bluetooth on Mac OS X
Add Bluetooth Device
Assign a Serial Port
Assign First Serial Port (did not work for me)
Install CoolTermMac terminal Program
Setting up the Mac connection on pfodApp™
Setting up the CoolTerm connection on Mac
Connecting pfodApp™ to CoolTerm on Mac using “SerialPort” (did not work for me)
Connecting pfodApp™ to CoolTerm on Mac using “SerialPort-3” (this worked for me)
Adding another SerialPort (this worked for me)

Enable Bluetooth on Mac OS X

First turn on Bluetooth on your Mac, click the Bluetooth icon in the top right hand corner.

If the bluetooth icon is not showing, open the System Preferences and search for bluetooth.



Click on the Bluetooth icon and in the window that opens set the “Show Bluetooth in menu bar” (bottom left), then close the window

Add Bluetooth Device

To get the Mac to scan for your Android mobile you will, in a moment, open the Bluetooth Icon again and choose “Set up Bluetooth Device”, but first you must set your Android mobile to be discoverable.

On you Android mobile open the menu

and choose “Settings” and from there choose “Wireless & networks” and then “Bluetooth settings” and click on “Discoverable”

Then on your Mac open the Bluetooth Icon again and choose “Set up Bluetooth Device..”

Mac will auto-magically scan for new devices and should find your Android mobile.
If it does not find your mobile, Andriod as probably timed out discoverability, so set it to be discoverable and try again. If you continue to have trouble then make the Mac discoverable and try searching for it from your Android. Note: Your Mac only needs to be discoverable until your Android is paired, then you make it not discoverable again.
Either of these methods work.

Click “Continue” to commence pairing your Mac and your Android.

On your Android, click Pair to complete the pairing.

Mac then displays

Assign a Serial Port

Now that your Android and Mac are paired, you need to set up a Serial port for the Terminal program to talk to.

NOTE: I had to setup two serial ports. The first one I set up Mac called “SerialPort”. This serial port took a long time to connect and then disconnected as soon as it connected. So I setup another Serial port, which Mac called “SerialPort-3” and that one worked.

So below I will describe just what I did, including trying the first “SerialPort” port. If it also does not work for you then continue to try adding another one as detailed below.

Assign First Serial Port (did not work for me)

Open the Bluetooth Preferences again and select your Android connection and then click on the “Advanced” button (bottom right)



This opens the connection configuration panel

Click the “+” button, bottom left, to add another connection. My Mac called this connection “SerialPort”.
Un-select the PDA sync connection and select the SerialPort (I did not select the “key” column, but that column does not seem to affect the result)

From the right hand drop down choose RS-232 as the type of connection.

Note: This Serial Port did not work for me, but you may have better luck. So assuming you do lets continue to try and connect using it.

Install CoolTermMac terminal Program

For a terminal program I used CoolTermMac which I downloaded from freeware.the-meiers.org site. Unzipping this file gives you a folder containing CoolTerm for Mac. Open that folder to find the CoolTermMac program.

Double click to start CoolTerm

Setting up the Mac connection on pfodApp™

Follow the steps described here to set up a connection for your Mac in your mobile's pfodApp. Note: the timeout for the Mac connection is set to 0.

Now (very important), you need to have CoolTerm setup and 'connected' before you try and connect from your Android mobile to the Mac.
So lets do that now (remembering that “SerialPort” did not work for me and I had to do further steps below)

Setting up the CoolTerm connection on Mac

In CoolTerm, select “Connection” and then select “Options...”

In the Options panel, hit the drop down list for Port: and select the SerialPort

Also select “Terminal” and click the Local Echo so you can see what you send to the pfodApp.

Click OK to save these settings. (When you exit CoolTerm you will be prompted to save this setup to a file.)

Connecting pfodApp™ to CoolTerm on Mac using “SerialPort” (did not work for me)

To connect from pfodApp to the CoolTerm on the Mac, having set the “SerialPort”, click on the Connect button in CoolTerm

When you click the “Connect” button the RTS and DTR lights come on.

Now that CoolTerm is waiting for a connection, on your Android mobile, open pfodApp and select your Mac connection to initiate the connection.

This is as far as I got using the “SerialPort”. After a longish wait the connection just failed, so I continued as below to get a working connection.

Connecting pfodApp™ to CoolTerm on Mac using “SerialPort-3” (this worked for me)

As noted above the “SerialPort” connection did not work for me. CoolTerm did not show the {.} opening message that pfodApp sends on connecting.

The solution I found to this problem was to add another serial port to my Android's Mac connection. This serial port has a -number appended to the end. Any such Serial port seems to work. The one Mac assigned was “SerialPort-3” but any number is ok, just not “SerialPort” (why?)

Adding another SerialPort (this worked for me)

To add another SerialPort, open the Bluetooth Preferences again, select your Andriod connection and click on Advanced. Then click on “+” (bottom left) to add another SerialPort. As before set the type to RS232 and un-select the other ports. Click OK

Then in CoolTerm, click on “Connection”, “Options..” and from the drop down list select your new serial port (SerialPort-3 in my case). Note: You may need to hit the “Re-scan Serial Ports” button to get CoolTerm to find the new port without restarting CoolTerm

Then click CoolTerm's “Connect” button again to wait for a connection on SerialPort-3, and then open pfodApp on your mobile and connect to your Mac again.
Very important, you need to have CoolTerm setup and 'connected' before you try and connect from your Android mobile to the Mac.

This time my connection succeeded and CoolTerm showed the initial {.} message sent by pfodApp, requesting the pfodDevice's main menu.

Now you can continue to testing out pfod messages to see how they will display on the pfodApp and what commands the pfodApp will return when the user makes a selection.


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-2015 Forward Computing and Control Pty. Ltd. ACN 003 669 994