This application aims to implement an example of Continuous Glucose Monitoring in The Bluetooth SIG CGM Profile using the Thunderboard EFR32BG22
The Bluetooth SIG CGM Profile is a Bluetooth Low Energy (BLE) profile that can help people with diabetes to more efficiently manage their blood sugar levels. By providing users with real-time glucose data, this profile helps them to detect low/high blood sugar levels earlier, which can prevent serious complications.
This project focuses on managing and interacting with the Continuous Glucose Monitoring service in Bluetooth part, not about the used biological sensors and analog front-end (AFE). Generally, there are no common biological sensors and AFE solutions for the BGM/CGM product in the market; manufacturers have their own proprietary solutions.
- SDK version
- Software Required
- Hardware Required
- Connections Required
- Setup
- How It Works
- PTS test
- Report Bugs & Get Support
- 1x Bluetooth Low Energy Development Kit. For example, SLTB010A EFR32BG22 Thunderboard Kit
- 1x smartphone running the 'LightBlue' app
This example uses the LightBlue app to connect to the Thunderboard EFR32BG22 via Bluetooth for continuous glucose monitoring.
To test this application, you can either create a project based on an example project or start with a "Bluetooth - SoC Empty" project based on your hardware.
Note
Make sure that the bluetooth_applications repository is added to Preferences > Simplicity Studio > External Repos.
-
From the Launcher Home, add your product name to My Products, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project filtering by "glucose".
-
Click Create button on Bluetooth - Continuous Glucose Monitoring example. Example project creation dialog pops up -> click Create and Finish and Project should be generated.
-
Build and flash this example to your board.
-
Create a Bluetooth - SoC Empty project for your hardware using Simplicity Studio 5.
-
Copy all the .h and .c files in inc and src folders into the project root folder (overwriting all existing files).
-
Import the GATT configuration:
-
Open the .slcp file in the project.
-
Select the CONFIGURATION TOOLS tab and open the Bluetooth GATT Configurator.
-
Find the Import button and import the attached gatt_configuration.btconf file.
-
Save the GATT configuration (ctrl-s).
-
-
Open the .slcp file. Select the SOFTWARE COMPONENTS tab and install the software components:
- [Application] → [Timers] → [Sleep timer]
- [Services] → [IO Stream] → [IO Stream: USART] → default instance name: vcom
- [Application] → [Utility] → [Log]
- [Platform] → [Board] → [Board Control]: Enable Virtual COM UART.
-
Build and flash this project to your board.
Note
A bootloader needs to be flashed to your board if the project starts from the "Bluetooth - SoC Empty" project, see Bootloader for more information.
The application is based on the Bluetooth - SoC Empty example. Since the example already has the Bluetooth GATT server, advertising, and connection mechanisms, only minor changes are required.
There are two major services: Continuous Glucose Monitoring service and OTA service.
The Continuous Glucose Monitoring (CGM) Service exposes glucose measurement and other data related to a personal CGM sensor for healthcare applications. This service has UUID 0x181F and contains 7 characteristics.
- [Service] Continuous Glucose Monitoring -
0x181F- [Char] CGM Measurement -
2AA7- [N] Notify the Continuous Glucose Monitoring reports
- [Char] CGM Feature -
2AA8- [R] Get the CGM service feature
- [Char] CGM Status -
2AA9- [R] Get the current status from the CGM Sensor
- [Char] CGM Session Start Time -
2AAA- [R] Get Measurement Session Start Time
- [W] Set Measurement Session Start Time
- [Char] CGM Session Run Time -
2AAB- [R] Get Measurement Session Run Time
- [Char] Record Access Control Point -
2A52- [W] Enables functions including counting records, transmitting records and clearing records based on filter criterion
- [I] Get status from the function requests
- [Char] CGM Specific Ops Control Point -
2AAC- [W] Set CGM-specific settings of the device
- [I] Get status from the CGM settings
- [Char] CGM Measurement -
Where R = Readable, W = Writeable, N = Notify and I = Indicate.
Used for OTA upgrade, please refer to AN1086: Using the Gecko Bootloader with the Silicon Labs Bluetooth® Applications for more information.
After the application is initialized, the collector (typically a smartphone or tablet) scans for the CGM sensor device with the advertising name: "silabs-CGM" and connects to it. Once the connection is established, the collector configures the CGM Specific Ops Control Point characteristic to set CGM-specific functionality and settings on the sensor device, such as the CGM Communication Interval or sending a calibration value to the device.
After configuration, the collector uses the Record Access Control Point characteristic to enable functions such as counting records, transmitting records, and clearing records based on filter criteria. The filter criteria in the Operand field are defined by the service that references this characteristic, and they specify the format of a record (which may be comprised of one or more characteristics) and the sequence of transferred records.
When the measurement session ends, the measurement reports can be displayed in the CGM Measurement characteristic.
Please refer to Bluetooth SIG CGM introduction.md in the doc folder for more information.
Open the LightBlue app, filter silabs-CGM and connect it.
After successfully connected, it will look like below. Check section CGM service for more information about this service.
Please refer to CGM specifications in the doc folder for below process
-
Open the LightBlue app, connect silabs-CGM.
-
Find the Continuous Glucose Monitoring service.
-
Set indicate of 0x2AA7 characteristic (CGM Measurement) and 0x2A52 characteristic (Record Access Control Point).
-
Write HEX 0401 to 0x2A52.
-
There will be 1 indication (0x05008025) in 0x2A52, which means that there are 9600 (0x2580) records by default.
There are two ways that a client can receive the CGM Measurement Characteristic values:
- Periodic
- Requested
-
Set Notify of 0x2AA7 characteristic (CGM Measurement)
-
Set indicate of 0x2AAC characteristic (CGM Specific Ops Control Point).
-
Write HEX 1A to 0x2AAC, which means start session - you can find this test case in CGMS.TS.p6: CGMS/SEN/CGMCP/BV-22-C [CGM Specific Ops – Start Session].
-
There will be 1 indication in 0x2AAC to show start session success.
-
The sensor (Thunderboard) will continuously send the notifications to 0x2AA7 characteristic until writing 0x1B to 0x2AAC (stop session).
-
Write "1B" to 0x2AAC to stop the session.
- Set Notify of 0x2AA7 characteristic (CGM Measurement)
- Set indicate of 0x2A52 characteristic (Record Access Control Point),
- Write HEX 0105 to 0x2A52, which means the reporting of the first record.
- There will be 1 notification in 0x2AA7, which is the first record.
You can download the CGM specification from https://www.bluetooth.com/specifications/specs/, which is already in the doc folder of this repository.
Here you can watch a tutorial video about the Bluetooth PTS Test in Chinese: https://www.bilibili.com/video/BV1w44y1a7Hj?spm_id_from=333.999.0.0
To report bugs in the Application Examples projects, please create a new "Issue" in the "Issues" section of bluetooth_applications repo. Please reference the board, project, and source files associated with the bug, and reference line numbers. If you are proposing a fix, also include information on the proposed fix. Since these examples are provided as-is, there is no guarantee that these examples will be updated to fix these issues.
Questions and comments related to these examples should be made by creating a new "Issue" in the "Issues" section of bluetooth_applications repo.