O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building Bluetooth Low Energy Systems

Book Description

Discover and implement a system of your choice using Bluetooth Low Energy.

About This Book

  • Learn the basics of Bluetooth Low Energy with its exciting new protocol stack and security.
  • Build customized Bluetooth Low Energy projects that make your web or mobile apps smarter in terms of networking and communications.
  • Using Android, iOS, and the Web, acquire key skills to harness the power of Bluetooth Low Energy in your IoT applications.

Who This Book Is For

The book is for developers and enthusiasts who are passionate about learning Bluetooth Low Energy technologies and want to add new features and services to their new or existing products. They should be familiar with programming languages such as Swift, Java, and JavaScript. Knowledge of debugging skills would be an advantage.

What You Will Learn

  • Bluetooth Low Energy in theory.
  • Bluetooth Low Energy Hardware and Software Development Kits.
  • Implement Bluetooth low energy communication (central and peripheral) using Android.
  • Master BLE Beacons with examples implemented over Eddystone and iBeacons.
  • Implement indoor navigation using Estimote Beacons on iOS.
  • Implement Internet gateways to control BLE devices on a Wi-Fi network.
  • Understand BLE security mechanisms with a special focus on Bluetooth pairing, bonding, and key exchange to cover encryption, privacy, and user data integrity.
  • Implement Bluetooth Mesh using CSRMesh Technology.

In Detail

Bluetooth Low Energy (BLE) is a Wireless Personal Area network technology aimed at novel applications for smart devices. High-tech BLE profiles and services are being increasingly used by application developers and hardware enthusiasts to allow devices to interact with the surrounding world.

This book will focus on a technical introduction to BLE and how it is reshaping small-distance communication. We will start with IoT, where many technologies such as BLE, Zigbee, and IEEE 802.15.4 Mesh will be introduced. The book will present BLE from an engineering perspective, from which the protocol stack, architecture, and layers are discussed. You will learn to implement customized projects for Peripheral/Central communication, BLE Beacons, indoor navigation using triangulation, and the Internet gateway for Bluetooth Low Energy Personal Network, all using various code samples and APIs on Android, iOS, and the Web. Finally, the book will conclude with a glimpse into future technologies destined to be prominent in years to come.

Style and approach

The book is a practical tutorial that will help you understand the background and technicalities of BLE and offers a friendly environment to build and create robust BLE projects. This hands-on approach will give you a clear vision of Bluetooth Low Energy and how it can be used in IoT.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. BLE and the Internet of Things
    1. Internet of Things
      1. Modern day IoT
      2. Real life examples of the Internet of Things
        1. Wearables
        2. The fitness tracker
        3. Smart home devices
          1. Amazon Echo
          2. Wireless bulbs
          3. Smart refrigerators
        4. Television and online media
          1. Google Chromecast
          2. Apple TV
        5. Automotive industry
    2. Technologies in the Internet of Things
      1. Wireless Local Area Network (WLAN)
      2. Wireless Ad-hoc Networks
      3. ZigBee
    3. Bluetooth Low Energy
      1. Bluetooth versions
      2. Bluetooth Low Energy Key Concepts
        1. Attribute Protocol (ATT) and Generic Attribute Profile (GATT)
        2. GATT Server and GATT Client
        3. Universally Unique Identifiers (UUIDs)
        4. GATT-based Bluetooth Profile Hierarchy
          1. Service
          2. Characteristic
        5. Generic Access Profile (GAP)
          1. Broadcaster
          2. Observer
          3. Central
          4. Peripheral
      3. Bluetooth Low Energy Security
        1. Key Generation
        2. Association Models in Pairing
          1. Numeric Comparison
          2. Just Works
          3. Out of Band (OOB)
          4. Passkey Entry
        3. Signing the Data
        4. Privacy
    4. Bluetooth Low Energy for the Internet of Things
      1. Applications of BLE in IoT
      2. Bluetooth Low Energy Beacons
        1. Bluetooth Low Energy Beacon use-case
        2. Communication model of BLE Beacons
      3. Bluetooth mesh networks
    5. Summary
  3. BLE Hardware, Software, and Debugging Tools
    1. Bluetooth Low Energy hardware
      1. Development kits
        1. Nordic semiconductor nRF51 development kit
          1. S110 SoftDevice
          2. S120 SoftDevice
          3. S130 SoftDevice
        2. Adafruit Bluefruit LE on nRF8001 Bluetooth Low Energy IC
        3. Coin Arduino BLE hardware
    2. Bluetooth Low Energy software
      1. Bluetooth Developer Studio by Special Interest Group
      2. Nordic Semiconductor tools
        1. nRF Connect for Mobile (Android and iOS)
        2. nRF UART (Android and iOS)
        3. nRF Logger (Android)
        4. nRF Beacon for Eddystone (Android and iOS)
        5. nRF BLE Joiner (Android)
        6. Google Beacon tools (Android)
        7. Physical web (Android)
    3. Summary
  4. Building a BLE Central and Peripheral Communication System
    1. Bluetooth Low Energy central and peripheral
      1. Examples of Bluetooth central peripheral communication
        1. Smartphone – smartwatch communication
        2. Smartphone – smart LED strip communication
    2. Android Bluetooth Low Energy
      1. An introduction to Android
      2. Bluetooth Low Energy in API level 24
        1. Bluetooth Low Energy permissions
        2. Bluetooth Low Energy interfaces
          1. BluetoothAdapter.LeScanCallback
          2. BluetoothProfile.ServiceListener
        3. Bluetooth Low Energy classes
          1. BluetoothAdapter
          2. BluetoothGatt
          3. BluetoothGattCallback
          4. BluetoothGattService
          5. BluetoothGattCharacteristic
      3. Building an Android app to list Bluetooth devices in the proximity
        1. Conventions
        2. Permissions in AndroidManifest.xml
      4. Runtime permissions
        1. Bluetooth scanning process
        2. Custom list adapter and ListView
      5. Android app - heart rate monitor application
        1. Deploying the GATT server using Nordic Connect
        2. Writing central-side Android apps
        3. Writing data on the characteristic
    3. Bluetooth Over-The-Air device firmware update
      1. Adding Android DFU library using Gradle
        1. DFUService
        2. FirmwareUpdateActivity
    4. Summary
  5. Bluetooth Low Energy Beacons
    1. Introduction to Bluetooth Low Energy Beacons
      1. Applications of Bluetooth Low Energy Beacons
        1. Beginner applications
        2. Advanced applications
    2. Beacon protocols
      1. Google Eddystone
        1. Eddystone-UID
        2. Eddystone-EID
        3. Eddystone-URL
      2. Apple iBeacon
    3. Estimote beacons
      1. Estimote SDK for Android
        1. Getting started
        2. Background monitoring and ranging
      2. Estimote SDK for iOS
      3. Physical web using Estimote
      4. Estimote cloud interface
    4. Summary
  6. BLE Indoor Navigation Using Estimote Beacons
    1. Introducing indoor navigation
    2. Estimote Location Beacons and triangulation
      1. Estimote Location Beacons
      2. Triangulation for indoor navigation
    3. Indoor location using the Estimote Location Beacons
      1. Setting up an indoor location using the iOS app
      2. Estimote Location SDK on Swift
        1. EILIndoorLocationManager
        2. EILLocation
        3. EILLocationBuilder
        4. EILOrientedPoint
        5. EILPositionedBeacon
        6. EILRequestAddLocation
        7. EILRequestFetchLocation
        8. EILRequestModifyLocation and EILRequestRemoveLocation
    4. Implementing indoor navigation using the Estimote Location SDK on Swift
    5. Summary
  7. Bluetooth Mesh Technology
    1. Introduction to mesh networking
      1. Advantages of mesh networking
    2. Mesh networking in wireless technologies
      1. Wireless mesh networks
      2. Mesh networking in ZigBee
      3. Mesh networking in Bluetooth Low Energy
      4. Security complications in BLE mesh
    3. CSRMesh
      1. Setting up the CSRMesh development kit
      2. The Android CSRMesh control application
        1. Step 1 - connect  to the network
        2. Step 2 - set up a mesh network
        3. Step 3 - associate new devices with your network
        4. Step 4 -  authorize connected devices
        5. Additional step - controlling light and thermostat
        6. Additional step - configuring your devices
        7. Additional step - grouping your devices
      3. CSRMesh library for Android
        1. Getting started with the CSRMesh Android library
        2. Using MeshService
        3. Mesh handler
        4. Mesh controlling using Model classes
    4. Summary
  8. Implementing a Bluetooth Gateway Using the Raspberry Pi 3
    1. Introducing the Raspberry Pi
      1. Raspberry Pi 3 Model B
      2.  Applications of the Raspberry Pi in the Internet of Things
        1. Media center using Raspberry Pi
        2. Cloud storage using Raspberry Pi
        3. Tracker using Raspberry Pi
        4. Web server using Raspberry Pi
        5. Gateway for Bluetooth devices using Raspberry Pi
    2. Set up your Raspberry Pi with Raspbian
    3. Deploying a Bluetooth gateway on your Raspberry Pi
      1. Step 1 - Update and upgrade the Pi
      2. Step 2 - Installing Bluetooth and Node.js
      3. Step 3 - Getting the project folder 
      4. Step 4 - Running the web server
    4. Implementing a Bluetooth gateway on the Raspberry Pi
      1. Bluetooth SIG GATT server API
        1. RESTful services offered by the RESTful smart server API
      2. Important libraries and their usage
      3. Important JavaScript in the gateway project
    5. Implementing the Bluetooth gateway explorer v2 
      1. Important libraries used in the web application
      2. Important JavaScript used in the web application
    6. Summary
  9. The Future of Bluetooth Low Energy
    1. The Internet of Things and the role of Bluetooth Low Energy
      1. History and its motion
      2. The future of technology and the Internet of Things
      3. Bluetooth Low Energy in the future of IoT
    2. Use of IoT in smart cities and the automobile industry
      1. Technical challenges
      2. Financial challenges
    3. Potential research in Bluetooth Low Energy
      1. Enhancing meshes in Bluetooth
      2. Enhancing security in Bluetooth
    4. Summary