BLE EddystoneService example
This example is a fork of the following mbed-os example:
https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-EddystoneService/
Please read the documentation in this page.
readme.md@15:127154104533, 2016-12-15 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Dec 15 16:30:34 2016 +0000
- Revision:
- 15:127154104533
- Parent:
- 3:5120491ba317
- Child:
- 23:cb118b5f052b
Merge pull request #42 from ARMmbed/mbed-os-5.3.0-rc3
Mbed os 5.3.0 rc3
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-ble
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 3:5120491ba317 | 1 | Eddystone beacons broadcast a small amount of information, like URLs, to nearby BLE devices. |
mbed_official | 3:5120491ba317 | 2 | |
mbed_official | 3:5120491ba317 | 3 | The Eddystone Beacon sample application runs in two stages: |
mbed_official | 3:5120491ba317 | 4 | |
mbed_official | 3:5120491ba317 | 5 | 1. On startup, the Configuration Service (which allows [modification of the beacon](https://github.com/google/eddystone/blob/master/eddystone-url/docs/config-service-spec.md)) runs for a user-defined period (default - 30 seconds). |
mbed_official | 3:5120491ba317 | 6 | |
mbed_official | 3:5120491ba317 | 7 | 1. When the Configuration Service period ends, the Eddystone Service broadcasts advertisement packets. |
mbed_official | 3:5120491ba317 | 8 | |
mbed_official | 3:5120491ba317 | 9 | |
mbed_official | 3:5120491ba317 | 10 | |
mbed_official | 3:5120491ba317 | 11 | # Running the application |
mbed_official | 3:5120491ba317 | 12 | |
mbed_official | 3:5120491ba317 | 13 | ## Requirements |
mbed_official | 3:5120491ba317 | 14 | |
mbed_official | 15:127154104533 | 15 | 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 | 3:5120491ba317 | 16 | |
mbed_official | 15:127154104533 | 17 | - [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) for Android. |
mbed_official | 3:5120491ba317 | 18 | |
mbed_official | 15:127154104533 | 19 | - [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8) for iPhone. |
mbed_official | 3:5120491ba317 | 20 | |
mbed_official | 3:5120491ba317 | 21 | Hardware requirements are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md). |
mbed_official | 3:5120491ba317 | 22 | |
mbed_official | 3:5120491ba317 | 23 | ## Building instructions |
mbed_official | 3:5120491ba317 | 24 | |
mbed_official | 3:5120491ba317 | 25 | Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md). |
mbed_official | 3:5120491ba317 | 26 | |
mbed_official | 3:5120491ba317 | 27 | |
mbed_official | 3:5120491ba317 | 28 | ## Setting up the beacon |
mbed_official | 3:5120491ba317 | 29 | |
mbed_official | 3:5120491ba317 | 30 | By default, the beacon directs to the url ``http://mbed.org``. You can change this to your own URL in two ways: |
mbed_official | 3:5120491ba317 | 31 | |
mbed_official | 3:5120491ba317 | 32 | 1. Manually edit the code in ``main.cpp`` in your copy of the sample. |
mbed_official | 3:5120491ba317 | 33 | |
mbed_official | 3:5120491ba317 | 34 | 1. Build and run the application's default code as explained in the building instructions. When the beacon starts up, the Configuration Service runs for 30 seconds (this is the default value; you can change it in ``main.cpp``). While the Configuration Service runs, you can use a BLE scanner on your phone to edit the values the service presents. |
mbed_official | 3:5120491ba317 | 35 | |
mbed_official | 3:5120491ba317 | 36 | ## Checking for success |
mbed_official | 3:5120491ba317 | 37 | |
mbed_official | 3:5120491ba317 | 38 | 1. Build the application and install it on your board as explained in the building instructions. |
mbed_official | 3:5120491ba317 | 39 | |
mbed_official | 15:127154104533 | 40 | 1. Open the BLE scanner on your phone. |
mbed_official | 3:5120491ba317 | 41 | |
mbed_official | 15:127154104533 | 42 | 1. Start a scan. |
mbed_official | 3:5120491ba317 | 43 | |
mbed_official | 15:127154104533 | 44 | ![](img/1.png) |
mbed_official | 3:5120491ba317 | 45 | |
mbed_official | 15:127154104533 | 46 | **figure 1** Start of the *nRF Connect* application version 4.8.1 on Android |
mbed_official | 15:127154104533 | 47 | |
mbed_official | 15:127154104533 | 48 | 1. Find your device; it should be named `EDDYSTONE CONFIG`. When the beacon starts up, the Configuration Service runs for 30 seconds. |
mbed_official | 3:5120491ba317 | 49 | During this time it is possible to change the URL advertised by the beacon. |
mbed_official | 3:5120491ba317 | 50 | It is also important to note that during these 30 seconds, your device will not advertise any URL. |
mbed_official | 3:5120491ba317 | 51 | |
mbed_official | 15:127154104533 | 52 | ![](img/2.png) |
mbed_official | 3:5120491ba317 | 53 | |
mbed_official | 15:127154104533 | 54 | **figure 2** Scan results using nRF Master Control Panel 4.8.1 |
mbed_official | 3:5120491ba317 | 55 | |
mbed_official | 3:5120491ba317 | 56 | |
mbed_official | 15:127154104533 | 57 | 1. Establish a connection with your device while it is configurable. |
mbed_official | 15:127154104533 | 58 | |
mbed_official | 15:127154104533 | 59 | ![](img/3.png) |
mbed_official | 15:127154104533 | 60 | |
mbed_official | 15:127154104533 | 61 | **figure 3** How to establish a connection using Master Control Panel 4.8.1 |
mbed_official | 15:127154104533 | 62 | |
mbed_official | 15:127154104533 | 63 | 1. Discover the services and the characteristics on the device. The *Eddystone-URL Configuration Service* has the UUID `ee0c2080-8786-40ba-ab96-99b91ac981d8` and includes the *URI Data* characteristic which has the UUID `ee0c2085-8786-40ba-ab96-99b91ac981d8`. |
mbed_official | 3:5120491ba317 | 64 | |
mbed_official | 15:127154104533 | 65 | ![](img/4.png) |
mbed_official | 15:127154104533 | 66 | |
mbed_official | 15:127154104533 | 67 | **figure 4** Minimized view of services using Master Control Panel 4.8.1 |
mbed_official | 3:5120491ba317 | 68 | |
mbed_official | 15:127154104533 | 69 | ![](img/5.png) |
mbed_official | 15:127154104533 | 70 | |
mbed_official | 15:127154104533 | 71 | **figure 5** Extended view of the *Eddystone-URL Configuration Service* using Master Control Panel 4.8.1 |
mbed_official | 3:5120491ba317 | 72 | |
mbed_official | 3:5120491ba317 | 73 | |
mbed_official | 15:127154104533 | 74 | 1. Edit the URL advertised by your beacon. You can learn more about the encoding rule [here](https://github.com/google/eddystone/blob/a52406ee6053720f78fb0c63bfc38b38e6800824/eddystone-url/README.md#eddystone-url-http-url-encoding). For this example, we can set the URL to https://www.arm.com by setting the value to `0x0161726D00`. |
mbed_official | 15:127154104533 | 75 | |
mbed_official | 15:127154104533 | 76 | ![](img/6.png) |
mbed_official | 3:5120491ba317 | 77 | |
mbed_official | 15:127154104533 | 78 | **figure 6** How to edit characteristic value using Master Control Panel 4.8.1 |
mbed_official | 3:5120491ba317 | 79 | |
mbed_official | 15:127154104533 | 80 | ![](img/7.png) |
mbed_official | 15:127154104533 | 81 | |
mbed_official | 15:127154104533 | 82 | **figure 7** Edition of the URL using Master Control Panel 4.8.1 |
mbed_official | 3:5120491ba317 | 83 | |
mbed_official | 3:5120491ba317 | 84 | |
mbed_official | 15:127154104533 | 85 | 1. The URL is now set https://www.arm.com . It is mandatory to disconnect your phone from the beacon to let the beacon advertise the new URI. |
mbed_official | 15:127154104533 | 86 | |
mbed_official | 15:127154104533 | 87 | ![](img/8.png) |
mbed_official | 15:127154104533 | 88 | |
mbed_official | 15:127154104533 | 89 | **figure 8** URL updated using Master Control Panel 4.8.1. |
mbed_official | 15:127154104533 | 90 | |
mbed_official | 15:127154104533 | 91 | 1. Enter the scanner mode and start a scan to see the URL advertised by the beacon. |
mbed_official | 3:5120491ba317 | 92 | |
mbed_official | 15:127154104533 | 93 | ![](img/9.png) |
mbed_official | 15:127154104533 | 94 | |
mbed_official | 15:127154104533 | 95 | **figure 9** How to enter reenter in the scanner command panel using Master Control Panel 4.8.1. |
mbed_official | 3:5120491ba317 | 96 | |
mbed_official | 15:127154104533 | 97 | ![](img/10.png) |
mbed_official | 15:127154104533 | 98 | |
mbed_official | 15:127154104533 | 99 | **figure 10** Eddystone beacon advertising. |
mbed_official | 3:5120491ba317 | 100 | |
mbed_official | 3:5120491ba317 | 101 | |
mbed_official | 3:5120491ba317 | 102 | **Note:** You can use the [Eddystone Observer](https://github.com/ARMmbed/mbed-os-example-ble/tree/master/BLE_EddystoneObserver) sample instead of a phone application. |