GPS project: the Bluetooth saga

BluetoothSo my shiny new replacement Bluetooth module was in, including a return shipping label for the bad one! I hooked it up, and after a few minutes realized that it had the same symptoms as the “bad” one laying on my desk.

After some testing, including multiple reboots, installing putty, and a quickly thrown together .NET serial port listener, I finally had a single instance of success, where I attached to the port with putty, and low and behold there were ASCII strings streaming across the screen. I went back to the Arduino IDE, and the connection was gone. I began seeing a pattern, and after fiddling with it for a while, got a reproducible set of steps. The port was locking open after the Arduino IDE had been started (and in fact wasn’t showing as an available port in the IDE), and the only way to get the port available again (to other apps) was to cycle the power to the Bluetooth device. At this point I plugged the “bad” module back in, and attached to it with putty. Of course it worked just fine.

I sent a quick note to Tom at Hacktronics to let him know my findings, and even offered to pay for the shipping since the device wasn’t bad. He politely declined my offer. Once again: Way to go Hacktronics! I wish they had a larger selection of parts, so I could give them more of my business.

At this point I had a working device, but still a couple of issues. I couldn’t use / listen to it via the Arduino IDE, and in fact once the IDE had been started, I would have to cycle power on the device to make it work. On top of that, the IDE had become very slow and sluggish since adding the Bluetooth serial ports to my machine. A bit of research on the “sluggish” issue revealed that it was a known problem in a serial library used in the IDE, and in fact there was a user fixed version of the library available. My particular issue was not part of the documented problem or fix, but I figured it would be a good starting point. Once installed, all of the problems with the device cleared up.

Now I could get back to the task at hand, which happened to be adding 3 lines of code: declaration of an instance of NewSoftSerial, calling the instance constructor with a baud rate, and a single call to pass the char from the hardware serial port to the software serial port before passing the data further into the app for processing. I spent the rest of the evening getting the info flowing into Google Maps on my HTC Touch Pro.

Now I could turn my attention back to the software side of the project. My next task was to add some buttons, and get menus built, but before I jumped into all that I wanted to get some cleanup done. I spent a couple of evenings breaking the loop into individual routines to handle different tasks, removing orphaned routines and variables, and other general housekeeping.

Next I’ll outline the Lithium Backpack setup, and adding buttons and menus that take the project from a simple logger, to a limited feature GPS device.

0 Comments