At Droidcon UK 2014, Martin Woolley of the Bluetooth Special Interest group discussed Android 5 improvements for Bluetooth Low Energy and how to use Bluetooth Smart based Internet of Things (IoT) devices from Android smartphones. Below are some key takeaways of Martins session.
Regular Bluetooth has been around for over a decade and was intended for streaming audio. Bluetooth headphones and carkits use regular Bluetooth to communicate with your smartphone. Because of the large amount of data involved in streaming audio, Bluetooth connections use quite a lot of power which is a problem on battery powered devices.
However there is a whole range of devices that only require a small amount of data to be transmitted. Heart rate monitors, GPS trackers, smart light bulbs and temperature sensors are but a few of the Internet of Things (IoT) devices that are proliferating at the moment. This is where Bluetooth Low Energy.comes in. Bluetooth Low Energy (also called Bluetooth Smart) has a much lower transmission frequency which vastly improves the power consumption involved. A regular Bluetooth connection will deplete a smartphone battery in a few hours, but on a Bluetooth Low Energy a smartphone battery will last for months or years. And the same applies to the devices your smartphone connects to. This is why Bluetooth Low Energy is seen as a key enabler of the Internet of Things (IoT). Apple uses a subset of Bluetooth Low Energy to implement its iBeacon protocol.
Bluetooth communication consists broadly of five steps:
- Discover a device. A client (your smartphone) looks for devices that are broadcasting their existence. The broadcasting devices are said to be in “discoverable mode”.
- Explore what you can do with the device. This is called service discovery. The Bluetooth has a protocol for finding out which commands you can send to a device and which data you can retrieve from it.
- Interact with a device. This is two-directional. The device can be queried (i.e. tell me what the temperature is) or the device can notify you – heart rate and gps sensors do the latter.
Bluetooth LE works on many devices that are available right now for consumers. You can build products and applications that consumers can buy and use.
Manufacturers of Bluetooth devices are free to decide what names and values they use for attributes and services. Two different heart rate monitors may have different service and attribute names for the same things.
There is no central place to find device characteristics so you have to code this for each and every device type you want to use. (edit: since this article bluetooth.org has introduced a registry of services and attributes. It will be interesting to see if this registry gains support from device vendors).
Implementations of the Bluetooth stack on smartphones do not get the care they deserve by smartphone manufacturers. Some API’s are buggy and will drop connections, mishandle errors and require restarting the phone to re-enable Bluetooth operations.
Bluetooth Low energy facts
- Bluetooth LE works well in radio saturated environments because it can hop to different frequencies up to 1600 times a second
- Native smartphone support on 96% of current smartphones
- Developer friendly: API available on most smartphone platforms
- Growing rapidly. 1 Billion devices shipped in 2012, 2,5 Billion in 2013, 30 Billion sales expected in 2030
* Note: Apple, iBeacon and Bluetooth are registered trademarks.