Book Image

IoT Projects with Bluetooth Low Energy

By : Madhur Bhargava
Book Image

IoT Projects with Bluetooth Low Energy

By: Madhur Bhargava

Overview of this book

Bluetooth Low Energy, or Bluetooth Smart, is Wireless Personal Area networking aimed at smart devices and IoT applications. BLE has been increasingly adopted by application developers and IoT enthusiasts to establish connections between smart devices. This book initially covers all the required aspects of BLE, before you start working on IoT projects. In the initial stages of the book, you will learn about the basic aspects of Bluetooth Low Energy—such as discovering devices, services, and characteristics—that will be helpful for advanced-level projects. This book will guide you through building hands-on projects using BLE and IoT. These projects include tracking health data, using a mobile App, and making this data available for health practitioners; Indoor navigation; creating beacons using the Raspberry Pi; and warehouse weather Monitoring. This book also covers aspects of Bluetooth 5 (the latest release) and its effect on each of these projects. By the end of this book, you will have hands-on experience of using Bluetooth Low Energy to integrate with smart devices and IoT projects.
Table of Contents (15 chapters)
Title Page
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Bluetooth Low Energy versus Bluetooth Classic


Although Bluetooth Classic and Bluetooth Low Energy share many important things such as architecture, and both operate in 2.4 GHz ISM Band, the fundamental difference between them is that BLE is designed to consume less power. Due to this caveat, BLE is not an ideal candidate for applications such as streaming voice data (talking over the phone); however it makes BLE an excellent choice when it comes to communicating via exchanging small amounts of data over short periods of time. We shall discuss the communication differences between Bluetooth Classic and Bluetooth Low Energy in detail below.

Under Bluetooth Classic, when two or more devices want to talk to each other, then they always need to pair first (although pairing does happen when two devices communicate over Bluetooth Low Energy too, however; it is not mandatory in the case of BLE). Once the pairing has succeeded, an ad hoc network is established also known as the piconet:

Figure 3: A master-slave piconet; source: https://goo.gl/O9tgEB

A piconet can consist of a single master and up to seven slave devices. The devices can switch role by agreement (a slave can become a master at a later stage during the timeline of communication). Although a master can have up to seven slaves, at any point in time the master is addressing a single slave and the slave is supposed to listen when this happens. Also, it is important to note that being a slave to more than one master is certainly possible. This often results in interconnected piconets, also known as a scatternet:

Figure 4: A scatternet; source: https://goo.gl/WXixBp

Whether it is piconet or scatternet, the communication channel between the master and slave remains established even if no data is being exchanged and is only terminated when one (or both) of the parties (master/slave) explicitly decides to terminate the connection.

On the other hand, communication over Bluetooth Low Energy can be abstracted away as interacting with a really intelligent database. During this type of communication, each of the devices involved either plays the role of the database (known as peripheral in Bluetooth Low Energy terminology) or a listener (known as central in Bluetooth Low Energy terminology) of that database updates. Whenever new data is available, the database magically notifies all its listeners that new data is available to use. This magic takes place via something known as Indications and Notifications which we shall elaborate on in an upcoming section:

Figure 5: Bluetooth Low Energy communication; source: learn.adafruit.com

Before moving on to rest of the differences between Bluetooth Low Energy and Bluetooth Classic (also known as Bluetooth BR/EDR), let's first discuss a few terms, the understanding of which is absolutely critical for the discussion ahead:

  • ISM channels/radio bands: ISM bands are the portions of the electromagnetic frequency spectrum, which are reserved for industrial, scientific, and medical purposes only. For example, the 2.4GHz ISM band is available worldwide and spans 2400MHz to 2483.5MHz. This means a device operating in this band can be legally used anywhere in the world (provided it is certified).
  • Data rate: This is the theoretical rate of data flow, which can be achieved in a system.
  • Application throughput: This is the practical rate of data flow, which can be achieved in a system.

Both Bluetooth Classic (BR/EDR) and Bluetooth Low Energy operate in the 2400-2483.5 MHz range within the ISM 2.4 GHz frequency band. However, data exchange in Bluetooth Classic happens over one of the 79 designated channels, as opposed to that of Bluetooth Low Energy where the number of designated channels is 40:

Figure 6: RF spectrum for Bluetooth and BLE

The core technical specifications of Bluetooth Classic and Bluetooth Low Energy are tabulated as follows:

Technical specifications

Bluetooth Low Energy

Bluetooth Classic

Power consumption

Rated power Consumption of 0.01 to 0.5 W

 

Rated power consumption of 1 W

 

Data rate and throughput

Physical data rate is 1 MBit/s with an effective application data throughput of 0.3 MBit/s

 

Physical data rate is 1-3 MBit/s with an effective application data throughput of 2.1 MBit/s

 

Latency (from a non-connected state)

 

6 ms

100 ms

Voice capable

 

No

Yes

Distance/range (theoretical max.)

 

>100 m

100 m

Pairing mandatory

No

Yes

Frequency (GHz)

2.4

2.4

Active slaves

 

Up to 7

Undefined and implementation dependent

Security

128-bit AES and application layer user defined

 

56/128-bit and application layer user defined

 

Network topology

Point-to-point and Star

Piconet, scatternet, and point-to-point

Frequency channels

40

79

Minimum total time to send data (det. battery life)

 

3 ms

100 ms

Current consumption

<15 mA

<30 mA

Logo