Run a K30 CO2 sensor on a Nordic nRF52DK Board

Fork of mbed-os-example-ble-BatteryLevel by mbed-os-examples

Committer:
davidgsIoT
Date:
Wed May 02 12:14:43 2018 +0000
Revision:
63:8ec90c81ff7d
Parent:
4:52bffaff7f0b
Updated Readme

Who changed what in which revision?

UserRevisionLine numberNew contents of line
davidgsIoT 63:8ec90c81ff7d 1 This example creates and updates a CO2 Monitoring service containing a single
mbed_official 4:52bffaff7f0b 2 GATT characteristic.
mbed_official 4:52bffaff7f0b 3
davidgsIoT 63:8ec90c81ff7d 4 The service updates a CO reading in parts per million (PPM).
mbed_official 4:52bffaff7f0b 5
davidgsIoT 63:8ec90c81ff7d 6 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.
davidgsIoT 63:8ec90c81ff7d 7
mbed_official 4:52bffaff7f0b 8
mbed_official 4:52bffaff7f0b 9 # Running the application
mbed_official 4:52bffaff7f0b 10
mbed_official 4:52bffaff7f0b 11 ## Requirements
mbed_official 4:52bffaff7f0b 12
mbed_official 4:52bffaff7f0b 13 The sample application can be seen on any BLE scanner on a smartphone. If you don't have a scanner on your phone, please install :
mbed_official 4:52bffaff7f0b 14
mbed_official 4:52bffaff7f0b 15 - [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) for Android.
mbed_official 4:52bffaff7f0b 16
mbed_official 4:52bffaff7f0b 17 - [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8) for iPhone.
mbed_official 4:52bffaff7f0b 18
mbed_official 4:52bffaff7f0b 19 Hardware requirements are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
mbed_official 4:52bffaff7f0b 20
mbed_official 4:52bffaff7f0b 21 ## Building instructions
mbed_official 4:52bffaff7f0b 22
mbed_official 4:52bffaff7f0b 23 Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
mbed_official 4:52bffaff7f0b 24
mbed_official 4:52bffaff7f0b 25 ## Checking for success
mbed_official 4:52bffaff7f0b 26
mbed_official 4:52bffaff7f0b 27 **Note:** Screens captures depicted below show what is expected from this example if the scanner used is *nRF Master Control Panel* version 4.0.5. If you encounter any difficulties consider trying another scanner or another version of nRF Master Control Panel. Alternative scanners may require reference to their manuals.
mbed_official 4:52bffaff7f0b 28
mbed_official 4:52bffaff7f0b 29 1. Build the application and install it on your board as explained in the building instructions.
mbed_official 4:52bffaff7f0b 30 1. Open the BLE scanner on your phone.
mbed_official 4:52bffaff7f0b 31 1. Start a scan.
mbed_official 4:52bffaff7f0b 32
mbed_official 4:52bffaff7f0b 33 ![](img/start_scan.png)
mbed_official 4:52bffaff7f0b 34
mbed_official 4:52bffaff7f0b 35 **figure 1** How to start scan using nRF Master Control Panel 4.0.5
mbed_official 4:52bffaff7f0b 36
mbed_official 4:52bffaff7f0b 37 1. Find your device; it should be named `BATTERY`.
mbed_official 4:52bffaff7f0b 38
mbed_official 4:52bffaff7f0b 39 ![](img/scan_result.png)
mbed_official 4:52bffaff7f0b 40
mbed_official 4:52bffaff7f0b 41 **figure 2** Scan results using nRF Master Control Panel 4.0.5
mbed_official 4:52bffaff7f0b 42
mbed_official 4:52bffaff7f0b 43 1. Establish a connection with your device.
mbed_official 4:52bffaff7f0b 44
mbed_official 4:52bffaff7f0b 45 ![](img/connection.png)
mbed_official 4:52bffaff7f0b 46
mbed_official 4:52bffaff7f0b 47 **figure 3** How to establish a connection using Master Control Panel 4.0.5
mbed_official 4:52bffaff7f0b 48
davidgsIoT 63:8ec90c81ff7d 49 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.
mbed_official 4:52bffaff7f0b 50
mbed_official 4:52bffaff7f0b 51
davidgsIoT 63:8ec90c81ff7d 52 1. Register for the notifications sent by the *undefined* characteristic.
mbed_official 4:52bffaff7f0b 53
mbed_official 4:52bffaff7f0b 54
davidgsIoT 63:8ec90c81ff7d 55 1. You should see the CO2 reading value change.
mbed_official 4:52bffaff7f0b 56
mbed_official 4:52bffaff7f0b 57 If you can see the characteristic, and if its value is incrementing correctly, the application is working properly.
mbed_official 4:52bffaff7f0b 58