Run a K30 CO2 sensor on a Nordic nRF52DK Board
Fork of mbed-os-example-ble-BatteryLevel by
Revision 63:8ec90c81ff7d, committed 2018-05-02
- Comitter:
- davidgsIoT
- Date:
- Wed May 02 12:14:43 2018 +0000
- Parent:
- 62:e947447e0d8c
- Commit message:
- Updated Readme
Changed in this revision
module.json | Show annotated file Show diff for this revision Revisions of this file |
readme.md | Show annotated file Show diff for this revision Revisions of this file |
diff -r e947447e0d8c -r 8ec90c81ff7d module.json --- a/module.json Tue May 01 17:51:51 2018 +0000 +++ b/module.json Wed May 02 12:14:43 2018 +0000 @@ -1,7 +1,7 @@ { - "name": "ble-batterylevel", + "name": "ble-K30-Sensor", "version": "0.0.1", - "description": "An example of creating and updating a simple GATT Service using the BLE_API", + "description": "An example of creating and updating a simple GATT Service for a K30 CO2 Sensor using the BLE_API", "licenses": [ { "url": "https://spdx.org/licenses/Apache-2.0",
diff -r e947447e0d8c -r 8ec90c81ff7d readme.md --- a/readme.md Tue May 01 17:51:51 2018 +0000 +++ b/readme.md Wed May 02 12:14:43 2018 +0000 @@ -1,9 +1,10 @@ -This example creates and updates a standard Battery Level service containing a single +This example creates and updates a CO2 Monitoring service containing a single GATT characteristic. -The [battery service transmits](https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml) a device's battery level in percentage, with 100% being a fully charged battery and 0% being a fully drained battery. +The service updates a CO reading in parts per million (PPM). -Although the sample application runs on a BLE device, it doesn't show the device's real battery level (because that changes very slowly and will make for a dull example). Instead, it transmits a fake battery level that starts at 50% (half charged). Every half second, it increments the battery level, going in single increments until reaching 100% (as if the battery is charging). It then drops down to 20% to start incrementing again. +The sample application runs on a BLE device The CO2 level should not be read more than every 2 seocnds as the sensor itself doesn't update the value more frequently. Also, the nRF52DK board for which this is written can power the sensors -- 5v at 500ma -- it sometimes struggles to keep the power rail steady. When this happens, the sensor begins to fail. If there are more than 5 sensor failures in a row, the device automatically reboots which usually foxes the problem. + # Running the application @@ -45,24 +46,13 @@ **figure 3** How to establish a connection using Master Control Panel 4.0.5 -1. Discover the services and the characteristics on the device. The *Battery service* has the UUID 0x180F and includes the *Battery level* characteristic which has the UUID 0x2A19. - - ![](img/discovery.png) - - **figure 4** Representation of the Battery service using Master Control Panel 4.0.5 - -1. Register for the notifications sent by the *Battery level* characteristic. - - ![](img/register_to_notifications.png) - - **figure 5** How to register to notifications using Master Control Panel 4.0.5 +1. Discover the services and the characteristics on the device. The *undefined service* has the UUID 0xA000 and includes the *undefined* characteristic which has the UUID 0xA0001. -1. You should see the battery level value change every half second. It begins at 50, goes up to 100 (in steps of 1), resets to 20 and so on. +1. Register for the notifications sent by the *undefined* characteristic. - ![](img/notifications.png) - **figure 6** Notifications view using Master Control Panel 4.0.5 +1. You should see the CO2 reading value change. If you can see the characteristic, and if its value is incrementing correctly, the application is working properly.