Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
IoT Projects with Bluetooth Low Energy

You're reading from  IoT Projects with Bluetooth Low Energy

Product type Book
Published in Aug 2017
Publisher Packt
ISBN-13 9781788399449
Pages 278 pages
Edition 1st Edition
Languages
Author (1):
Madhur Bhargava Madhur Bhargava
Profile icon Madhur Bhargava

Chapter 2. Setting Up

In theory, there is no difference between theory and practice. In practice, there is.

- Anonymous

We established quite a theoretical foundation in the last chapter by covering the pillars on which Bluetooth Low Energy is designed upon. In this chapter, we will be setting up our development environment, which will help us to put all that theory into practice.

We will eventually set up our development environment by covering the following topics:

  • Introduction to Bluetooth Low Energy Sensors
  • Setting Up Your System to Write Android Applications
  • Setting Up Your System to Write iOS Applications
  • Configuring the Firebase Cloud Backend
  • Introduction to Raspberry Pi
  • Introduction to GitHub

Introduction to Bluetooth Low Energy Sensors


Almost every BLE device that you will be interacting with in the real world and during the course of this book, will be a sensor that senses and stores data, waiting to be read. For example, a Fitbit senses heart rate, quality of sleep, and the number of steps walked. We will be interacting with a Fitbit device in the next chapter to understand how it stores the sensed data and how it makes that data available to us:

Figure 1: A Fitbit charge 2 device; source: www.fitbit.com

Temperature and humidity sensors can also use Bluetooth Low Energy as their communication protocol to transfer data to handheld devices or hubs. We will be creating an IoT + BLE solution for one such use case involving temperature and humidity sensors in Chapter 6, Weather Monitoring Using BLE in Warehouses:

Figure 2: Temperature and humidity sensor by Xiaomi; source: www.Xiaomi.com

Bluetooth Low Energy sensors can also be used to sense the approximate location (mainly distance...

Setting Up Your System to Write Android Applications


For those who came late, here is a little bit of history on Android.

Android is a mobile operating system initially developed by Google. The initial release of Android happened on September 23, 2008. Alongside the release, Google also took the initiative to form the Open Handset Alliance (OHA), which is a group of 84 companies including Sony, Dell, Samsung Electronics, HTC, and Motorola to name a few. Note that Android was and is a platform, and the primary purpose of the OHA was to develop open standards for mobile devices and promote the Android platform.

Note

For more information about the Android operating system, visit https://www.android.com/.

Looking at the historical timeline of Android releases, you will realize that Android has really come a long way since 2008:

Figure 5: Android version history timeline; source: www.wikipedia.com

Note

Fun fact—All of the code names for Android flavors are in reference to sweets and the first letter...

Setting Up Your System to Write iOS Applications


Just like Android, iOS needs no formal introduction; however, we will go over some key knowledge factors related to it. iOS or iPhone OS is a mobile operating system which was developed by Apple Inc. and first introduced in June 2007 exclusively for Apple devices:

Figure 11: Devices supported by iOS; source: www.macworld.com

Note that one of the biggest differences between Android and iOS is that Apple designed iOS as an operating system, which was exclusively designed for Apple hardware. On the other hand, Android took more of a platform approach, which dictated a set of requirements and then the phone manufacturers could roll out devices adhering to these requirements. Also, this implies that iOS is closed source whereas Android is open source.

Just like Android, iOS also has a version history starting right from iPhone OS 1 and currently at the time of writing of this book, iOS 10 which was introduced in September 2016:

Figure 12: iOS Device...

Configuring the Firebase Cloud Backend


Firebase, in technical terms, is backend as a service. To clarify what this means, let's look at an example: Let's say you would like to write an app, which shows screening times for various movies playing in the city. For this, you will need to store the movie details and the show times in a backend, which can then later be fetched and displayed by various mobile clients. However, you don't want to get into writing a full-fledged server on your own and it would probably be best if you could lay your hands on a pre-cooked solution where you could just store and read your data when needed. This is where Firebase comes in. Firebase is a technology/service that helps developers who want to write apps, which interact with a backend but avoids them creating/programming their own full-fledged backend. This will become clearer as we set up Firebase to use with our Android client.

Note

Firebase can be used with Android, iOS, OS X, Web, and Unity clients.

Apart...

Introduction to Raspberry Pi


In this section, we will be introducing you to Raspberry Pi, which is a completely functional computer built on a single circuit board:

Figure 28: A Raspberry Pi, Model 3B; source: www.wikipedia.com

Equivalent to the size of a credit card, this single board computer offers the following:

  • 1GB RAM
  • 4 USB ports
  • 40 GPIO pins
  • A full HDMI port
  • An Ethernet port
  • Combined 3.5mm audio jack and composite video
  • A Camera interface (CSI)
  • A Display interface (DSI)
  • A micro SD card slot
  • A VideoCore IV 3D graphics core
  • A 1.2GHz 64-bit quad-core ARMv8 CPU
  • An 802.11n Wireless LAN
  • Bluetooth 4.1
  • Bluetooth Low Energy (BLE)

Figure 29: Raspberry Pi, Model 3b, layout details; source: www.smarthomesage.com

For less than 40 euros (which is the approximate cost of this board), for starters, you can simply connect a USB 2.0 mouse and keyboard to the USB ports, hook up a monitor via the HDMI port, and you already have the hardware setup of a personal computer:

Figure 30: Raspberry Pi, Model 3b, Specifications...

Introduction to GitHub


To understand GitHub, you should first know what a Git is.

To explain what it is in simple terms, we should first understand how the actual software is crafted. It is carried out by multiple engineers working together in a team, often on the same source code files. When the software is being crafted, it often happens that within the development cycle, requirements might get changed or some of the features of the software might not even be required at all by the time of final release.

Perhaps an actual dialog between a product owner and a technical team lead might help you understand this situation better:

Ben (Product Owner)Hey Jerry, remember that hourly alarms feature we added to our app, the management has decided to remove that from this release.

Jerry (Lead Developer)Sure. What I am going to do is disable that for now and then make a final release tomorrow after our testing cycle is complete.

BenSounds Good!

The next day, unfortunately, Jerry falls Sick and...

Summary


In this chapter, we've explored two of the most popular mobile operating systems, namely, Android and iOS, in a very hands-on manner by setting up development environments for both of them. We also went to our backend environment, Firebase, which allowed us to make the data from our Bluetooth Low Energy devices available to rest of the world. Not limiting ourselves to just software, we've learned about the Raspberry Pi, a very sophisticated piece of hardware, which we will later magically transform into a Bluetooth Low Energy beacon. Finally, we also learnt about GitHub, the world's largest host of source code, where we will be storing our code. We are all set up now and ready to take BLE knowledge to the next level.

Next up, to get an intuitive understanding of how Bluetooth Low Energy is implemented in wearables (for example, fitness trackers), with our recently gained knowledge about Sensors and Bluetooth Low Energy architecture, we will build an app that will help us look deep...

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 2017 Publisher: Packt ISBN-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.
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}