Develop your own Bluetooth Low Energy Applications for Raspberry Pi, ESP32 and nRF52 with Python, Arduino and Zephyr
This repository contains the code discussed in the book Develop your own Bluetooth Low Energy Applications for Raspberry Pi, ESP32 and nRF52 with Python, Arduino and Zephyr, published by Elektor International Media, as well as a list of errors and their corrections and some additional tips and references.
Bluetooth Low Energy (BLE) radio chips are ubiquitous from Raspberry Pi to lightbulbs. BLE is an elaborate technology with a comprehensive specification, but the basics are quite accessible.
A progressive and systematic approach will lead you far in mastering this wireless communication technique, which is essential for working in low power scenarios.
In this book, you’ll learn how to:
- discover BLE devices in the neighborhood by listening to their advertisements
- create your own BLE devices advertising data
- connect to BLE devices such as heart rate monitors and proximity reporters
- create secure connections to BLE devices with encryption and authentication
- understand BLE service and profile specifications and implement them
- reverse engineer a BLE device with a proprietary implementation and control it with your own software
- make your BLE devices use as little power as possible
This book shows you the ropes of BLE programming with Python and the Bleak library on a Raspberry Pi or PC, with C++ and NimBLE-Arduino on Espressif's ESP32 development boards, and with C on one of the development boards supported by the Zephyr real-time operating system, such as Nordic Semiconductor's nRF52 boards.
Starting with a very little amount of theory, you'll develop code right from the beginning. After you've completed this book, you'll know enough to create your own BLE applications.
All example code from this book is included in this repository, stored in a directory for each chapter. For each chapter directory, the example code is subdivided into subdirectorues for NimBLE-Arduino code, Python/Bleak code, and C/Zephyr code.
You can download the code all at once with Git:
git clone https://github.com/koenvervloesem/bluetooth-low-energy-applications.git
The code is then downloaded into the directory bluetooth-low-energy-applications
.
You can also download a ZIP file of all code by clicking on the green button Code at the top right of this page and then on Download ZIP.
Just selecting and copying code from the GitHub web page of a specific file you're interested in and pasting it in an editor may work, but is not recommended. Especially with Python code the whitespace can become mixed up, which results in invalid code.
See the ERRATA document for the list of errors in the book and their corrections.
See the ADDITIONS document for some additional tips and references to interesting projects not mentioned in the book.
All code is provided by Koen Vervloesem as open source software with the MIT license, unless noted otherwise in the license header of a file. See the LICENSE for more information.