Intro to Bluetooth Low Energy: Learn Bluetooth Low Energy in a single weekend
()
About this ebook
The Definitive Guide to Bluetooth Low Energy-fully updated
Do you find wireless technologies overwhelming? Are you a developer, student, or technology enthusiast seeking to master Bluetooth Low Energy (BLE)? Look no further!
Mohammad Afaneh
Mohammad Afaneh has been developing embedded software and firmware since 2006. He has worked at and consulted for many companies in the IoT space, including the Bluetooth SIG, InPlay Inc., Allegion (Schlage locks), Motorola, Technicolor, Audiovox, Stanley Security, and more. He founded Novel Bits in 2015 with the goal of helping developers and engineers learn all about the exciting world of Bluetooth technology and how to develop Bluetooth-connected devices. His books, courses, blog posts, and videos have helped tens of thousands of developers learn about Bluetooth Low Energy technology.
Related to Intro to Bluetooth Low Energy
Related ebooks
CCNA Voice Study Guide: Exam 640-460 Rating: 0 out of 5 stars0 ratings5G Mobile Core Network: Design, Deployment, Automation, and Testing Strategies Rating: 0 out of 5 stars0 ratingsLearning 5G in the Real World Rating: 3 out of 5 stars3/5Wireless Networking Technology: From Principles to Successful Implementation Rating: 0 out of 5 stars0 ratingsChipless RFID Sensors Rating: 0 out of 5 stars0 ratingsUnderstanding Telephone Electronics Rating: 3 out of 5 stars3/5Near Field Communication (NFC): From Theory to Practice Rating: 0 out of 5 stars0 ratingsLTE Standards Rating: 0 out of 5 stars0 ratingsTelecommunications Crash Course, Third Edition Rating: 0 out of 5 stars0 ratingsSoftware-defined radio Second Edition Rating: 0 out of 5 stars0 ratingsTelephone Communication System Essentials Rating: 0 out of 5 stars0 ratingsElectromagnetic Compatibility Engineering Rating: 0 out of 5 stars0 ratingsWindows Server 2012 Hyper-V Installation and Configuration Guide Rating: 0 out of 5 stars0 ratingsWireless Networking Rating: 2 out of 5 stars2/5Wireless Public Safety Networks Volume 1: Overview and Challenges Rating: 0 out of 5 stars0 ratingsFuture WI-FI Communication Technology Rating: 0 out of 5 stars0 ratingsWireless Communication Networks Supported by Autonomous UAVs and Mobile Ground Robots Rating: 0 out of 5 stars0 ratingsMastering Mac OS: From Basics to Advanced Techniques Rating: 0 out of 5 stars0 ratingsIntroduction to GSM: Second Edition Rating: 0 out of 5 stars0 ratingsDesigning Secure IoT Devices with the Arm Platform Security Architecture and Cortex-M33 Rating: 0 out of 5 stars0 ratingsLTE and the Evolution to 4G Wireless: Design and Measurement Challenges Rating: 5 out of 5 stars5/5Smart Phone and Next Generation Mobile Computing Rating: 1 out of 5 stars1/5Mobile Learning Smartphones A Complete Guide Rating: 0 out of 5 stars0 ratingsSDWAN A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsNextGen Network Synchronization Rating: 0 out of 5 stars0 ratingsLTE for UMTS: OFDMA and SC-FDMA Based Radio Access Rating: 3 out of 5 stars3/5SD-WAN Demystified: Empowering Your Network for Success Rating: 0 out of 5 stars0 ratingsUnderstanding Microelectronics: A Top-Down Approach Rating: 0 out of 5 stars0 ratingsPower Management in Mobile Devices Rating: 0 out of 5 stars0 ratings
Telecommunications For You
The TAB Guide to DIY Welding: Hands-on Projects for Hobbyists, Handymen, and Artists Rating: 0 out of 5 stars0 ratingsPharmacology Demystified Rating: 4 out of 5 stars4/5Digital Filmmaking for Beginners A Practical Guide to Video Production Rating: 0 out of 5 stars0 ratingsCodes and Ciphers - A History of Cryptography Rating: 4 out of 5 stars4/5Statistics DeMYSTiFieD, 2nd Edition Rating: 3 out of 5 stars3/5A Beginner's Guide to Ham Radio Rating: 0 out of 5 stars0 ratings130 Work from Home Ideas Rating: 3 out of 5 stars3/5Medical Terminology Demystified Rating: 4 out of 5 stars4/5Pre-Algebra DeMYSTiFieD, Second Edition Rating: 0 out of 5 stars0 ratingsMath Proofs Demystified Rating: 5 out of 5 stars5/5Medical Charting Demystified Rating: 2 out of 5 stars2/5Nurse Management Demystified Rating: 0 out of 5 stars0 ratings101 Spy Gadgets for the Evil Genius 2/E Rating: 4 out of 5 stars4/515 Dangerously Mad Projects for the Evil Genius Rating: 4 out of 5 stars4/5Radio and Radar Astronomy Projects for Beginners Rating: 0 out of 5 stars0 ratingsMake Your Smartphone 007 Smart Rating: 4 out of 5 stars4/522 Radio and Receiver Projects for the Evil Genius Rating: 0 out of 5 stars0 ratingsiPhone Unlocked for the Non-Tech Savvy Rating: 0 out of 5 stars0 ratingsVoIP For Dummies Rating: 0 out of 5 stars0 ratingsTor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5Making Things Move DIY Mechanisms for Inventors, Hobbyists, and Artists Rating: 0 out of 5 stars0 ratingsTrigonometry Demystified 2/E Rating: 4 out of 5 stars4/5iPhone Unlocked Rating: 0 out of 5 stars0 ratingsWireless and Mobile Hacking and Sniffing Techniques Rating: 0 out of 5 stars0 ratingsDemons of the Deep Rating: 0 out of 5 stars0 ratingsCell Phone Photo Tips: How to Take Better Photos with Your Smart Phone Rating: 3 out of 5 stars3/5Silicon Photonics: Fueling the Next Information Revolution Rating: 0 out of 5 stars0 ratingsAndroid App Development For Dummies Rating: 0 out of 5 stars0 ratingsGoing iPad (Third Edition): Making the iPad Your Only Computer Rating: 5 out of 5 stars5/5
Reviews for Intro to Bluetooth Low Energy
0 ratings0 reviews
Book preview
Intro to Bluetooth Low Energy - Mohammad Afaneh
INTRO TO BLUETOOTH LOW ENERGY
by Mohammad Afaneh
Cover Design and Graphics by Esat Balaj
Editorial design by Luca Funari
Copyright © 2023 Novel Bits, LLC. All Rights Reserved.
No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher, except in the case of brief questions embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the publisher at the address below.
Current Edition (Version 1.1): October 2023
First Edition (Version 1.0): August 2018
ISBN: 979-8-9891226-2-2
Novel Bits, LLC PO Box 698
Fishers, IN 46038, USA
https://novelbits.io
logo: NovelBitsThe Bluetooth® logo is a trademark of the Bluetooth SIG and is used under license by Novel Bits, LLC.
DISCLAIMER
The content provided in this book is designed to provide helpful information on the subjects discussed. This book is not meant to be used, nor should it be used, to diagnose or treat any medical condition. The numbers in this book are theoretical and to be used for illustrative purposes only. The publisher and the author are not responsible for any actions you take or do not take as a result of reading this book and are not liable for any damages or negative consequences from action or inaction to any person reading or following the information in this book. References are provided for informational purposes only and do not constitute endorsement of any websites or other sources. Readers should also be aware that the websites listed in this book may change or become obsolete.
CONTENTS
PREFACE
About the Author
Why I Wrote this Book and Second Edition
Who is this book for?
How to read this book
ACKNOWLEDGMENTS
CHAPTER 1 — THE BASICS OF WIRELESS TECHNOLOGIES
What are Wireless Technologies?
The Importance of Wireless Technologies
Network Topologies
Communication Protocols
Overview of Popular Wireless Technologies
Summary
FREE Exclusive Resources
CHAPTER 2 — THE BASICS OF BLUETOOTH LOW ENERGY
Introduction to Bluetooth Technology
Bluetooth Classic vs. Bluetooth Low Energy
Technical Facts About Bluetooth Low Energy
The Advantages and Limitations of Bluetooth LE
FREE Exclusive Resources
CHAPTER 3 — BLUETOOTH LOW ENERGY FUNDAMENTALS
The Bluetooth® Standard
The Low Energy
in Bluetooth LE
The Bluetooth Low Energy Protocol Stack
Host
Application
Host Controller Interface (HCI)
Physical Layer
Link Layer
Host-level Stack Layers
Profiles
GATT Design
Advertising & Scanning
Connections
Extended and Periodic Advertising
Direction Finding
FREE Exclusive Resources
CHAPTER 4 — BLUETOOTH LE SECURITY & PRIVACY
A Common Security Model
Security Attacks
Security Measures in Bluetooth LE Advertising
Privacy Measures in Bluetooth LE Advertising
Security Measures in LE Audio Broadcast
Security Measures in Bluetooth LE Connections
Privacy
An Overview of the Different Security Keys
Security Modes and Levels
Practical Aspects of Bluetooth LE Security
Additional Resources
FREE Exclusive Resources
CHAPTER 5 — BLUETOOTH LE AUDIO
Introduction
Base Foundations of LE Audio
LE Audio Specifications
LC3 (Low Complexity Communications Codec)
Auracast™ Broadcast Audio
FREE Exclusive Resources
CHAPTER 6 — BLUETOOTH MESH
The Basics of Bluetooth Mesh
The Architecture of Bluetooth Mesh
Core Concepts and Terminologies
Node Types
The Provisioning Process
Security in Bluetooth mesh
Features Added in Version 1.1 (2023)
FREE Exclusive Resources
CHAPTER 7 — BLUETOOTH BEACONS
What are Bluetooth Beacons?
Bluetooth Beacon Standards
FREE Exclusive Resources
CHAPTER 8 — BLUETOOTH LE DEVELOPMENT
Introduction
Roles in Bluetooth LE Development
Skillsets Required
Bluetooth LE Product Development Process
Development Tools and SDKs
Bluetooth LE Peripheral vs. Central Development
FREE Exclusive Resources
CHAPTER 9 — PRACTICAL ASPECTS OF BLUETOOTH LE DEVELOPMENT
Best Practices for Bluetooth Development
How to Choose a Bluetooth LE Chipset/Module
Debugging Bluetooth Low Energy Applications
Optimizing for Power Consumption
Optimizing for Data Throughput
Optimizing for Range
Bluetooth Low Energy Sniffers
Summary
FREE Exclusive Resources
CHAPTER 10 — GETTING STARTED WITH WEB BLUETOOTH
Introduction
Project Context
Prerequisites
Setup
Web Bluetooth Development
Source Code
Conclusion
FREE Exclusive Resources
CHAPTER 11 — BLUETOOTH LE APPLICATIONS & IMPLEMENTATION CHALLENGES
Examples of Real-World Bluetooth LE Devices
Common Bluetooth LE Development Challenges
FREE Exclusive Resources
APPENDIX A
Free Exclusive Resources
Bluetooth Low Energy Training
Additional References
APPENDIX B
Glossary
PREFACE
About the Author
Mohammad Afaneh has been developing embedded software and firmware since 2006. He has worked at and consulted for many companies in the IoT space, including the Bluetooth SIG, InPlay Inc., Allegion (Schlage locks), Motorola, Technicolor, Audiovox, Stanley Security, and more.
Throughout his career, he worked on multiple IoT (Internet of Things) products, including wireless electronic door locks, satellite receivers, wireless doorbells, and various other side projects.
In July 2015, he decided to leave his full-time job to start his own company Novel Bits, LLC, where he shares his knowledge and experience through corporate on- site Bluetooth Low Energy training, online educational resources (blog posts, videos, books, etc.) and the Bluetooth Developer Academy, all focused on Bluetooth Low Energy development.
You can reach Mohammad at his email mohammad@novelbits.io or by connecting with him on LinkedIn.
Why I Wrote this Book and Second Edition
It’s been almost five years since the publication of the first edition of this book. Bluetooth technology has changed so much during this period, and the time has come for a significant update to this guide! So I bring you the Second Edition.
When I first started learning Bluetooth Low Energy, I spent hours, days, and weeks reading every resource I could get my hands on. However, all the ones I came across were either:
Too technical, leaving me overwhelmed with all the jargon and details that I didn’t really care about as a beginner.
Too short, leaving me with many unanswered questions.
This is aside from the fact that the last read-worthy book written on Bluetooth Low Energy was published/updated back in 2015. That’s 8+ years ago, which is an eternity for a rapid-changing wireless technology standard such as Bluetooth!
I even spent weeks going through the 3,000+ page Bluetooth Core Specification document in an attempt to find answers to the many questions I had. While the Specification did have the answers to my questions, it was extremely difficult to decipher and understand. That is especially true for taking that information and translating it into practice (which, for me, was Bluetooth LE development on embedded systems).
With this book in your hands, my goal is to save you from going down the same painful path of learning Bluetooth Low Energy that I went down.
Instead, you can spend a few hours reading through this guide that will teach you the core concepts of Bluetooth Low Energy – only what you truly need – to get started with this exciting wireless technology.
My promise is for you to be able to read through it in a single weekend! I really hope I deliver on this promise.
Who is this book for?
This book is for anyone looking to learn and get started with Bluetooth Low Energy, no matter your technical background. I’ve written this book with simplicity as the top priority.
Whether you’re an embedded developer, a mobile developer, a test engineer, a Field Applications Engineer (FAE), a Technical Sales Rep, a CTO, or even a CEO, I think you’ll find this guide easy to read and understand.
How to read this book
This book is best read in sequence, from beginning to end. It can, however, also be used as a reference if you already have enough knowledge about Bluetooth Low Energy or you’re interested in learning about a specific topic within Bluetooth Low Energy.
ACKNOWLEDGMENTS
I dedicate this work to my mother, Ameena, my better half, Dana, and my three sons, Bassam, Yaseen, and Yazeed.
Thank you so much for your endless love and support! 🖤
Signature author: MohammadCHAPTER 1: THE BASICS OF WIRELESS TECHNOLOGIESCHAPTER 1:
The Basics of Wireless Technologies
Before we dive into the details of Bluetooth technology and Bluetooth Low Energy (LE), let’s take a look at wireless technologies as a whole.
Why? Here are some important reasons to do so:
If you understand the basics of how different wireless technologies work and what they can be used for, you’ll have a better understanding of how Bluetooth LE fits within the bigger picture. This knowledge will help you figure out what makes Bluetooth Low Energy different from other wireless technologies and what its strengths and weaknesses are. This will make it easier to understand why Bluetooth Low Energy is good for some use cases but not for others.
As a developer, engineer, engineering manager, or innovator, you need to have a full understanding of the wireless communication landscape in order to choose the best technology for your project. By learning about the basics of wireless technologies, you’ll be better able to decide if Bluetooth Low Energy is a fit for your project.
Many current systems and apps use a combination of different wireless technologies to fulfill product requirements. If you know the basics of different wireless communication standards, you’ll be able to design devices that successfully utilize both Bluetooth LE and any other complementary wireless technologies.
Wireless communication is an area that is constantly changing, with new technologies and standards popping up all the time. If you know the basics of wireless technology, you will not only be able to understand current technologies like Bluetooth LE, but you will also be able to quickly pivot and take advantage of new developments in the broader wireless technology field.
What are Wireless Technologies?
Wireless technologies encompass a broad range of communication systems that enable the transfer of data between devices without the need for physical connections, such as wires or cables.
These systems rely on the transmission of electromagnetic waves, including radio frequency (RF), infrared (IR), and microwave, to convey information through the air or space. Wireless technologies have significantly changed how we communicate, access information, and interact with devices, playing a vital role in many aspects of modern life.
Wireless Communication Standards
Various wireless communication standards have been developed to address the specific needs and requirements of different applications, including Wi-Fi, Bluetooth, Zigbee, cellular networks (GSM, CDMA, LTE, 5G), Near Field Communication (NFC), and Ultra-Wideband (UWB).
These standards operate on distinct frequency bands and employ unique methods for data transmission, catering to the diverse demands of modern wireless communication systems.
The Importance of Wireless Technologies
Wireless technologies have become essential components of our daily lives, significantly transforming how we communicate, access information, and engage with our environments.
The growth and dissemination of wireless communication standards have facilitated smooth connectivity and data transfer between a wide range of devices, resulting in enhanced efficiency, convenience, and innovation across all aspects of life.
In this section, we will explore the significance of wireless technologies across different domains, including personal communication, entertainment, business, and healthcare.
Personal Communication
The emergence of wireless technologies has revolutionized personal communication, making it more effortless than ever to remain in touch with loved ones, regardless of geographical boundaries.
Mobile phones, instant messaging, and social media platforms supported by cellular networks and Wi-Fi have become vital tools for instantaneous communication and sharing of information.
Furthermore, wearable devices and smartwatches powered by Bluetooth LE, for example, allow users to receive notifications and interact with applications directly, providing even greater convenience and ease of use.
Entertainment
The entertainment industry has experienced a significant transformation due to wireless technologies, enabling new and innovative ways for consumers to access and enjoy content.
Wi-Fi and cellular networks have given rise to streaming services that deliver high- quality audio, video, and streaming content directly to our devices, removing the need for physical media.
Additionally, wireless technologies such as Bluetooth and NFC have led to the development of portable speakers, headphones, and gaming accessories that offer enhanced functionality and convenience without the limitations of wires.
Business and Productivity
In the realm of business, wireless technologies have revolutionized operations, enhancing efficiency and streamlining communication. Wi-Fi networks, cloud services, and Bluetooth LE applications enable professionals to access resources, collaborate on projects, and communicate seamlessly from any location.
The Internet of Things (IoT), with technologies like Bluetooth LE and Zigbee, has created intelligent workspaces that optimize energy usage, lighting, and security, significantly reducing costs and improving work conditions.
The COVID-19 pandemic highlighted the criticality of these technologies, accelerating their adoption as businesses transitioned to remote work. However, their value extends beyond this crisis. As we move forward, wireless technologies continue to foster global collaboration, facilitate flexible work arrangements, and drive business productivity, underscoring their central role in the modern business ecosystem.
Healthcare
Wireless technologies have contributed significantly to advancements in healthcare, enabling remote patient monitoring, telemedicine, and real-time data collection. Wearable devices and wireless sensors, using technologies like Bluetooth LE, can track vital signs and health parameters, assisting medical professionals and caregivers in monitoring patients’ well-being and providing timely interventions.
Telemedicine, supported by cellular networks and Wi-Fi, allows patients to consult healthcare professionals remotely, reducing the need for in-person appointments, alleviating the burden on healthcare facilities, and providing never-before-available healthcare access to remote, underserved areas.
Transportation
Wireless technologies have played a vital role in shaping modern transportation systems. Cellular networks and GPS technology enable real-time navigation, traffic updates, and fleet management, enhancing efficiency and reducing congestion.
Moreover, connected vehicles and autonomous driving systems rely heavily on wireless communication between vehicles, infrastructure, and other devices to facilitate safe and effective transportation.
To sum up, wireless technologies have had a profound impact on various aspects of contemporary society, offering unmatched convenience, efficiency, and new opportunities in communication, entertainment, business, healthcare, and transportation.
As wireless technologies continue to progress and evolve, we can anticipate even greater innovation and integration into our daily routines, further enriching our ability to connect and interact with the world around us.
Network Topologies
Wireless network topologies define how devices (called nodes
) are set up and how they connect to each other in a wireless network. When building or assembling a communication system, it’s important to understand the different wireless network topologies.
Each structure has pros and cons that need to be carefully weighed against the specific application’s requirements. In this section, we’ll discuss the differences between the most common types of wireless network topologies.
Ad Hoc Topology
Figure 1.1: Ad Hoc NetworkFigure 1.1: Ad Hoc Network
In an ad hoc topology, wireless devices talk to each other directly and don’t use a central system like access points or servers. Ad hoc networks are simple, flexible, and easy to set up. This makes them perfect for physical environments that change quickly or are temporary.
One of the main downsides of an ad hoc topology is that it isn’t always easy to manage when adding additional nodes. Furthermore, the lack of unified control can make managing security challenging.
Star Topology
Figure 1.2: Star TopologyFigure 1.2: Star Topology
In a star topology, you have one central node, which is usually a wireless access point or router. This central node allows all other nodes in the network to communicate with each other, but only via the central node. During communication, a node will send communication to the central node, which then sends it to the target node. Compared to ad hoc topologies, star topologies are more reliable because the failure of a single node or link does not affect the rest of the network. But, the central node is a single point of failure, and the performance of the network is limited by the capacity of the central node.
Mesh Topology
Figure 1.3: Mesh TopologyFigure 1.3: Mesh Topology
In a mesh topology, all nodes are linked to each other so that data can be sent more than one way. Mesh topologies can be a full mesh, where every node is linked to every other node, or partial mesh, where only some nodes are connected.
Wireless mesh networks have high levels of resilience and fault tolerance. They can also self-heal and reroute data if a node fails. But, the downsides are that they can be hard to set up and difficult to control, and the more traffic that is on the network, the longer the delay of sending/receiving messages.
Tree Topology
Figure 1.4: Tree TopologyFigure 1.4: Tree Topology
A tree topology has a hierarchical structure with a center root node, such as a wireless access point or router that is linked to multiple levels of nodes. Tree topologies are perfect for managing big networks with many subnets because they are scalable and can be managed from one place. However, the tiered structure can cause more delay, and the root node is a single point of failure.
In conclusion, each wireless network design has its own advantages and disadvantages that depend on things like scalability, dependability, complexity, and cost. When designing a wireless communication system, it’s important to think about these aspects and choose the structure that best fits the application’s needs.
Communication Protocols
Devices that can communicate in a wireless network are called communication entities. Communication entities communicate in accordance with a communication protocol.
The communication between any two devices can take place only if they are compatible in their connectivity, in terms of both hardware and software. This compatibility is achieved through the use of a protocol.
Communication protocols are, in short, a set of rules that communication entities must follow in order to exchange information. Protocols are simply agreed-upon ways to ensure that two or more communication entities connected together can recognize and talk to each other.
Come to think of it, protocols used in any network technology, including Bluetooth Low Energy, are a lot like traffic protocols we all observe in our daily lives.
For example, when driving a car toward a busy intersection, we know what to do by observing the protocol displayed by the traffic light. If the light is green, we go. And if it’s red, we stop.
In rare instances when we encounter an intersection with no traffic lights or signs, there is general confusion among drivers about which car should go next because there is no protocol or general consensus to follow. Any driver might just go, and then another driver might think they have the right of way and go, possibly leading to a collision.
Without generally accepted protocols, a network would not work properly because hardware manufacturers and software developers would all be doing things their own way.
This would result in proprietary products being unable to communicate with each other.
Bluetooth Low Energy defines specific protocols (sets of rules) for devices to follow in order to communicate with each other. So, what are those rules? That’s what we are going to learn about in the upcoming chapters of this book.
Central to protocols is the concept of layers. Protocol layers were conceived to divide the duties of a protocol into manageable chunks. By the end of this section, you should have a better understanding of what a protocol stack is and the design methodology behind it.
Layered Architecture
The layered architecture pattern, often known as the n-tier
architecture design, is a common technique for reducing complexity across numerous disciplines.
A structure is divided