So you are tired of using USB cables or even USB – UART converters and want to have some wireless action on your device. You think bluetooth might be the best option but are confused by all the layers on the stack and the various versions like BT2.0, BT4.0, BLE and so on. This post will try to shed some light on this and summarize the options available and how difficult or easy it can be to add BT to your device.
Intro to BT versions
At the moment the main BT versions common are BT 2.0, 2.1, 3.0 (High Speed) and 4.0 (latest version). Most Host devices at the moment support BT2.1 while newer devices like iPhone 4S have BT4.0. The range of a BT device depends on the “Class”, Class 1 being the maximum range and Class 3 the lowest. For indoor applications, with a range of 10m or less, Class 2 is the answer.
Now you can think of BT4.0 as being the sum of BT 2.0/2.1/3.0 (called “Classic Bluetooth”) and Bluetooth Low Energy (BLE). And the cool thing of BLE is that it is an entireley new and simpler protocol from the ground up, including the physical layer. It specifically targets applications where you don’t need to stream a lot of data, but you just want to send some small data periorically or so. The problem with BLE right now is that most Phones/PCs do not support it yet.
Another thing worthy of mention in the Classic BT vs BLE debate is that if you want to have a device that can talk to iPhone/iPad/iPod, then it is better to use BLE because you do not have to sign up for the Made For iPhone program to use BLE
BT Soc vs Module …BT2.0
Whatever BT version you want to add to your device, you have basically two options – use a BT SOC chip from Ti, CSR or someone else OR use a BT “module” from Roving Networks, Panasonic or someone else. The difference is that the SOC is just the chip with the RF front end and implementing the BT stack up to the HCI interface, while the module will come with an antenna and the entire BT stack up to some “Profile”, usually the Serial Port Profile (SPP). SPP is what we need to transmit data bytes between BT devices.
The SOC is cheap (1-3$) but it’s only the chip – so it is your responsibility to design the antenna, get the BT certifications and in the case of BT 2.0 – 3.0 write a significant amount of software (the BT stack from the HCI layer upwards to RFCOMM/SPP) before you can transmit a byte of data from your favourite mobile phone to your device. In other words, using BT 2.0 – 3.0 on your device by adding an SOC is not for the weak of heart.
If you do decide to go the SOC way, I have found an open source stack that actually works - I have tested it - on PIC32. You should check it out. It is entirely event based and build upon the existing Microchip USB drivers. The whole stack compiles into less than about 8KB ROM, though it does require a heap around 4kB.
The simpler option is to buy a ~15$ module from Roving Networks or Panasoic or someone else. These modules have the entire stack up to SPP built-in and also remove the burden of certification from you. All you have to do is plug in the module to your PCB and configure it with your MCU by sending some AT commands over the UART. You can almost immediately start working on your Application as if it were a serial port.
BT Soc vs Module …BLE
The SOC vs Module question plagues BLE too. But in this case the burden of implementing the stack is no longer upon you as the BLE stack is much simpler than Classic BT. Even the SOC chips come with a built-in stack but some of try to trip you by forcing you to buy IAR compilers and other usless stuff. All this is documented extensively here.
If you decide to use a module for BLE, then you would want to look at Murata or Bluegiga.
In the next posts I will post some of the code I have been using to talk to my Roving Networks BT2.0 enabled device from Windows, Linux and Android.