darryl ramm's blog

Musings about technology and other interests

Thursday, December 4, 2008

SeeYou Mobile Driven from Silent Wings (on a Mac) over Bluetooth

silent_wings_screen_shot_small.jpg

It’s winter, but I’m flying out of Truckee in the Sierra Nevada mountains on an amazing day, it seems like the middle of summer. I self-launched from Truckee Airport in my new Antares 20E. I’m now around 16,000′ just South West of Truckee airport heading towards Mount Rose. I have the amazing vista of Lake Tahoe off to my right. I decide to head across the Carson valley to the Pine Nut mountains, and reach over to my PDA and change my destination waypoint to Mineral Peak, …. slap. Oh no, it’s all just a simulation.

So here is the setup. The Silent Wings soaring simulator is running on a MacBook Pro and driving a iPAQ hx4700 PDA running SeeYou Mobile. The NMEA (GPS) data to drive  SeeYou Mobile is coming from the (simulated) Cambridge 302 in the (unfortunately just simulated) Antares 20E glider I’m flying. The NMEA data is traveling over a Bluetooth serial link between the MacBook Pro and iPAQ PDA. Once set up properly all I need to do is just start Silent Wings on the Mac and SeeYou Mobile on the PDA and they just talk to each other. SeeYou Mobile works like normal, and you can even record an IGC flight trace on the PDA. But getting to this point can be a little involved. I tried  describing this to people and then realized I really need to write it down in painful detail. So sorry for the length, but here goes…

Introduction

I’ve been meaning to play with the Silent Wings soaring simulator for a while. Silent Wings gets my interest as it runs on a Mac (and also runs on Windows and Linux). I also fly X-Plane, which is an impressive flight simulator but lacks real cross country soaring capability and has very few sailplane models available. One trigger to doing this now is that I want to play with a HP iPAQ 310 Travel Companion running SeeYou Mobile soaring software and as well as flying with it in real-life I can use the simulated NMEA GPS output from Silent Wings to play with this.  However before playing with the iPAQ 310 I wanted to test this idea out with my existing iPAQ hx4700 PDAs. I have a hx4700 running Windows Mobile 2003 that the hx4700 originally shipped with another updated with Windows Mobile 5.0 (which is a performance pig on the hx4700, and not an upgrade I would recommend). Bluetooth setup procedures for Windows Mobile 2003 and 5.0 are identical. Windows Mobile 6.0 may be similar, I don’t have a Windows Mobile 6 device to test with.

Note: If you have an iPAQ hx4700 runnign Windows Mobile 2003 make sure it’s ROM and firmware are at least version 1.10, or you may have problems with SeeYou Mobil hanging. See notes on this here.

Silent Wings can output a  simulated NMEA data stream (which partially simulates that from a Cambridge 302) over a serial port. If the Macintosh had a real physical serial (RS-232) port then it would be s simple matter of connecting a PDA to that port and starting Silent Wings on the Mac and SeeYou Mobile on the PDA. Unfortunately most Macintosh (and most PCs nowadays) don’t have physical serial ports and since both my MacBook Pro and the iPAQ 4700 have built-in Bluetooth (with serial port profiles) lets just use that to do the connection. Unfortunately the cumbersomeness of both the Mac OS X and Windows Mobile and the Bluetooth administration utilities conspire to make what could be a simple task a bit painful.

Of course if you don’t have Bluetooth on your Mac (or Windows PC) you could use a USB to serial adapter on the Mac or PC to the serial port on the PDA. But looking forward to the iPAQ 310 where Bluetooth is the only option, that’s what I wanted to set-up.

Credit to Tod Kurt for a nice blog with Bluetooth configuration instructions that helped  inspired me to document this clearly.  The following was tested  on a Mac PowerBook Pro 17” running Leopard 10.5.5 and also 10.5.6 and Silent Wings 1.09.12. This was tested against HP iPAQ 4700 PDAs running Windows Mobile 2003 and Windows Mobile 5.0.

Caveat: I think Silent Wings is fantastic and what I have on my Macintosh is very usable to play with SeeYou Mobile. However what I’m describing here is probably for failry technical users. I have found a few problems with the Silent Wings NMEA serial port implementation and am working with the Silent Wings developers on getting fixes for these. As is this is quite usable, however for  if you do things like turn off the PDA during a simulated flight you will find problems with Silent Wings hanging or leaving unkillable (zombie)  process on the Macintosh. I’ll provide updates as these issues get fixed.

Overview of the Setup

The configuration main steps we will go through are -

  1. Turn on Bluetooth on the iPAQ PDA
  2. Setup Bluetooth on the Macintosh and pair the PDA and the Macintosh
  3. Configure the Bluetooth serial port in Silent Wings
  4. Configure SeeYou Mobile to use the Bluetooth Serial Port

Each of these steps are described in detail below.

Turn on Bluetooth on the iPAQ PDA

We’ll assume that Bluetooth on the iPAQ was previously turned off and is not paired with the Mac, etc. If not you should still be able to  follow along with these steps. These steps are the same for Windows Mobile 2003 and Windows Mobile 5.0 on the iPAQ hx4700.

Do the following on the PDA.

pda_setup_1.png
  • Step 1A.
  • Go to the Connections panel under Settings and tap the Bluetooth icon (not Bluetooth Manager) to launch the Bluetooth Settings utility.
pda_setup_2.png
  • Step 1B.
  • In the Bluetooth Settings utility Bluetooth will be OFF by default.
  • We will make out changes to the the Default profile, so leave that as is.
  • Tap on the Turn on button.
pda_setup_3.png
  • Step 1C.
  • Once Bluetooth has powered on the Bluetooth Settings panel will look like this.
  • The blue LED on the top front of the hx4700 will also be on. The LED may have been on before if WiFi networking was turned on. All this LED is telling us is that WiFi or Bluetooth network hardware is powered up, it does not give any indication of Bluetooth traffic, if other devices are paired to the PDA or in range etc.
  • Once the Bluetooth has powered up as shown, tap on the Accessibility tab.
pda_setup_4.png
  • Step 1D.
  • In the Accessibility panel, check the options are as shown here, these should be the default settings.
  • It is important that the Accessibility is set to All devices to allow us to set up a new pairing. Do not select Paired devices only, as confusingly this will prevent being able to establish a new pairing.
  • When done tap on the Services tab.
pda_setup_5.png
  • Step 1E.
  • In the Services panel, tap on Serial Port in the scroll list in the upper part of the panel.
  • Make sure that Enable service is checked.
  • Uncheck Authorization required to avoid being prompted for authorization each time you start Silent Wings. This is really important as if SeeYou is already running sometimes the authorization request won’t pop-up on the on the  PDA screen properly (it will be hidden under the SeeYou Mobile window). It’s easier to make sure that authorization is never asked for.
  • Next tap the Advanced… button.
pda_setup_6.png
  • Step 1F.
  • In the Advanced panel note the Inbound COM Port is COM5.
  • The inbound port on the PDA will be connected to the Macintosh when it calls into the PDA. So later we will configure SeeYou Mobile to connect to COM5.
  • Tap OK to close this Advanced window.
  • Tap OK to close the Bluetooth Settings manager.
  • Tap the (X) button to close the Settings folder.
  • We will continue the setup on the Macintosh and come back to the PDA later to compete Bluetooth pairing with the Mac and to configure SeeYou Mobile.
  • Leave the PDA turned on so the Macintosh can discover it in the following setup.

Setup Bluetooth on the Macintosh and pair the PDA and the Macintosh

Now that PDA has Bluetooth is powered on we need to configure Bluetooth on the Macintosh.  Current  Macintosh computers have built-in Bluetooth. Older Macintosh computers can use a third party USB to Bluetooth adapter. The steps to configure systems with most third party USB Bluetooth adapters should be the same as  the instructions here.

Do the following on the Macintosh.

preferences.png
  • Step 2A.
  • Launch the Systems Preferences utility and click on the Bluetooth icon.
bluetooth_panel.png
  • Step 2B.
  • In the Bluetooth panel click on either the Set Up New Device… button or the + button to launch the Bluetooth Setup Assistant.
  • If existing Bluetooth devices have been configured in this panel then the Set up New Device… button won’t be present, just click on the + button in the lower left frame and follow the next steps.
bluetooth_setup_1.png
  • Step 2C.
  • Click the Continue button.
bluetooth_setup_2.png
  • Step 2D.
  • Do not accept the default Device Type there, instead select the Any device option.
  • Click the Continue button.
bluetooth_setup_3.png
  • Step 2E.
  • The Bluetooth Setup Assistant will search for Bluetooth devices.
  • Here the Macintosh has discovered an iPAQ hx4700 with the default system name Pocket_PC. The name of your PDA may be different and other Bluetooth devices may appear here. If there are multiple Bluetooth devices, you may need to select the correct device in the list.
  • Click the Continue button.
setup_passkey.png
  • Step 2F.
  • Click the Passkey Options… button.
  • Select the Automatically generate a passkey option. This will cause the Macintosh to generate a passkey to pair with the PDA later in the setup.
  • Click the OK button.
  • Click the Continue button to go to the next page in the Setup Assistant.
bluetooth_setup_x.png
  • Step 2F.5.
  • We’ll Apple that’s a pretty useless page to bother showing a user (this whole Bluetooth Assistant looks like it was written by a summer intern, who maybe slept through the classes on software usability).
  • Just click Continue.
bluetooth_setup_4.png
  • Step 2G.
  • The Bluetooth Setup Assistant generates a passkey to enter on the PDA. The passkey generated will be different than the one shown here.
  • Look at the PDA, a dialogue box should pop up asking for this passkey.

Do the following on the PDA.

pda_pairing.png
  • Step 2H.
  • The PDA should automatically pop-up a Bluetooth Authentication dialog.
  • Here Darryl MBP is the name of the Macintosh computer requesting the passkey, your computer name should appear instead.
  • Enter the passkey generated by the Bluetooth Setup Assistant.
  • Tap the return button on the soft-keyboard once you have entered the passkey.
  • The Bluetooth Authentication dialog will disappear.
  • Now return to the Macintosh to finish with the Bluetooth Setup Assistant.
  • Note: if the passkey is not entered within about 30 seconds the request times out and you will see an error message in the Bluetooth Setup Assistant on the Macintosh. If this happens just click the Go Back button and then the Continue button to restart the passkey authentication request.

Do the following on the Macintosh.

bluetooth_setup_5.png
  • Step 2I.
  • Deselect the Use device as a headset for this computer option
  • Click the Continue button.
bluetooth_setup_6.png
  • Step 2J.
  • The Bluetooth Setup Assistant should show this if things have worked so far.
  • Click the Quit button.

Configure the Bluetooth serial port in Silent Wings

The Bluetooth Setup Assistant just created a serial port. We need to find out the UNIX device name of that port and configure Silent Wings to use it.

Do the following on the Macintosh.

edit_serial_ports_menu.png
  • Step 3A.
  • The Bluetooth preferences panel should still be on the Mac desktop, if not start System Preferences and click on Bluetooth.
  • If there are more than one Bluetooth device shown in the left hand panel click on the PDA we are configuring to select it.
  • Click on the gear icon and select Edit Serial Ports… from the menu list.
serial_ports.png
  • Step 3B.
  • In the pop-up panel describing serial connections to your PDA look for the serial device we just created. It will start with the name of your PDA, in this case Pocket_PC-BluetoothSeri-1. Take note of this name.
  • In some circumstances if you may see additional serial ports called “PDA synch” or similar names. Don’t worry about them, just note the name of device similar to the example above.
  • Click the Cancel button to close the serial port setting pop-up panel.
  • Click the red window close button to exit the Bluetooth settings panel.

Now we will configure Silent Wing to use this serial port.

The Options>NMEA configuration panel in Silent Wings allows limited configuration of serial ports but its’ enough to get started.

Do the following on the Macintosh.

nmea_options_default.png
  • Step 3C.
  • Start Silent Wings on the Macintosh.
  • Click on the Options button in the main Silent Wings menu

In the Options panel click on the NMEA icon.

You should see the NMEA Options panels shown above.

The first thing you will notice is the default Serial Port option is bogus COM3. A clear left over from the Silent Wings on Windows. Don’t worry, we’ll fix this next.

nmea_output_options.png
  • Step 3D.
  • Click the Enable NMEA Output check box.
  • Silent Wings does not currently show the correct serial port device options for Bluetooth serial ports in the Serial Port pull down list, but we can easily enter the correct serial port device name…
  • Double click on COM3 in the Serial Port button (to select all the COM3 text).
  • We are going to enter the name of the Bluetooth serial port we determined earlier. I’ll use the  /dev/cu or UNIX call out device. So we prepend “/dev/cu.” to the name of the serial device noted earlier. (I need to update comments on this, will do soon – DKR)
  • Following the example from earlier we would enter /dev/cu.Pocket_PC-BluetoorhSeri-1 into the Serial Port field. Your device name may be different.
  • Click the OK button to close the Options panel.
  • Step 3E.
  • Now use Flight Planner or Resume Previous Flight to start a Silent Wings simulation on the Macintosh. You can leave the simulation paused while we finish the last step on the PDA.

Configure SeeYou Mobile to use the Bluetooth Serial Port

seeyou_serial_config.png
  • Step 3E.
  • On the PDA run SeeYou Mobile and go to the Setting>Input panel and click on the Port Settings… button.
  • In the Serial port dialog box change the Port to COM5, the Bluetooth Inbound COM port we notied earlier.
  • Make sure the other settings are as shown here.
  • Click the ok button to exit the Setial port dialog box.
  • Click OK at the bottom of the screen to exit the Settings utility.
  • SeeYou Mobile should be ready to receiving NMEA data from Silent Wings.
  • Note: We are using the inbound port as Silent Wings is essentially dialing-in to this port to connect to SeeYou Mobile.

On the Macintosh unpause the Silent Wings simulator and you should see SeeYou Mobile receiving NMEA data. If so pat yourself on the back. If not, oops, see the trouble-shooting suggestions below.

Normal Use

Now that we’ve been though all this setup the good news is that using this is easy, with just one caveat.

THE PDA MUST BE TURNED ON BEFORE STARTING SILENT WINGS.

Otherwise Silent Wings won’t be able to open the Bluetooth serial port when the simulation starts up and while Silent Wings will run there will be no connection to the PDA.

Because of the way we set up things, with the devices paired and no authorization requirements the Bluetooth link should just start automatically – but that PDA has to be turned on!

You can start SeeYou Mobile before or after Silent Wings is running.

And again do, not power off the PDA while a Silent Wings simulation is running  doing so may hang Silent Wings and leave zombie processes requiring a reboot of the Macintosh. As mentioend before Silent Wings is looking at fixing  this.

Advanced Tips

It is also possible to manually edit the SilentWings options.dat file to configure the serial port. This also allows access to additional options baud rate and NMEA frequency.

  1. Make sure that Silent Wings is not running
  2. Use your favorite text editor to edit the options.dat configuration file (normally found at /Applications/SilentWings/data/options.dat).
  3. Search for “NMEA” and you will find something like this -

#—————
# NMEA Settings
#—————
use_nmea                = true
nmea_port               = /dev/cu.Pocket_PC-BluetoothSeri-1
nmea_speed            = 4800
nmea_frequency     = 1

5. Save changes and close the text editor
6. Start Silent Wings.

options.dat NMEA parameters are -

  • use_nmea is either true or false.
  • nmea_port is just the serial port we’ve talked about before. Remember to use the call out or cu serial port device for reasons discussed here.
  • nmea_speed is the serial port baud rate. I do not recomend increasing this.
  • nmea_frequency is the rate that NMEA data is sent to the PDA. This is sometimes confused by people with the IGC flight trace logging rate. Usually PDAs receive NMEA data at a few to ten times per second or so, which is faster than the rate that data is saved to the  IGC flight trace file (typically once every 1 to 10 seconds). Setting  nmea_frequency to a few times per second may help improve things like wind calculation in SeeYou Mobile (but I have not verified this).

Troubleshooting Suggestions

If things are not working, check over all the above instructions carefully and make sure you followed them exactly.

Under the Silent Wings home directory (usually /Applications/SilentWings) look at the log file data/swings.log and search for “NMEA” and see if Silent Wings has failed trying to open the serial port.

Try deleting the Bluetooth device on the Mac (click on the minus-sign button on the Bluetooth Preferences panel) and starting again reconfiguring Bluetooth on the Macintosh.

On the PDA look under Settings>Connections and try playing with the Bluetooth Manager utility (not the Bluetooth utility described above ).

In the Bluetooth Manager Click on the Connections tab to see active Bluetooth connections to the PDA. If you don’t see a serial port connection listed under Incoming Connections something is wrong.

Play around in the Bluetooth Manager and you should be able to work out how to look at paired devices, press and hold on the icon for a paired devices and in the pop-up menu that appears try deleting the pairing and repeat all the above process again.

If things seem to be almost working, it may be worth trying to test the serial link by running terminal emulators on the Mac and PDA.  You should be able to see characters typed back and forth. Unfortunately there is no terminal emulator included with Windows Mobile. However there is a basic terminal emulator built into Naviter SeeYou Mobile. To access this go to Settings>Hardware and tap the Terminal… button.

A good commercial terminal emulator for Windows Mobile is DejaVu Software PocketTTY, which can do a lot more than just serial port connectivity. The five minute at a time free evaluation mode of PocketTTY may be enough for a quick debug, but the software is easily worth the ~$20 price.

To get a terminal emulator session on the Macintosh run Terminal.app and in the terminal window type -

screen -U /dev/cu.Pocket_PC-BluetoothSeri-1 4800

Where /dev/cu.Pocket_PC-BluetoothSeri-1 is the name of the device created earlier. If your PDA has a different name than the default Pocket_PC this device name will be different. Now launch your terminal emulator on the PDA and you should be able to see characters being typed back and forth, there is no local echo, so what is typed on one device will only appear on the other device.

If you are curious what things such as baud rates are actualy set on the Macintosh serial port you can use the  UNIX stty command. For example once the serial connection from the Mac to the PDA is established type the following in a terminal session-

stty -f /dev/cu.Pocket_PC-BluetoothSeri-1

Where, again this device name may be different for your particular Bluetooth serial device.  See man stty for more information.

posted by darryl at 1:49 am  

1 Comment »

  1. [...] connected over Bluetooth to the NMEA output from Silent Wings  soaring simulator on a Macintosh (see details here). While messing around with this I discovered that with Windows Mobile 2003 and ROM and firmware [...]

    Pingback by darryl ramm’s blog » Firmware update fixes iPAQ 4700 Windows Mobile 2003 Bluetooth Hang with SeeYou Mobile (and likely others) — December 18, 2008 @ 9:41 pm

RSS feed for comments on this post. TrackBack URI

Leave a comment