Bootladder Engineering

BLE (Bluetooth LE) Testing
I have worked on several electronic products that communicate over Bluetooth Low Energy (BLE). This post discusses some of the techniques and patterns that I have used for testing, development, and factory production.
**Quick background**: BLE is a large stack with many layers. While the layers do follow the conventional OSI stack architecture, there's a lot going on. It can be intimidating for people coming in with a background in TCP/IP, especially concerning profiles, services, and characteristics. It becomes confusing when considering the operating system and app toolkit levels. For instance, the Bluetooth Mice and Keyboard setup is a complex hack. Using standard profiles, like Hid or sensor profiles, can be perplexing.
However, when developing a custom IoT product, it simplifies. You're crafting both the mobile app side and the device side. You can essentially overlook profiles and services. Think of the entire interface as a set of characteristics, and a service as a collection of these characteristics. In my experience, there often isn't a need to maintain a distinct structure of services.
**BLE Hero, LightBlue**: These Android and iOS tools are invaluable for developing BLE products, primarily because they function as expected. Such tools are essential when you possess a BLE device that's malfunctioning or not yet existent.
Achieving a pairing and connection can be challenging with BLE's vast stack. These mobile testing apps prove invaluable here. They're adept at scanning and identifying BLE devices, checking properties like RSSI. If a testing app can connect and pair with your custom device, it's a sign your device is functioning correctly.
The next step is setting up your characteristics and services. This is when you delve into asynchronous control flow and data flow architecture. Using the testing app, you can discern services and characteristics. This becomes a significant milestone, particularly with less popular platforms.
As you progress, the utility of mobile testing tools wanes. Your testing demands will outgrow manual interactions on a mobile device. Automation is the keyword here. Although your organization's mobile app team might design a test app or mode, its functionality might be limited for expansive testing.
**Testing Solution**: You'll need a solution as you scale, especially in production. If you're manufacturing thousands of BLE products, BLE communication at the production site is inevitable. Sending multiple devices for testing abroad isn't feasible.
What worked for me is choosing a BLE-capable USB dongle and a cross-platform Python library for BLE communication. Ensuring uniformity in dongles is easier than in host machines. BLE USB dongles, once selected, are reliable. Python is ideal