BLE example with Environmental Sensing service.
Dependencies: BSP_B-L475E-IOT01
Homepage
Hello IoT BLE¶
This project uses Environmental Sensing Service and its characteristics:
Characteristic values can be read or they might be observed with notifications enabled.
Please note that this example uses slightly modified Environmental service.
Also there have been some opened issues regarding value types Issue 1 and Issue 2.
Note that this application was developed as a part of a larger project Hello IoT, but can be used as a standalone.
(Source files can be found at the end of this page.)
Running the application¶
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:
- nRF Master Control Panel for Android.
- LightBlue for iPhone
Hardware requirements are in the main readme.
Building instructions¶
Building with mbed CLI
If you'd like to use mbed CLI to build this, then you should refer to the main readme. The instructions here relate to using the Mbed Online Compiler.
Building with Mbed Online Compiler
In order to build this example in the Mbed Online Compiler, first import the example using the Import
button on the right hand side.
Next, select a platform to build for. This must either be a platform that supports BLE, for example the NRF51-DK, or one of the following:
List of platforms supporting Bluetooth Low Energy.
Or you must also add a piece of hardware and the supporting library that includes a Bluetooth Low Energy driver for that hardware, for example the K64F or NUCLEO_F401RE with the X-NUCLEO-IDB05A1
List of components supporting Bluetooth Low Energy.
Once you have selected your platform, compile the example and drag and drop the resulting binary onto your board.
Note: This example was tested with DISCO_L475VG_IOT01A (ref B-L475E-IOT01A), so when using onboard sensors instead of simulated ones, make sure you select this board.
For general instructions on using the Mbed Online Compiler, please see the mbed Handbook.
Checking for success¶
Note: Screen captures depicted below show what is expected from this example if the scanner used is nRF Connect. If you encounter any difficulties consider trying another scanner or another version of nRF Connect. Alternative scanners may require reference to their manuals.
- Build the application and install it on your board as explained in the building instructions.
- Open the BLE scanner on your phone.
- Start a scan and connect to a device named IoT_SENSOR.
- Discover the services and the characteristics on the device. The Environmental Sensing service has the UUID
0x181A
with characteristics Temperature0x2A6E
, Humidity0x2A6F
and Pressure0x2A6D
.
- At this point you can read or register for notifications. In figure below, all characteristics have been registered for notification and their values should change every second.