As discussed in part one of our Bluetooth series, applications for the technology are endless and prototypers should consider including it in new products. In part two, Enventys Partners explores the wireless technology in more detail, looking at both “flavors”—Bluetooth classic and Bluetooth Low Energy (BTLE)—as well as exactly how Bluetooth devices communicate and some easy ways to prototype them.
The Ubiquitous Technology of Bluetooth
As once a self-professed Bluetooth-hater, there was a time when I refused to accept the technology in my personal life. Now, my existence drowns in Bluetooth-enabled devices: speakers, LED lights, mice, Fitbit, Amazon Echo Dot, headphones—the list goes on. While Bluetooth products are useful to have around, it can be worthwhile to make your own devices. In the second and final part of this series, I will discuss more of the details of this technology as well as techniques and hardware you can use to build your own fleet of Bluetooth devices.
Two Bluetooth “Flavors”
There are two main types of Bluetooth to be aware of as a developer, classic Bluetooth and Bluetooth Low Energy (BTLE). While they both use 2.4 GHz as their radio frequency, they operate somewhat differently.
Classic Bluetooth can push out a lot of data, up to 358 bytes, at close range, making it suitable for audio devices as the high-data throughput helps maintain high-quality audio. However, this capability comes with some drawbacks in the battery life, and the longer pairing time (though still less than 1 second). Bluetooth Classic requires a pairing sequence to initiate the connection, which is usually a long button process. The other drawback is that you can only bond one device to each peripheral, so to share a speaker, you need to unpair the connection and then pair with a new phone.
Bluetooth Low Energy
As the name implies, BTLE is a lower-power version of Bluetooth and is better suited for IoT devices. It was first introduced in the 4.0 specification of the protocol in 2009 and was initially marketed under the name Bluetooth Smart. Since the message size is limited to 8-47 bytes, it is perfect for IoT devices that need to transmit just a few pieces of information, such as temperature or other sensor data.
Depending on the broadcast frequency, battery life can last for days, months or even years. This allows devices to wake up, transmit their data and then go back to sleep until their next broadcast. BTLE devices are not compatible with Bluetooth Classic, but fortunately, smartphones have dual-mode chips that support both types of connections.
Bluetooth Network Architecture
The network architecture for Bluetooth devices includes a central device and one or more peripheral devices. The central device, usually a smartphone, is the boss and controls the relationship with the peripheral devices. It can query them for sensor data or command them to act, like changing LEDs to a specific color.
The peripheral device is submissive in the relationship and does what the central device asks. However, the central device needs to know the peripheral device is available in the first place. The peripheral sends out advertising signals at a programmed frequency, sometimes every at a fraction of a second, other times every few hours depending on the desired battery life, until it finds a receptive central device.
The central device can communicate with up to seven Bluetooth devices at once, but a peripheral can only pair with one central device at a time—unless it’s set up as a beacon. A peripheral in beacon mode only broadcast data and will never actually pair with a central device. This one-way communication allows multiple central devices, usually smartphones, to receive the data it offers. This is a typical setup in retail applications where beacons advertise a coupon or product in the store.
Characteristics and Services
Attributes, called services and characteristics, define the way that Bluetooth devices share data. A characteristic is a single data point that can be shared between Bluetooth devices. For example, a smart scale may report a characteristic like weight.
A service is a defined group of one or more characteristics that compose a sensible packet of information. Staying with the smart scale example, the service may report the characteristics of weight, BMI and device battery level. Each characteristic has a unique identifying number (UUID), and the Bluetooth website provides ID numbers for officially adopted characteristics and services that Bluetooth devices commonly use. This also makes it easy for smartphones to recognize different types of Bluetooth devices.
Prototyping with Bluetooth
Nordic Thingy 52
One of the easiest ways to prototype a device with Bluetooth is by using the Nordic Thingy 52. Nordic is an industry leader in manufacturing Bluetooth chips, and the Thingy is a development board suitable for both newbie and seasoned developers. The Nordic Thingy 52 has many sensors onboard, including temperature, humidity, air pressure, and CO2 concentration, as well as an RGB LED and speaker. This allows you to see live sensor data, change the LED color and pulse pattern and play audio tones. Conveniently, the app is free to download and lets you interact with the device without writing any code.
For the more adventurous prototyper, other developer boards and tools provide an easy route to customized options. Arduino offers a Bluetooth-enabled version of its ubiquitous development board, which is programmable through the Arduino IDE. It also has a familiar footprint and 5V logic that’s helpful for many Shadetree programmers.
Circuit Playground Bluefruit
The Circuit Playground Bluefruit, produced by Adafruit, has many on-board sensors, including temperature, accelerometer, microphone, and light, as well as a ring of RGB addressable LEDs. It can be programmed easily with the Arduino IDE or Circuit Python, an easy language for beginners to interact with hardware. To transmit sensor data or interact with I/O pins, you can integrate it directly with the free Adafruit Bluefruit Connect application or the web app via a chrome web browser. And, as everything Adafruit produces, there are a ton of easy-to-follow tutorials and sample code to get you going.
Build with Bluetooth
Bluetooth is a robust and ever-growing technology becoming an increasingly more significant part of the consumer electronics space. While it is the backbone of personal audio devices, it’s also an integral part of the IoT ecosystem, especially in wearables. If you’re a prototyper, it’s essential to understand how Bluetooth works and how to build with it. Check out part one of our Bluetooth series or reach out to Enventys Partners if you need help along the way.
Want To See This Advice In Action?
Check out our case studies and learn more about how we’ve achieved stellar results for our clients.