Reader small image

You're reading from  IoT Projects with Bluetooth Low Energy

Product typeBook
Published inAug 2017
PublisherPackt
ISBN-139781788399449
Edition1st Edition
Right arrow
Author (1)
Madhur Bhargava
Madhur Bhargava
author image
Madhur Bhargava

Madhur Bhargava is specialized in Wireless and Mobile Computing from CDAC ACTS Pune, India. He started his career at Electronic Arts as a software engineer working on mobile games. He later addressed problems in personalized healthcare, leveraging the power of mobile and voice computing. He is proficient in various mobile/embedded technologies and strives to be a software generalist. He believes that good software is a result of talented individuals working together as a communicative team in an Agile manner. He likes to spend time with his family, read, and watch movies.
Read more about Madhur Bhargava

Right arrow

Chapter 4. Designing a Personal Tracking System

The usefulness of the cup is in its emptiness 

- Bruce Lee

We have already covered the practical aspects of arranging data in profiles, services, and characteristics as part of Bluetooth Low Energy implementation in the peripheral devices in the Chapter 3, Building a Service Explorer App.

In this chapter, we take a break from these discussions and focus on another very interesting and lesser known aspect/parameter related to Bluetooth Low Energy, namely, Received Signal Strength Indication (RSSI), which we will eventually use to detect the proximity/distance (yes, you read that right) to a Bluetooth Low Energy device.

Note that there are BLE devices already available, which support Find Me and Proximity BLE Profiles which can be used to accomplish this task in a very simple and similar manner (Scan|Detect and subscribe to notifications from the relevant characteristics) as we subscribed to heart rate notifications in the Chapter 3, Building a Service...

RSSI and Proximity


In simplest terms, RSSI is the measure of strength of a radio signal in a wireless environment. It is the measured in decibel milliwatts (dbm).

As a rule of thumb, the higher the RSSI, the stronger the signal. RSSI tells us whether the signal is getting stronger or weaker and we can use this fact to our advantage by approximating the proximity of the broadcasting Bluetooth Low Energy device.

Since you now understand what RSSI is, then, not going into too much detail, we can safely say that, if given a list of RSSI values, then just by looking at these values we can already guess whether the broadcasting BLE device is nearby or far away. We will elaborate on this fact through the following RSSI values:

Figure 1: Typical RSSI values

Can you already guess what do these RSSI values mean?

Note

Don't worry if you do not understand how these RSSI values were generated; we will be covering that in detail when we design the tracking app.

Well, first things first: if you haven't already...

Indoor Proximity and Localization with an iTag


With the advent of Bluetooth Low Energy, a technology which is rapidly maturing, it has already started to find its way into a variety of premises.

iTags are small Bluetooth Low Energy sensors, which can be planted on things or individuals (especially toddlers) to track whether the iTag is nearby or far away:

Figure 4: iTag; source: www.amazon.com

You can buy an iTag for a few Euros online or at a nearby electronics shop.

The Bluetooth implementation of an iTag usually consists of a Link Loss and Immediate Alert Service.

Apart from many other functionalities, the Immediate Alert and Link Loss services are used for providing alerts when the device link is lost.

Note

To read more about the Link Loss Service in detail, visit https://www.bluetooth.com/specifications/gatt/viewer...

Designing the Tracking App


As already indicated, in this section, we will be designing an app for both Android and iOS platforms, which listens for RSSI updates from a broadcasting iTag sensor and uses these values to predict the distance of the iTag from the receiver.

Our development pre-requisites and setup remain exactly similar to those defined in Chapter 3, Building a Service Explorer App.

Android

We begin by creating an empty project in the Android Studio. We have chosen the name AndroidiTagPersonalTracker; feel free to be creative with your project's name. We have already done this exercise in Chapter 2, Setting Up; hence, we will not be covering that here again.

Note

When you are creating any Android-based Bluetooth Low Energy Project, remember to select the minimum API Level as 21 during the setup, since many Bluetooth Low Energy related system API calls require minimum API level 21.

Once we have finished creating our empty project, as a first step, we can define some simple user interface...

Summary


In this chapter we took the road less traveled, and by using an iTag in a nontraditional manner, we ended up building a Bluetooth Low Energy based proximity solution. Apart from the overall technical implementation, another important detail worth mentioning is the fact that we executed our code of the Android App on a Samsung Galaxy S8 device (alongside with LG Nexus 5), which is a very special device in today's market due to the fact that it is the only device that supports BLE 5 available at the time of writing. We recommend that you do run the examples presented in this book on a device that supports BLE 5, since this will help you gauge the important practical differences between the older and relatively newer BLE versions. Also, we request that you follow up both the Android and iOS examples with the homework exercises outlined in the individual sections. This will not only strengthen your overall solid grounding in Bluetooth Low Energy, but will also help with a better understanding...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
IoT Projects with Bluetooth Low Energy
Published in: Aug 2017Publisher: PacktISBN-13: 9781788399449
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Madhur Bhargava

Madhur Bhargava is specialized in Wireless and Mobile Computing from CDAC ACTS Pune, India. He started his career at Electronic Arts as a software engineer working on mobile games. He later addressed problems in personalized healthcare, leveraging the power of mobile and voice computing. He is proficient in various mobile/embedded technologies and strives to be a software generalist. He believes that good software is a result of talented individuals working together as a communicative team in an Agile manner. He likes to spend time with his family, read, and watch movies.
Read more about Madhur Bhargava