Introduction to Bluetooth Low Energy

Similar documents
Introducing the Adafruit Bluefruit LE Sniffer

BLUETOOTH SMART CABLE REPLACEMENT

IS187x_BM7x - BLEDK3 v1.01 Release Note

PM0237 Programming manual

Introducing BEEKS Proximity Solutions. Developer Kit Gets You Started

Writing Bluetooth Mobile Apps

Texas Instruments CC2540/41 Bluetooth Low Energy Sample Applications Guide v1.3.1

BLE113 DEVELOPMENT KIT

UG103.14: Application Development Fundamentals: Bluetooth Smart Technology

Bluetooth SMART Advertise-Only Beacon Reference Design

BLUETOOTH SERIAL PORT PROFILE. iwrap APPLICATION NOTE

CB-OLP425 DEVELOPMENT KIT GETTING STARTED

Bidirectional wireless communication using EmbedRF

PAN1740 Design Guide

Internet Protocol Support Profile

Bluetooth Smart, But Not Smart Enough

How to setup the UCW232C Serial WiFi adapter

BlueBeacon Bluetooth Low Energy proximity beacon

Bluetooth 4.0 Solutions for Apple ios Devices. Bluegiga Technologies

ECM (ELO-KIT-ECMG2-AND)

ATBTLC1000 BluSDK USER GUIDE. Bluetooth Low Energy API: Software Development. Description

Network Discovery Protocol LLDP and LLDP- MED

Network Discovery Protocol LLDP and LLDP- MED

QSG108: Blue Gecko Bluetooth Smart Software Quick-Start Guide

Pulse Oximeter Profile

New protocol concept for wireless MIDI connections via Bluetooth

NanopowerCommunications: Enabling the Internet of Things OBJECTS TALK

Adafruit NFC/RFID on Raspberry Pi

WiLink 8 Solutions. Coexistence Solution Highlights. Oct 2013

How to setup the UCW232C Serial WiFi adapter

Use case possibilities with Bluetooth low energy in IoT applications

Thierry ZOLLER Principal Security Consultant

eztcp Technical Document Modbus/TCP of eztcp Caution: Specifications of this document may be changed without prior notice for improvement.

Data Loggers for Real Time Temperature Monitoring - WiFi

Cisco AnyConnect VPN Client Installation Guide for Single Factor Authentication: Windows

Quick Start Guide v1.0. This Quick Start Guide is relevant to Laird s BT800, BT810 and BT820 Bluetooth modules.

CAN & LIN Development Tool CLDT1004 HS CAN

Mobile Communications: Lower Costs with Cisco Instant Connect Push to Talk Solution

Indoor Positioning Service

APx4 Wireless System-on-Module 5/8/2013 1

BT LE RFID Reader v1.0

Questions from The New SensorTag - IoT Made Easy Webinar

Introducing the Adafruit Bluefruit LE Sniffer

Connecting your Aiki phone to a network

GETTING STARTED WITH ANDROID DEVELOPMENT FOR EMBEDDED SYSTEMS

Networking Test 4 Study Guide

IP Office Technical Tip

Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation

Bluecoin - Voice and Music Over an Embedded BLE Platform. Central Labs AST Robotics

Adafruit NFC/RFID on Raspberry Pi. Created by Kevin Townsend

Exam 1 Review Questions

Real time vehicle tracking and driver behaviour monitoring using cellular handset based accelerometer and GPS data

Android Application Development and Bluetooth Technology

Module 5. Broadcast Communication Networks. Version 2 CSE IIT, Kharagpur

WEB, HYBRID, NATIVE EXPLAINED CRAIG ISAKSON. June 2013 MOBILE ENGINEERING LEAD / SOFTWARE ENGINEER

Eduroam wireless network - Windows 7

Using the T&D Thermo App with TR-7wf Data Loggers

Automation IO Service

Written examination in Computer Networks

SMART Sync 2011 software

Bluetooth low energy 1

HP Insight Management Agents architecture for Windows servers

FINS Gateway For OMRON PLCs

Syllabus Version 2.5_R ( )

AppPulse Mobile. Whitepaper: Overhead, Privacy, and Security. March 2016

2.0 Command and Data Handling Subsystem

Guideline for setting up a functional VPN

Workshop on Android and Applications Development

Bluetooth Health Device Profile and the IEEE Medical Device Frame Work

Harden SSL/TLS v1.01. Windows hardening tool. Thierry ZOLLER.

Bluefruit LE Python Library

Internet of Things. Exam June 24

How To Configure Voice Vlan On An Ip Phone

WASP User Manual. Revision: 1.6. (c) 2012 North Pole Engineering, Inc.

National breaks synchronizer plug-in

A+ Practical Applications Solution Key

Product Introduction and Setup Examples. RS232 to WIFI Converter

TT-RFID platform - Introduction

CONTROL MICROSYSTEMS DNP3. User and Reference Manual

Nokia E61i Configuring connection settings

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

CentovaCast 3 - Broadcasting With VirtualDJ

SmartDiagnostics Application Note Wireless Interference

Part K:11 OBJECT PUSH PROFILE

E21 Mobile Users Guide

ExpoBadge Mobile App User Guide

How to setup a serial Bluetooth adapter Master Guide

Axia IP-Audio Driver Update v June, 2013

Project 4: Pseudo USB Simulation Introduction to UNIVERSAL SERIAL BUS (USB) STANDARD

Portal Authentication Technology White Paper

E-Blocks Easy Internet Bundle

IPMI overview. Power. I/O expansion. Peripheral UPS logging RAID. power control. recovery. inventory. Hugo CERN-FIO-DS

Configuring CSS Remote Access Methods

APPFORUM2014. Helping the developer community build next-generation, multi-platform apps. SCHAUMBURG, ILLINOIS SEPTEMBER 8-10

TYLER JUNIOR COLLEGE School of Continuing Studies 1530 SSW Loop 323 Tyler, TX

DigitalPersona Pro Enterprise

Watson SHDSL Router Application Manual

Transcription:

Introduction to Bluetooth Low Energy Created by Kevin Townsend Last updated on 2014-04-17 09:15:12 PM EDT

Guide Contents Guide Contents Introduction BLE Platform Support GAP Device Roles Advertising and Scan Response Data Advertising Process Broadcast Network Topology GATT Connected Network Topology GATT Transactions Services and Characteristics Profiles Services Characteristics Further Information Bluetooth SIG Resources Adafruit Resources Mobile Development Resources 2 3 3 4 4 4 4 5 7 7 8 9 9 9 10 11 11 11 11 https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 2 of 11

Introduction Bluetooth Low Energy (BLE), sometimes referred to as "Bluetooth Smart", is a light-weight subset of classic Bluetooth and was introduced as part of the Bluetooth 4.0 core specification. While there is some overlap with classic Bluetooth, BLE actually has a completely different lineage and was started by Nokia as an in-house project called 'Wibree' before being adopted by the Bluetooth SIG. There are plenty of wireless protocols out there for engineers and product designers, but what makes BLE so interesting is that it's almost certainly the easiest way to design something that can talk to any modern mobile platform out there (ios, Android, Windows phones, etc.), and particularly in the case of Apple devices it's the only HW design option that doesn't require you to jump through endless hoops to be able to legally market your product for ios devices. This guide will give you a quick overview of BLE, specifically how data is organized in Bluetooth Low Energy, and how devices advertise their presence so that you can connect to them and start passing data back and forth. BLE Platform Support Support for Bluetooth 4.0 and Bluetooth Low Energy (which is a subset of BT 4.0) is available on most major platforms as of the versions listed below: ios5+ (ios7+ preferred) Android 4.3+ (numerous bug fixes in 4.4+) Apple OS X 10.6+ Windows 8 (XP, Vista and 7 only support Bluetooth 2.1) GNU/Linux Vanilla BlueZ 4.93+ https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 3 of 11

GAP GAP is an acronym for the Generic Access Pro file, and it controls connections and advertising in Bluetooth. GAP is what makes your device visible to the outside world, and determines how two devices can (or can't) interact with each other. Device Roles GAP defines various roles for devices, but the two key concepts to keep in mind are Central devices and Peripheral devices. Peripheral devices are small, low power, resource contrained devices that can connect to a much more powerful central device. Peripheral devices are things like a heart rate monitor, a BLE enabled proximity tag, etc. Central devices are usually the mobile phone or tablet that you connect to with far more processing power and memory. Advertising and Scan Response Data There are two ways to send advertising out with GAP. The Advertising Data payload and the Scan Response payload. Both payloads are identical and can contain up to 31 bytes of data, but only the advertising data payload is mandatory, since this is the payload that will be constantly transmitted out from the device to let central devices in range know that it exists. The scan response payload is an optional secondary payload that central devices can request, and allows device designers to fit a bit more information in the advertising payload such a strings for a device name, etc. Advertising Process The following illustration should explain the advertising process and how the advertising payloads and scan response payloads work. A peripheral will set a specific advertising interval, and every time this interval passes, it will retransmit it's main advertising packet. A longer delays saves power but feels less responsive if the device only advertises itself once every 2 seconds instead of every 20ms. If a listening device is interested in the scan response payload (and it is available on the peripheral) it can optionally request the scan response payload, and the peripheral will respond with the additional data. https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 4 of 11

Broadcast Network Topology While most peripherals advertise themselves so that a connection can be established and GATT services and characteristics can be used (which allows for much more data to be exchanged and in both directions), there are situations where you only want to advertise data. The main use case here is where you want a peripheral to send data to more than one device at a time. This is only possible using the advertising packet since data sent and received in connected mode can only be seen by those two connected devices. By including a small amount of custom data in the 31 byte advertising or scan response payloads, you can use a low cost Bluetooth Low Energy peripheral to sent data one-way to any devices in listening range, as shown in the illustration below. This is known as Bro adcasting in Bluetooth Low Energy. This is the approach use by Apple's ibeacon, for example, which inserts a custom payload in the main advertising packet, using the Manufacturer Specific Data field. Once you establish a connection between your peripheral and a central device, the advertising process will generally stop and you will typically no longer be able to send advertising packets out anymore, and you will use GATT services and characteristics to communicate in both directions. https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 5 of 11

https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 6 of 11

GATT GATT is an acronym for the Generic Attribute Profile, and it defines the way that two Bluetooth Low Energy devices transfer data back and forth using concepts called Services and Characteristics. It makes use of a generic data protocol called the Attribute Pro to co l (ATT), which is used to store Services, Characteristics and related data in a simple lookup table using 16-bit IDs for each entry in the table. GATT comes into play once a dedicated connection is established between two devices, meaning that you have already gone through the advertising process governed by GAP. The most important thing to keep in mind with GATT and connections is that connections are exclusive. What is meant by that is that a BLE peripheral can o nly be co nnected to one central device (a mobile phone, etc.) at a time! As soon as a peripheral connects to a central device, it will stop advertising itself and other devices will no longer be able to see it or connect to it until the existing connection is broken. Establishing a connection is also the only way to allow two way communication, where the central device can send meaningful data to the peripheral and vice versa. Connected Network Topology The following diagram should explain the way that Bluetooth Low Energy devices work in a connected environment. A peripheral can only be connected to one central device (such as a mobile phone) at a time, but the central device can be connected to multiple peripherals. If data needs to be exchanged between two peripherals, a custom mailbox system will need to be implemented where all messages pass through the central device. Once a connection is established between a peripherals and central device, however, communication can take place in both directions, which is different than the one-way broadcasting approach using only advertising data and GAP. https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 7 of 11

GATT Transactions An important concept to understand with GATT is the server/client relationship. The peripheral is known as the GATT Server, which holds the ATT lookup data and service and characteristic definitions, and the GATT Client (the phone/tablet), which sends requests to this server. All transactions are started by the master device, the GATT Client, which receives response from the slave device, the GATT Server. When establishing a connection, the peripheral will suggest a 'Connection Interval' to the central device, and the central device will try to reconnect every connection interval to see if any new data is available, etc. It's important to keep in mind that this connection interval is really just a suggestion, though! Your central device may not be able to honour the request because it's busy talking to another peripheral or the required system resources just aren't available. The following diagram should illustrate to data exchange process between a peripheral (the GATT Server) and a central device (the GATT Client), with the master device initiating every transaction: https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 8 of 11

Services and Characteristics GATT transactions in BLE are based on high-level, nested objects called Pro files, Services and Characteristics, which can be seen in the illustration below: Profiles A Profile doesn't actually exist on the BLE peripheral itself, it's simple a pre-defined collection of Services that has been compiled by either the Bluetooth SIG or by the peripheral designers. The Heart Rate Profile (http://adafru.it/ddy), for example, combines the Heart Rate Service and the Device Information Service. The complete list of officially adopted GATT-based profiles can be seen here: Profiles Overview (http://adafru.it/dih). Services Services are used to break data up into logic entities, and contain specific chunks of data called characteristics. A service can have one or more characteristics, and each service distinguishes itself from other services by means of a unique numeric ID called a UUID, which can be either 16-bit (for officially adopted BLE Services) or 128-bit (for custom services). A full list of officially adopted BLE services can be seen on the Services (http://adafru.it/dda) page of the Bluetooth Developer Portal. If you look at the Heart Rate Service (http://adafru.it/ddb), for example, we can see that this officially adopted service has a 16-bit UUID of 0x180D, and contains up to 3 characteristic, though only the first one is https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 9 of 11

mandatory: Heart Rate Measurement, Body Sensor Location and Heart Rate Control Point. Characteristics The lowest level concept in GATT transactions is the Characteristic, which encapsulates a single data point (though it may contain an array of related data, such as X/Y/Z values from a 3- axis accelerometer, etc.). Similarly to Services, each Characteristic distinguishes itself via a pre-defined 16-bit or 128-bit UUID, and you're free to use the standard characteristics defined by the Bluetooth SIG (http://adafru.it/ddc) (which ensures interoperability across and BLE-enabled HW/SW) or define your own custom characteristics which only your peripheral and SW understands. As an example, the Heart Rate Measurement characteristic (http://adafru.it/ddd) is mandatory for the Heart Rate Service, and uses a UUID of 0x2A37. It starts with a single 8-bit value describing the HRM data format (whether the data is UINT8 or UINT16, etc.), and the goes on to include the heart rate measurement data that matches this config byte. Characteristics are the main point that you will interact with your BLE peripheral, so it's important to understand the concept. They are also used to send data back to the BLE peripheral, since you are also able to write to characteristic. You could implement a simple UART-type interface with a custom 'UART Service' and two characteristics, one for the TX channel and one for the RX channel, where one characteristic might be configured as read only and the other would have write privileges. https://learn.adafruit.com/introduction-to-bluetooth-low-energy Page 10 of 11

Further Information Bluetooth SIG Resources Bluetooth Core Specification (http://adafru.it/ddd) Bluetooth Developer Portal (http://adafru.it/dde) Officially Adopted BLE Profiles (http://adafru.it/dde) Officially Adopted BLE Services (http://adafru.it/dda) Officially Adopted BLE Characteristics (http://adafru.it/ddc) Adafruit Resources Adafruit's nrf8001 Breakout (http://adafru.it/1697) Getting started with the nrf8001 (http://adafru.it/ddf) Mobile Development Resources Application Accelerator Kit (http://adafru.it/ddg) - Sample BLE code for ios, Android or Windows Phone Video: Core Bluetooth 101 (http://adafru.it/ddh) - A good high level overview of Bluetooth from Apple's WWDC 2012 event (requires an Apple ID, but the video is free to download) Last Updated: 2014-04-17 09:15:13 PM EDT Page 11 of 11