Glucose Sensor
Table of Contents
Introduction
The glucose_sensor project implements a simple Bluetooth low energy peripheral device with GATT services and implements the Glucose Profile. This project can be a framework for developing many different glucose sensor applications.
This project uses a single stack and app configuration. It is summarized in the table below:
| App Build Configuration | Compatible Stack Configuration | Description |
|---|---|---|
| FlashROM_StackLibrary | FlashROM_Library | Application build configuration linked to Stack library (fully executable) |
FlashROM_Library configurations use the stack library configuration, which is explained here.
This document discusses the procedure for using the glucose_sensor application when the FlashROM_StackLibrary configurations are used. The project can also be modified to support other configurations similar to the simple_peripheral project.
Hardware Prerequisites
The default glucose_sensor configuration uses the LAUNCHXL-CC2640R2. This hardware configuration is shown in the below image:
For custom hardware, see the Running the SDK on Custom Boards section of the BLE5-Stack User’s Guide.
Software Prerequisites
For information on what versions of Code Composer Studio and IAR Embedded Workbench to use, see the Release Notes located in the docs/ble5stack folder. For information on how to import this project into your IDE workspace and build/run, please refer to The CC2640R2F Platform section in the BLE5-Stack User’s Guide.
Service/Profile Table
This project contains 1 service, the Glucose service, which has 4 characteristics.
| Characterisitic | UUID | Format | Properties | Profile Source |
|---|---|---|---|---|
| 1 | 0x2A18 | 1 Byte Integer | Notify | glucose_sensor.c |
| 2 | 0x2A34 | 1 Byte Integer | Notify | glucose_sensor.c |
| 3 | 0x2A51 | 2 Byte Integer | Read | glucose_sensor.c |
| 4 | 0x2A52 | 2 Byte Integer | Write/Indicate | glucose_sensor.c |
Usage
This application does not use any display interfaces. However, it does use the keys to send simulated glucose measurements.
| Key | Description |
|---|---|
| BTN-1 | Send Glucose Measurement notification |
| BTN-2 | Toggle advertising |
This document will use Android BLE Scanner as the phone app that will act as the central device that will connect to the glucose_sensor application. BLE Scanner can be downloaded free of charge on the Play Store.
Once the glucose_sensor sample application starts, press BTN-2 on the CC2640R2 LaunchPad to start advertising.
Advertising is not enabled by default upon startup, however, this can changed by setting AUTO_ADV to TRUE:
Usng BLE scanner to scan for the device, you should see a device with the name of “Glucose” (note that the navigation might be slightly different depending on your mobile application):
If there is more than one device with the same name, the RSSI value in the colored circles on the left can be used to find which device you are trying to connect to. Press the “CONNECT” button to connect to the device. Once connected, in BLE Scanner, you should be able to see all the services on the glucose_sensor device:
You should see one service, which is labeled as “GLUCOSE” (this may be slightly different for other smartphone applications). It will also provide its UUID. Clicking on this service will display the 4 characteristics that it contains, with information about each characteristic:
The following sections detail the functions and operations of each of the characteristics.
Glucose Measurement (UUID: 0x2A18)
This characteristic is used to notify simulated glucose measurements with default size of 1 byte. As shown below, there is a circle with an “N”, next to “GLUCOSE MEASUREMENT”:
This is the button used to enable notification. The value for this characteristic is set to “0x0000” by default, and it can be changed by pressing the “N” button. Upon pressing the Notify button, the app will write a “0x0001” to the CCCD of this Glucose Measurement characteristic to enable notification.
Pressing BTN-1 will change the value of the notification. See the Glucose Service for more details. The Glucose Measurement value will be updated(notified) in BLE Scanner with simulated values with each button press:
The figure above shows that the current value of the glucose measurements.
Glucose Context (UUID: 0x2A34)
This characteristic has notify property only, it is used to send additional contextual information relative to the Glucose Measurement characteristic. The notification can be enabled by pressing the “N” button similar to the Glucose Measurement characteristic.
Glucose Feature (UUID: 0x2A51)
This characteristic has read property only. Its value can be read by pressing the “R” button on the app. It is used by the Client to read the supported features of the Server. See the Glucose Service for more details on the supported control point commands.
Record Control Point (UUID: 0x2A52)
This characteristic has write/indicate property only. Its value can be written to by pressing the “W” button on the app and indicated with the “I” button.
See the Glucose Service for more details on the supported control point commands.