Bluetooth & BTLE

Bluetooth is a newer protocol but one you’re likely familiar with because it has gained a ton of popularity with gadgets and small devices. Like WiFi, Bluetooth is wireless, and like WiFi, it operates in the 2.4GHz band so pretty much anyone can use it, and does. In fact, the frequency-sharing of WiFi and BT is why just about every mobile phone, tablet, computer, and laptop that has WiFi also has Bluetooth.

Bluetooth Classic and Bluetooth Low Energy

Watch out! There are TWO Bluetooths, and these really trip people up. There is Classic and Bluetooth LE / BTLE/BLE (Bluetooth-Low Energy) BLE is sometimes referred to as "Bluetooth Smart" but honestly we just hear people say B.L.E., BT 4.0 or just (sigh) BT. That confusion trips people up the first time they work on Bluetooth.

Range

Range is about the same for both classic and low energy. Technically the max range is about 300 feet or 100 meters, but that’s very generous and assumes a powerful radio. In reality, you will find over 10 or 20 meters can be challenging.. about 2 Mbps max for Bluetooth Classic and less than a Mbps for BLE.

Compare that with WiFi’s bandwidth and range! But remember! BT classic and BTLE are completely different protocols and are not compatible. There are some radio chips that can do both but be sure to check before quoting the parts.

Classic & BTLE Similarities

There are some overlaps between classic and LE. Both use 2.4 GHz and are intended for short-hop wireless communication. For example, wireless keyboards and mice, headsets, or smart watches. The idea behind BLE was keep the range of Classic, use a lot less power (e.g. the Low Energy part), and add some more features. For example, one of the newer features of BLE are beacons that broadcast information, so when you fire up your phone the beacon will tell you about itself - These are often set up with apps to do building-scale location services.

Classic Use Cases: Audio & Keyboards

Even though Classic is no longer being actively developed you’ll still see it used for some purposes.

For example, audio devices such as wireless headsets and speakers are almost always Classic (there is a push to get audio devices moved to BLE but it hasnt happened yet due to the lower data rates specified in BT 4, version 5 will fix that).

 

In this Digikey bluetooth classic speaker, when we open it up we can see the control circuit board and a few chips, on the right you can see the BT trace antenna

Keyboards and mice can be either Classic or BTLE, it depends on when it was made but many are still Classic because production is already in progress.

 

For example this selfie stick uses a small Classic chip to send a single keypress.

 

We can barely make out the chip in the center of the selfie-stick PCB and a trace antenna in the top left corner

Classic can also do ‘generic’ data transmission using the SPP serial port service but SPP has fallen out of favor, mostly because it is unavailable to iOS developers without a lot of Apple-side licensing efforts. Basically, If you want to do short-hop data transmission, go with BTLE. Classic BT’s current draw is maybe 20-30mA, and classic chips don’t sleep well.

Bluetooth LE - The New Hotness

BLE is the newer Bluetooth. As we mentioned, it is not back-compatible, but adds a few things:

  • Lower power
  • Can use sleep modes for even lower power
  • Much faster pair/connection times (classic is 30 seconds, BTLE cane be 3 seconds)

But...

  • It has less bandwidth (the coming-soon version 5.0 changes this)

Because BLE pairs fast, you can sleep until it's time to connect and transmit data and the user often can’t even tell. For IoT, BLE devices can easily run for weeks, months or even a year on battery. Your fitness monitor, for example, runs on BLE. It only has to sync wirelessly once a day so it sleeps until then and then does the data sync fast.

Here's a power trace showing a microcontroller with a BLE radio turning on just to transmit/receive data. The microcontroller isn't in sleep mode here, so you can see there's 20mA of baseline quiescent.

Ultra low power Beacon mode

In beacon mode, where it is only transmitting a short burst of data once every few seconds, a year’s lifetime is easy to budget. You can transmit a couple dozen  bytes in a beacon burst which may be enough for your sensor data.

Commonly found BTLE 'lost and found' tags contain a small BTLE chip and a single coin cell. They send a beacon once a minute or so and can last for a year or more on the battery thanks to the sleep modes afforded.

iOS Support

The biggest reason BLE has taken off is that Apple allows anyone to create a BLE-capable app and pair with their hardware. It’s pretty much the only way you can connect hardware to iOS devices without licensing, special programs or an NDA. This has pushed vast numbers of developers over to BLE and has created a massive ecosystem of chip manufacturers, stacks, and code examples. Again, no such thing for Bluetooth Classic other than generic BT keyboard support

Server to Multi-Client Connection

Note that for both classic and low energy, you have a ‘controller’ (a.k.a. central) and ‘clients’ (often called peripherals) so its a point-to-multipoint setup, just like WiFi’s single access-point router and multiple clients.

It is possible to set up some BLE chipsets to be in central and/or peripheral mode for point-to-point links. Check the documentation for your device & ask the manufacturer - sometimes you can flip between the two, sometimes you can do both simultaneously - but you need the software stack support.

Which to Choose? Classic or BLE?

One of the nice things about BLE is that the number of chips that support it have grown a lot so there’s a lot of great options for BLE whereas for BT classic, the development environment, documentation, and options were very limited. If you have to make a choice between the two, consider supporting BLE only!

Good Things about BLE

  • BLE is very low power
  • Supported by just about every phone/tablet/laptop and most PCs.
  • Good for short-hops, up to ~20 meters
  • BLE is fairly reliable for pairing, and fast
  • Beacon mode may be all you need (but it is clear-text)
  • All-in-one chipsets have improved a great deal
  • Latest BLE 5.0 chipsets can do multipoint/mesh networking (check your chip docs!)

Challenges...

  • You may need to add and verify your own security - unlike WiFi many BLE stacks are often unencrypted by default!
  • Not connected directly to the Internet, may need a gateway
  • You may need to pay a BT SIG Fee per device.
  • Some OS support is weak, especially pre windows-10 and linux

Gateway to the Internet

Keep in mind, Bluetooth doesn't easily directly connect to the internet like WiFi can. (If you think about it, WiFi goes through a router to Ethernet) For Bluetooth, you’ll need to set up your own router to send data via WiFi, ethernet, etc. Since almost every mobile device has both BLE and cellular/WiFi, often times those handheld devices are used as a bridge.

Multi-Platform support

The biggest downside we’ve seen with BLE is that desktop OS support for everything but audio/keyboard lags behind mobile support. Because so many BLE devices connect to mobile, the Android/iOS support may be easier to implement and better supported than Linux/Windows/Mac. Note that this is software/OS support we're talking about. Hardware support for BTLE is pretty much standard issue now.

Often times, developers just decide that the only way to communicate with their gadget is through a cell phone. There is a slow-but-steady push to have WebBluetooth as a cross-platform wireless interface but it isn’t finished yet. This may not matter to you depending on your use case, but if you expect users to interact using their PCs, be sure to allocate plenty of time to develop a multi-platform solution!

You can save time by going with a precertified module, these often have pretuned antennas that work out-of-the box - less certification is required. But you’ll pay a little more!

 

More final product designs do not use a module - the low power output of BLE and protocol-simplicity (compared to WiFi) makes it a lot easier to pass certification requirements

 

Here's an nRF52832 based module and the internals, as you can see there's not a lot going on here

Our original Bluefruit Feathers are the 32u4 and M0-based. These pairs are very similar looking, and have the same basic idea behind them: there is a main processor which is an ATmega32u4 or ATSAMD21 and a co-processor module which is the red and silver rectangle, containing an nRF51 which can do Bluetooth Low Energy only.

 

The nRF51 is programmed with our Bluefruit firmware and can be controlled with AT commands over SPI connection. When the main processor (32u4 or M0) wants to send or receive BLE data, it sends commands to the co-processor module

 

Pick up a Feather M0 or 32u4 Bluefruit at DigiKey

The Feather nRF52 is a new direction compared to our 32u4 or M0 Bluefruit boards. This Feather has only one chip on it - and that chip is both the processor you program and also the Bluetooth Low Energy radio. What's nice about this is you can do more powerful stuff, and faster too, because you don't have to manage two chips. It's also lower price and lower power since there's only one processor, and easier to put into sleep modes.

 

Pick up an Adafruit Feather nRF52 at Digikey

Even though this is primarily considered a WiFi Feather, the ESP32 does contain a BT LE and BT Classic radio! That's right this is the only Feather that can do BT classic. It's also the only one that can do WiFi and BT (altho, as of this writing, it cannot do both at once)

 

Sounds great, right? Well, there's some caveats. As of this writing, October 2017, the ESP32 Arduino Bluetooth core is still under development and there's only one basic beacon example. The Espressif IDF has more examples but some are not fully documented, so we put this one at the bottom of the list. If there's an example for what you want to do, then you're in luck!

 

Pick up an Adafruit Feather ESP32 at Digikey

Raspberry Pi computers like the Pi 3 and Pi Zero W have built in Bluetooth Classic and BTLE and BTLE can be central or peripheral. That's the good news. The bad news is Linux BT & BTLE support is notoriously difficult and variable. It's certainly possible to get it working, but it isn't as easy as something using a Nordic chipset, for example.

 

That said, the fact that the Pi has WiFi, BT/BTLE, and Ethernet makes it a very good candidate for a gateway device

Last updated on 2017-11-01 at 04.09.20 PM Published on 2017-11-01 at 04.23.54 PM