Quick Guide to Low Energy Bluetooth (BLE) Product Development

Recently, due to work requirements, I have been involved in a BLE project and have spent considerable time researching standards and principles to understand the underlying concepts. I have summarized many of the BLE products currently available in the market, practically validating the theory, and have gained quite a bit of insight. Today, I finally have some free time to summarize for myself. This also includes some basic information for newcomers (if you are experienced, you may skip the first 1-3 parts of this article and go straight to the case demonstration), leading everyone into the world of Bluetooth Low Energy (BLE) design. If there are any inaccuracies, I hope everyone will provide feedback and corrections.

01

Quick Guide to Low Energy Bluetooth (BLE) Product Development

What is BLE

To talk about BLE, we must first discuss Bluetooth. As we all know, Bluetooth is a short-range wireless communication technology managed by the Bluetooth Special Interest Group (SIG). From the evolution of Bluetooth, versions before 4.0 primarily pursued communication speed; starting from 3.0, it reached a high-speed Bluetooth rate of 24Mbps. From version 4.0 onward, the evolution mainly focuses on low power consumption, low cost, and other IoT characteristics. Therefore, we generally refer to Bluetooth before 3.0 as classic Bluetooth, while Bluetooth introduced after 4.0 is collectively referred to as Low Energy Bluetooth, or BLE.

Quick Guide to Low Energy Bluetooth (BLE) Product Development

02

Quick Guide to Low Energy Bluetooth (BLE) Product Development

Brief Overview of the BLE Protocol

Based on my learning experience, if you want to master a specific data communication protocol, the best method is to first identify its OSI model and then peel back layer by layer from the bottom (physical layer). In communication protocols, we refer to the implementation code as the protocol stack, so the BLE protocol stack is the code that implements Low Energy Bluetooth. Let’s first understand the overall structure of the BLE protocol stack.

Quick Guide to Low Energy Bluetooth (BLE) Product Development

As shown in the figure above, to implement a BLE product application, you first need a supporting BLE RF chip, then select a compatible BLE protocol stack, and finally develop your application based on the protocol stack. The BLE protocol stack is the key throughout the development process, used to encapsulate your application data layer by layer to generate data packets that conform to the BLE protocol. The BLE protocol stack is mainly composed of the following parts:

1) PHY Layer (Physical Layer). The PHY layer specifies the wireless frequency band, modulation and demodulation methods used by BLE. The quality of the PHY layer directly determines the power consumption, sensitivity, and selectivity of the entire BLE chip and other RF indicators.

2) LL Layer (Link Layer). The LL layer is the core of the entire BLE protocol stack and is also the difficulty and focus of the BLE protocol stack. For example, Nordic’s BLE protocol stack can support 20 links simultaneously, thanks to the LL layer. The LL layer has many responsibilities, such as selecting which RF channel to communicate on, how to identify airborne data packets, when to send data packets, how to ensure data integrity, how to receive ACKs, how to retransmit, and how to manage and control the link, etc. The LL layer is only responsible for sending or receiving data; how to parse the data is handed over to the upper layers, GAP or GATT.

3) HCI (Host Controller Interface). HCI is optional (for specifics, please refer to the article: Three Bluetooth Architecture Implementation Solutions (Bluetooth Protocol Stack Solutions)). HCI is mainly used in scenarios where two chips implement the BLE protocol stack, to standardize the communication protocol and commands between them.

4) GAP Layer (Generic Access Profile). GAP is one of the two ways to parse the LL layer payload (valid data packets), and it is the simplest one. GAP simply standardizes and defines the LL payload, so the functions that GAP can achieve are extremely limited. Currently, GAP is mainly used for broadcasting, scanning, and initiating connections.

5) L2CAP Layer (Logical Link Control and Adaptation Protocol). L2CAP provides a simple encapsulation of the LL; LL only cares about the data being transmitted, while L2CAP distinguishes between encrypted channels and ordinary channels, and also manages the connection intervals.

6) SMP (Secure Manager Protocol). SMP is used to manage the encryption and security of BLE connections, ensuring the security of connections while not affecting user experience; these are the tasks that SMP must consider.

7) ATT (Attribute Protocol). In simple terms, the ATT layer is used to define user commands and the data for command operations, such as reading or writing certain data. Among the BLE protocol stack, developers interact most frequently with ATT. BLE introduces the concept of attributes to describe individual pieces of data. Attributes not only define the data but also define the ATT commands that can be used with that data, hence this layer is called the ATT layer.

8) GATT (Generic Attribute Profile). GATT is used to standardize the data content within attributes and uses the concept of groups to classify and manage attributes. Without GATT, the BLE protocol stack could still function, but interoperability would be problematic. It is precisely because of GATT and various application profiles that BLE has escaped the compatibility issues faced by wireless protocols like ZigBee, becoming the largest 2.4G wireless communication product in terms of shipment.

Regarding the specific working principles of the BLE protocol, the functions of each layer, why layering is necessary, how communication broadcasting works, how to send and receive data, and other related questions, I will not elaborate further here. For those interested in learning more, feel free to contact me for exchange and discussion!

03

Quick Guide to Low Energy Bluetooth (BLE) Product Development

What Can BLE Do?

Using a BLE module, you can easily establish a Bluetooth Mesh network for multi-device communication, create new network topologies, and the network can include dozens, hundreds, or even thousands of Bluetooth Mesh devices that can exchange information. The most common applications are in building automation, wireless sensor networks, asset tracking, and smart home IoT applications. You only need one controlling device to easily and efficiently connect and control all the devices and nodes in the network.

In addition, BLE Bluetooth has many application scenarios, such as: smart lighting control, Bluetooth locks, Beacon indoor positioning, electronic tags, smart voice, voltage detection, etc.

Quick Guide to Low Energy Bluetooth (BLE) Product Development

Quick Guide to Low Energy Bluetooth (BLE) Product Development

04

Quick Guide to Low Energy Bluetooth (BLE) Product Development

BLE Development Case Demonstration

Below, I will use the most common electronic price tag as a demonstration to introduce how to build an ESL application platform step by step.

The ESL platform used in the experiment includes ESL devices, ESL AP’s BLE communication module, and the ESL host demonstration program. Their respective functions are as follows:

1) ESL Device: Developers can easily create electronic price tags with different screen sizes and functionalities;

2) ESL AP BLE Communication Module: Developers can quickly interface with existing gateway devices;

3) ESL Host Demonstration Program: Developers can quickly verify the functionality of the entire platform and conduct solution evaluations.

BLE Platform System Architecture

Quick Guide to Low Energy Bluetooth (BLE) Product Development

The above image shows the complete system architecture of an ESL solution, primarily consisting of three subsystems: ESL devices, ESL AP, and ESL Network Server.

The ESL device is a terminal device responsible for image display, LED control, and other terminal functions.

ESL AP can be functionally divided into the following two parts:

· ESL BLE Module is the BLE communication module responsible for communicating with ESL devices via BLE and forwarding messages to the ESL AP MCU.

· ESL AP MCU is the main control MCU responsible for network communication and message forwarding.

ESL Network Server is responsible for managing and maintaining all ESL devices and ESL APs.

In the above functionalities, the ESL device and ESL AP’s ESL BLE Module are already included in the application platform. The ESL AP’s ESL AP MCU and ESL Network Server will be designed and implemented by partners, and the application platform provides a demonstration program to replace these two parts.

Electronic Price Tag Evaluation System

Quick Guide to Low Energy Bluetooth (BLE) Product Development

The application platform provides a complete evaluation scheme to verify and assess the platform’s functionality.

The various parts in the image above are described as follows:

· ESL1 … ESLn multiple ESL devices can communicate with the ESL BLE Module;

· ESL BLE Module, BLE communication module, connects to the host via serial port;

· ESL host demonstration program simulates the ESL AP’s ESL AP MCU and ESL Network Server. The demonstration program implements offline price tag management and control functions, supporting the management and maintenance of price tag devices and ESL APs.

ESL Development Environment Setup

1) Hardware Preparation

Quick Guide to Low Energy Bluetooth (BLE) Product Development

2) Software Preparation

Quick Guide to Low Energy Bluetooth (BLE) Product Development

Hardware Development Environment Setup

As shown in the figure below:

· Development board 1 and development board 2 serve as ESL device 1 and ESL device 2, connected to the PC via USB interfaces;

· Development board 3 serves as the ESL BLE Module, also connected to the PC via USB;

· The USB-UART serial conversion line connects the RX pin to the P25 pin of development board 3, GND to the GND of development board 3, and the USB interface connects to the PC. The P25 pin location is labeled on the back of the development board.

Quick Guide to Low Energy Bluetooth (BLE) Product Development

Software Development Environment Setup

The software development environment is based on the Linux system. Please refer to Chapter 2 of the “CB6121 Quick Start Manual” for setup instructions.

Firmware Compilation

Compilation can refer to Chapter 3 of the “CB6121 Quick Start Manual”; I will not elaborate further.

After completing the ESL platform development, testing, and functionality verification tasks, the main implementations include: auto online, image flashing, light control, reboot, upgrade, and AP upgrade functions. For detailed testing and verification processes and various functional tests, please contact the teaching assistant to obtain the detailed BLE development documentation.

Function Demonstration

Image Flashing Function:

The ESL host demonstration program executes the image flashing operation on the ESL device, and the image information will be displayed on the ESL device’s LOG port.

Operation Steps

1) Select the ESL device for image flashing from the price tag list, click the <>Select< button to add it to the list below.

Quick Guide to Low Energy Bluetooth (BLE) Product Development

2) Click the <>Select< button next to the image flashing option, choose the image file; the host software includes a test image, use pictest_1.bin;

Quick Guide to Low Energy Bluetooth (BLE) Product Development

3) Click the <>Flash Image< button and wait for the flashing process to complete. You can see a successful flashing prompt in the log port below;

Quick Guide to Low Energy Bluetooth (BLE) Product Development

4) The ESL device will display the following log information, indicating that it has received the image information;

Quick Guide to Low Energy Bluetooth (BLE) Product Development

5) The ESL BLE Module will show the following log information, displaying the entire forwarding process.

Quick Guide to Low Energy Bluetooth (BLE) Product Development

AP Upgrade Function:

The ESL BLE Module supports upgrades via the ESL host demonstration program.

Operation Steps:

1) In the AP configuration interface, click the <>Select File< button to choose the upgrade file,

applications/bluetooth/esl_dongle/generated/fota.bin;

2) Click the <>Upgrade< button and wait for the upgrade operation to complete. The AP upgrade has another host tool to complete, where you can see the upgrade process on the left;

Quick Guide to Low Energy Bluetooth (BLE) Product Development

3) The log port in the price tag control interface will show a prompt indicating that the AP upgrade was successful;

Quick Guide to Low Energy Bluetooth (BLE) Product Development

4) The ESL BLE Module will display the following log information, indicating that the BLE Module upgrade was successful.

Quick Guide to Low Energy Bluetooth (BLE) Product Development

To allow more students to quickly master BLE platform development through hands-on practice based on my explanations above, I have prepared 15 sets of CB6121 Bluetooth development kits (EVB), which are currently available for trial in the enthusiast trial center. This can help students complete BLE development, testing, and functionality verification more quickly, simply, and efficiently. Additionally, according to their own needs, they can use the EVB to program the software onto the chip or connect via JTAG for online debugging.

This trial opportunity is limited, so everyone should seize the chance!

CB6121 Product Features:

1. Onboard BLE 5.0 chip PHY6212, rich resources, and complete tools

2. USB powered and serial port, easy debugging

3. Experience serial transparent transmission, OAT, and other functions right out of the box

4. Supports BLE and BLE Mesh application development

5. Supports gateway-side Mesh networking and control functions

CB6121 Application Examples:

Example 1: UART Transparent Transmission

Quick Guide to Low Energy Bluetooth (BLE) Product Development

Example 2: Tmall Genie Mesh Application

Quick Guide to Low Energy Bluetooth (BLE) Product Development

Example 3: SIG Mesh Application

Quick Guide to Low Energy Bluetooth (BLE) Product Development

How to Apply for Free Trial?

Students who wish to participate in the trial can follow the activity process below to complete their registration:
1. Application: Scan the QR code below, enter the page, and click “Free Application” to register.
Quick Guide to Low Energy Bluetooth (BLE) Product Development
*Kind Reminder: Participants should carefully fill out the application reasons, showcasing creative [trial plans] and [online influence], and it is best to complete [forum personal information] to greatly increase the chances of application approval!
2. Screening: The website will screen applicants based on the [trial plan] and [forum activity] dimensions;
3. List Announcement: The trial list will be announced on the activity page;
4. Trial Notification: After the announcement, staff will notify successful applicants via SMS or phone. If there’s no response within 2 days, it will be considered forfeited;
5. Product Delivery: After confirming the trial rules with the trial participants, the product will be shipped to the participants;
6. Trial Report: After receiving the product, the trial begins, and a [trial report] must be submitted weekly. The trial report must be 100% original; plagiarism will result in a ban.
Activity Timeline
1. Application Registration:2020/06/10-2020/07/102. List Announcement: 2020/07/123. Shipping Date: 2020/07/14
4. Trial Period: Until August 16
Press and hold the QR code to register immediately & inquire (Note: Trial)
Quick Guide to Low Energy Bluetooth (BLE) Product Development
Enthusiast Xiao You 18145813532

Quick Guide to Low Energy Bluetooth (BLE) Product Development

For more development board trial activities, please press and hold the QR code below to download the Electronic Enthusiast APP.

Quick Guide to Low Energy Bluetooth (BLE) Product Development

Leave a Comment