Book Image

Building Bluetooth Low Energy Systems

By : Muhammad Usama bin Aftab
Book Image

Building Bluetooth Low Energy Systems

By: Muhammad Usama bin Aftab

Overview of this book

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.
Table of Contents (14 chapters)
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Preface

Classic Bluetooth became a revolutionary technology when it replaced line-of-sight infrared communication. It was almost unbelievable to imagine that you could walk in close proximity and still transfer files from one cell phone to another. Classic Bluetooth broke the conventions and penetrated deep into the consumer electronics market.

When it comes to technology, weaknesses and mistakes are not easily tolerated. The Bluetooth SIG understands this, which is why they rethought the very foundation of classic Bluetooth. With the launch of Bluetooth Low Energy, they stamped their claim over not just small-distance communication, but also considerably long-distance communication using meshes. Providing the low-power, low-cost, and high-distance communication of Bluetooth 5 will surely benefit BLE in the Internet of Things.

Building Bluetooth Low Energy Systems is a book that understands the importance of this technology. It discusses the background of Bluetooth Low Energy and how it is being used in different IoT products. This book provides a practical understanding of the fundamentals of communication: the client/server architecture of Bluetooth. It does not stop there--it moves forward to explain Bluetooth beacons with indoor navigation, Bluetooth CSRMesh, and Bluetooth-Internet gateways. All these compelling implementations of BLE are not just explained but put into code using different APIs. With these examples, the book will bring a deeper understanding of Bluetooth Low Energy systems as they exist today.

Changing technology brings motivation to learners and gives them encouragement to apply it in their daily lives. This book will provide you with necessary tools to learn and apply this technology. It will give you enough knowledge about Bluetooth Low Energy that you will move many steps ahead in developing stuff. It is highly encouraged that you learn from the book and build advance Bluetooth Low Energy systems.

With the launch of Bluetooth 5, the SIG made known their intentions of making this technology a front-line player in the Internet of Things. We already have Bluetooth sitting in our pockets; it is just a matter of time that everything around is connected to us through it. This is why it is worthwhile to spend time learning this fast-growing and continuously expanding technology.

What this book covers

Chapter 1, BLE and the Internet of Things, is a review of the basics for those familiar with BLE. If you are new to BLE, then this chapter will get you up to speed for future chapters. This chapter will speak about the emerging domain of this decade with many real-life examples where we’ve been using Internet of Things (IoT) services without knowing it. It will also provide examples of wearables, autonomous vehicle, and sports gear to make you understand the potential of IoT in the coming years.Chapter 2, BLE Hardware, Software, and Debugging Tools, gives an overview of the BLE devices available in the market. It will provide a comparison and detailed description of the different hardware with their corresponding SDKs. It will also explain the working of some applications available for Android/iOS and for desktop computers.Chapter 3, Building a BLE Central and Peripheral Communication System, provides examples to understand communication in BLE using central and peripherals. Step-by-step explanations of the examples will help you understand the working of BLE. Java will be used to illustrate Android code.Chapter 4, Bluetooth Low Energy Beacons, gives an introduction to Bluetooth beacon technology. Classification of BLE beacons and their role in the IoT will be explained with examples. This chapter will also contain the two types of beacons currently available, EddyStone and iBeacon. It will also provide example applications using Eddystone and iBeacons on Estimote Beacons and Tags.Chapter 5, BLE Indoor Navigation Using Estimote Beacons, focuses on an important aspect of BLE beacons: using them as an indoor navigation system.Chapter 6, Bluetooth Mesh Technology, teaches you about the mesh technology introduced by CSRMesh. This chapter will focus on the key aspects of mesh technology, such as flooding, routing, and security considerations. The chapter will also help you build a CSRMesh control application using Android.Chapter 7, Implementing a Bluetooth Gateway Using the Raspberry Pi 3, talks about the importance of gateway technology to connect Bluetooth-enabled devices to the internet. It will also demonstrate an example application to create a gateway that will act as a bridge between BLE-enabled devices and the Internet using the Raspberry Pi 3. Chapter 8, The Future of Bluetooth Low Energy, talks about the future of the Internet of Things. It will discuss the new version of BLE (version 5.0). It will also talk about the potential applications of IoT in the future, with smart cities and machine-to-machine communication. The future of IoT in industrial development will also be discussed in this chapter.

What you need for this book

In order to keep up with the book, you will need to spend some time learning basic coding. In addition to RESTful APIs, this book refers to three major programming languages:

  • Java 8 for Android
  • SWIFT 3 for iOS
  • Node.js

Additionally, you will need following software tools:

  • Android Studio 2.3
  • XCode 8
  • The nRF Connect Android/iOS app.
  • Estimote apps and SDK for Android and iOS
  • CSR uEnergy tools
  • CSRMesh Library for Android
  • NOOBS version 2.4.0
  • Bluetooth Developer Studio

From a hardware standpoint, this book will require you to work with:

  • CSRMesh Development Kit
  • Raspberry Pi 3 with Bluetooth Low Energy.
  • iPhone with BLE to implement iOS applications
  • Android phone with BLE to implement Android applications
  • Estimote Location Beacons

This book also refers to the Estimote Beacon Management dashboard in the cloud to manage your beacons.

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.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The next lines of code read the link and assign it to the to the BeautifulSoup function."

A block of code is set as follows:

<uses-permission android:name="android.permission.BLUETOOTH" /> 
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold: [default]<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Select the menu bar on the left and select Configure GATT Server."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book 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 files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.

 

  1. Choose from the drop-down menu where you purchased this book from.
  2. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Building-Bluetooth-Low-Energy-Systems. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/BuildingBluetoothLowEnergySystems_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.