Bluetooth?
by Pete-O | May 01, 2007 | 11 comments
Skill Level:
Beginner
We get a lot of questions about Bluetooth® connections. No, really - whatever number you're thinking, multiply it by an order of magnitude. But that's not entirely surprising. In our never-ending quest to bring you the best deals, we've played musical Bluetooth® dongles, each using its own drivers (and they don't play nice with each other). We've got the Blue SMiRF, the Extended Blue SMiRF, and the DIP module. We've also got the WiTilt and the 6DOF, each of which have a Bluetooth® module on them. And the result of all this versatility? Chaos, my friend.
But take heart, because I'm here to shed some light on all of this. I'm going to spell it out as best I can what it takes to get the Bluetooth® modules talking to each other. I'll start with the dongles, then I'll cover the SFE products. So get yourself comfy, grab a cool, refreshing beverage of your choice and dim the lights because here we go.
The Dongle Dance
Over the course of the last year, we've sold something like 4 different Bluetooth® USB dongles (Nate swears there was a fifth, but I can't remember it). The first was a flat-ish, metallic blue looking thing with what appeared to be plant fronds on it. Then there was the black one with the fake antenna on it - a classic, to be sure. If you're the proud owner of one of these items, the only thing you need to know at this point is that they should work with the BlueSoleil software package (V1.6 is the most current at the time of writing) and that the connection procedure is soon to follow in this tutorial.
Currently if you order a Bluetooth® USB dongle from us, you're liable to get one of two items:

The one on the left is translucent and has an LED in it that indicates connection status. It also uses the BlueSoleil package. The one on the right doesn't show anything of its innards. And, most importantly, it DOES NOT work with the BlueSoleil software. Well, let me qualify that: it works with the BlueSoleil software up to 5MB worth of data transfer, then it quits. The software it does work with is called XTNDConnect Blue Manager V3.1b, and that's what it's shipping with.
Some thoughts on these two packages.... First, you CANNOT have both of these on your computer at the same time. In fact, it seems to be a universal Bluetooth® truth that you can't have more than one Bluetooth® application on any given computer. If you do, you'll open the seventh seal of hell (have trouble). Secondly, I've used both of these packages now and I find them both to be at least adequate in functionality, which is to say that I can make them work with our serial applications. Do I have a preference? Not really. They both do their job and that's good enough. Just make sure you're using the right software for the right dongle.
XTNDConnect
Now let's talk about the respective software packages, starting with XTNDConnect. I won't cover installation, just making serial connections. I'm hoping that installation is clear from the manufacturer's documentation.
OK, so assuming that you've got XTNDConnect installed and the window up, you should see something like this:

Hitting the Refresh button will cause the Bluetooth® dongle to search for devices. Currently my window shows three devices within ear-shot, and one of them happens to be a BlueRadios module on a clients project board (BULL1). That's my target.
So here's what you do. Go to Tools -> Options and you'll see this window:

What this says is that my Bluetooth® serial port access in on com18, so I open Hyperterminal to com18 and I get this window:

From here, single click on the target (BULL1 in this case), hit OK and the connection is made. To terminate the connection, just hang up in Hyperterminal. Every time you try to connect, you'll get the above window and you can select whatever device you wish to connect to.
Next up: BlueSoleil. After installation, you'll be prompted to install a device (plug in the dongle). When you do, you'll get this window:

For our purposes, just make sure that the security box at the bottom is UNCHECKED. We want to keep the monkey wrenches out of the works, and security settings can certainly be a hang-up (no pun intended). Click OK, and we're looking at the main window:

In the above example, I've already done a search for devices in range. As you can see, they appear as icons "orbiting" a big, happy yellow/orange sun. That sun is actually a button that you can click on and initiate a new search for devices. However, searches done from that button do not eliminate targets that are no longer in range or have been turned off. To get the true current list of devices, go to View->Refresh. This will eliminate everything and start a fresh list.
OK, so we're looking at the icons for the devices in range. There's also a line up of icons across the top of the window that represent available services for any given target. Double click on a target icon and you'll see icons light up across the top for what the target is offering. In this case, BULL1 will light up the serial icon (third from the left). To connect to the device, right-click on the target, go to Connect->Bluetooth® Serial Port Service, like so:

Then you'll get this window:

Click 'No' unless you intend to connect to this device every time you open a port. Then open your terminal program to whatever com port it's been assigned to (38 in my case) and you're good to go. To disconnect, right-click on the icon from BlueSoleil and choose disconnect.
And that's the basic gist behind the two Bluetooth® packages that we deal with these days. But there's more you should know...
The BlueSoleil software can be finicky sometimes. It can discover targets, then refuse to connect to them. I've circumvented this issue in several ways: swap dongles (a mismatch can cause it), reinstall the software, those sorts of things. It always seems to want to assign higher and higher com ports, and it seems that the higher the port number, the more likely it is to be finicky. But not once have I seen it caused by a problem with the target device.
I've worked less with XTNDConnect, so I haven't had as much opportunity to see it do silly things. But one thing we have seen around here is that once it's on your computer it's pretty much there to stay. I cannot strip this thing from my machine. The "Add/Remove" programs button just blinks at me when I hit it and I swear I hear it laughing at me. In spite of that, I'm sure there's a way to get it off, but it's unknown at the time of this writing. The software seems to work alright and it hasn't caused me any other headaches, so I'm willing to look the other way for the time being.
BlueTooth Gadgets from SFE
SparkFun Electronics now sells a range of devices that offer Bluetooth® connectivity. We have the Bluetooth® DIP module and the Blue SMiRF's (basic and extended). Then there are the 6DOF and WiTilt sensor arrays. All of these items use the same BlueRadios BR-SC30A Bluetooth® module. The BlueRadio module is identical across all devices and uses the same AT command set. These radio modules communicate with their host via AT commands, all of which are listed in the AT command data sheet (available from us upon request). But even with this plethora of info at our fingertips, chaos ensues and people get lost in the Bluetooth® jungle. So let's talk about these devices and their quirks.
The DIP Module

Even if you don't have the DIP module, this section is mandatory reading.
This one is as basic as they come. All we've done is to break out the module pins to 0.1" headers. Here are a few tips on getting started with this module:
1) Power and logic are 3.3V, no more. There's no regulator on the device, so don't deviate from the spec. And yes, that's the voice of experience talking.
2) To discover the device from another Bluetooth® device, attach a very clean 3.3V to power, ground to ground, and tie PIO4 to ground. You should then be able to see it from the searching Bluetooth® device. Experience has shown us that using a noisy 3.3V will cause problems during discovery. Use decoupling caps, low-noise regulators, and ground planes wherever possible. Not mandatory, but you'll save yourself some time by using them.
3) To communicate with the device from a serial port (hard line to the devices UART), you first have to translate the RS232 to 3.3V logic. The module defaults to 9600/8/1/hardware flow control, and it's default service is a serial port. The right way to connect is to do the level translation on TX/RX/CTS/RTS, then connect TX to RX, RX to TX, CTS to RTS and RTS to CTS (if any of that is confusing to you, I would HIGHLY recommend that you Google RS232 protocol and do some research - it's time very well spent). The quick-and-dirty way to connect is to do the translation on TX and RX: Connect TX to RX, RX to TX, then just short CTS and RTS (on the DIP module) together. Once you make your hardware connection, open a terminal program to 9600/8/1/
4) Communicating with the module over the Bluetooth® Link can done via the discovery and connection procedures outlined in the previous section describing the USB dongles. Upon power up, the BlueRadios module defaults to slave/standby mode and is ready to accept connection from a unit acting as master. A Bluetooth® connection can also be made to the DIP module from another DIP module via AT commands. This entire procedure is detailed in the AT command data sheet, but I'll give an example anyway:

The first thing I should mention is that I've got local echo turned on in Hyperterminal so you can see what I'm entering. The BlueRadios modules DO NOT ECHO your commands. In the above example, I first entered "AT
5) Disconnecting from the BlueRadios module can be done from the directions from the previous dongle section of you're using one of those. Terminating the connection between two BlueRadios modules is slightly more complicated. The correct way to do it is to enter command mode by hitting "+++
Notes on command mode: If you have a connection between one of the USB dongles and one of the BlueRadios modules and you hit "+++
6) There are two lines on the BlueRadios module that can help you determine the status of the device. PIO5 will toggle at a rate of once per second while the unit is in slave/standby mode (entering "ATUCL
If all else fails and you think your module has gone off to never-never land, there are a couple of reset procedures you can try. One is to hold PIO4 high for 1 second upon power up, which resets the unit to factory AT settings. The other is to strobe the reset line for >5mS, which performs a soft-boot of the firmware. This one might be necessary if you're power supply takes any longer than a few milliseconds to come up.
There, wasn't that basic? No, it certainly was not. But don't worry. Things will simplify after this.


On the left we have the basic Blue SMiRF with 4 pins, and on the right we have the extended Blue SMiRF with 6 pins. The only difference between these two devices is that the basic has CTS and RTS connected for you so that you can forego hardware flow control and the extended has CTS and RTS broken out so that you can use hardware flow control. The differences between these devices and the DIP module are that the Blue SMiRF's have voltage regulators on them so you can power them with 5V, and the I/O lines are 5V tolerant. And, of course, the Blue SMiRF's don't have all those other pins broken out for you (but you can get to them with a DMM if you need to troubleshoot). Beyond those few points, everything said about communicating with the DIP module applies to these as well. The BlueRadio module is identical across all devices and uses the same AT command set. Is this the device for you? You'll have to decide that for yourself. Will you need flow control? Do you need greater functionality, or will you in the future? Consider carefully before making a decision.

The WiTilt line of products are our first endeavor into wireless sensor arrays. And if you've read this far and you know what's going on, connecting to this thing is a breeze. All you need to do is follow the directions given either in the USB dongle section or the DIP section (depending on what you're connecting with), and once the connection is established hit the reset button on the WiTilt unit. You'll then see the config menu come up on your terminal program. For specifics on navigating the WiTilt config menu, please see its data sheet.
Future hardware revisions will include smaller switches, Bluetooth® Status LED's and an SMA connector for an external antenna. Somehow we might even manage to make it smaller. But it is currently our intention to continue to use the BlueRadios module so that connectivity procedure will not change.
Firmware revisions are also on the horizon, but they also will have no effect on the connectivity procedure.

The 6DOF line of products also uses the BlueRadios module. The 6DOF V2 data sheet states that you have to go through the BlueRadios baud rate configuration before starting, but testing the units precludes that procedure. The connection sequence is just like that of the WiTilt. Once you've made the connection, hit the reset button on the 6DOF and you're good to go.
Hardware and firmware revisions are also on the horizon for this line of products. But just as for the WiTilt, they will have no effect on the connectivity procedure.
Well my friends, that about wraps it up. I sincerely hope you've enjoyed our time together as much as I have, and more than that I hope you come away with a dangerous amount of knowledge. Knowledge is power, you know.
As always, let us know what you think.
-PDD
Comments 11 comments
Thanks a lot for all those crystal clear explanations.
Very nice breakdown. I’m running BlueSoleil, which I like, and this cleared a couple of things up (particularly that I wasn’t the only one it messes with). Have you tried CCleaner to get rid of XTNDConnect? That seems to work well on a lot of stubborn programs. Just be careful with it. It’s powerful enough to blue screen you with one wrong box checked.
I have a Blue SMiRF with 4 pins intended to be used for a remote communication between an Arduino Board and a PC. I am not able to communicate with Arduino. BlueSolei and Blue SMiRF indicate the establising of the connection but Arduino is not responding.
Did you have any progress? I have the same problem as yours.
Yeah… I got this dongle and the Bluesmirf. I have been more happy with the built in XP support of the BT donle than the BlueSoleil. I set my bluesmirf to master and BLuesoleil sees it, but will not actually allow any communication (will not connect). I tried to download the latest Bluesoleil software, but it is a limited version. The softeware that comes with it is not ‘upgrade-able’ to the current version. So, in summary, if you get it to work in XP natively, you may want to skip either Bluesoleil or other communications package. I was trying it to see if the software I was using would work any better with Bluesoleil compared to the built in XP drivers.
You mention the BlueSoleil software wanting to assign ever higher COM numbers. That’s because when good ol' Microsoft assigns a COM port number, it then reckons it should reserve that number for ever, for that device, just in case. If you look in device manager and look at the advanced properties of any serial device, you can reassign the port to a lower number; but you open the drop down list and they all seem to be “in use”. Quite simply, that’s a lie. It merely means that once upon a time, they were assigned. You can just ignore the “in use” and assign them to whatever port number you wish. Unless you’re unlucky of course and the number you chose does clash with something currently connected; then of course you have to try again.
MUCH better though, if you write your own software, use FTDI chips and use the FTDI FTD2XX drivers, which work much better than the awful Microsoft VCP drivers (which uses the COM numbers). The FTD2XX dll works much morereliably and doesn’t get prissy about COM numbers.
I’m looking to have 2 IMU each with a bluetooth module. Can i connect both of them to one PC and recieve data from both at the same time?
I’m looking at the IMU Digital Combo Board – 6 Degrees of Freedom ITG3200/ADXL345 what components do I need to add the bluetooth part to it.
thank you