Example program for the Eddystone Beacon service.

Dependencies:   BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1

Fork of BLE_EddystoneBeacon by URIBeacon

This example demonstrates how to set up and initialize a Eddystone Beacon. For more details on the Eddystone specification please see the Eddystone Github Page.

The Basics

An Eddystone Beacon is a Bluetooth Low Energy beacon, that means it does all of its data transfer in GAP advertising packets. Eddystone beacons, unlike other beacons, broadcast multiple types of data. Currently Eddystone beacons have 3 frame types (UID, URL, TLM) that will get swapped out periodically. This swapping of frame data allows Eddystone beacons to send many different types of data, thus increasing their usefulness over traditional beacons. Note that the UID frame type provides the same 16Bytes of UUID namespace that iBeacons do and the URL frame type provides the same functionality as a URIBeacon.

For more details see the Eddystone Specification.

Smartphone Apps

nRF Master Control Panel - this program recognizes Eddystone beacons and will display the data for all frame types.

iPhone Physical Web app

Android App

Walkthrough of Physical Web application

Technical Details

The Eddystone Specification looks like the following image. Please note that this may change over time and for up to date information the official spec should be referenced. /media/uploads/mbedAustin/scratch-1-.png

The Eddystone Frames get swapped in and out depending on what frames you have enabled. The only required frame type is the TLM frame, all others are optional and you can have any number enabled. To disable the UID or URL frames give their values a 'NULL' in the Eddystone constructor. The Eddystone spec recommends broadcasting 10 frames a second.

Note

  • The current Eddystone mbed example does not allow for combining the eddystone service with other services, this will be changes in a future update.
  • There is an Eddystone Config service that allows for updating beacons in the field. We are working on an example for this, so keep your eyes pealed for a future update.
Revision:
32:41840b78597e
Parent:
31:bdd03742096a
Child:
33:862e6e0831ea
--- a/main.cpp	Tue Aug 11 18:13:46 2015 +0000
+++ b/main.cpp	Thu Oct 01 16:28:22 2015 +0000
@@ -1,5 +1,5 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2015 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,15 +15,18 @@
  */
 
 #include "mbed.h"
-#include "ble/BLE.h"
+#include "BLE.h"
 #include "ble/services/EddystoneService.h"
 
 BLE ble;
 uint8_t UIDnamespace[] = {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA}; // 10Bytes for Namespace UUID
 uint8_t UIDinstance[]  = {0xbb,0xcc,0xdd,0xee,0xff,0x00}; // 6Bytes for Instance UUID
 char Url[] = "http://www.mbed.org";
-int8_t txPower = -40;
+int8_t radioTxPower = 20;
+int8_t advTxPower = -20;
 uint16_t beaconPeriodus = 1000;
+uint8_t tlmVersion = 0x00;
+
 
 //Callbacks for temperature / battery updates
 Ticker tlmBattery;
@@ -31,24 +34,36 @@
 int battery = 0;
 int temp = 0;
 
-// Add Eddystone service to BLE device, can pass NULL for UID and URL parameters to disable those frames
-EddystoneService eddyBeacon(ble, beaconPeriodus, txPower ,UIDnamespace, UIDinstance, Url, sizeof(Url));
+// Setup Eddystone Service 
+EddystoneService eddyBeacon(ble,beaconPeriodus,radioTxPower);
 
-// Optional Function to update Eddystone beacon TLM frame battery voltage
+
+// Function to update beacon battery voltage
 void tlmBatteryCallback(void){
     eddyBeacon.updateTlmBatteryVoltage(battery++);
 }
 
-// Optional Function to update Eddystone beacon TLM frame temperature
+// Function to update Beacon Temperature
 void tlmTemperatureCallback(void){
     eddyBeacon.updateTlmBeaconTemp(temp++);
 }
 
 int main(void)
 {
-    printf("Starting Example\r\n");
+    printf("Starting Example\r\n"); // To enable low power mode disable all printf's
+
+    // Set Eddystone Frame Data (TLM,UID,URI...etc)
+    eddyBeacon.setTLMFrameData(tlmVersion,5.0);
+    eddyBeacon.setURLFrameData(advTxPower, Url, 2.0);
+    eddyBeacon.setUIDFrameData(advTxPower, UIDnamespace, UIDinstance, 3.0);
+    
+    // Attach functions to modify TLM data
     tlmTemperature.attach(tlmTemperatureCallback,2.0f);
     tlmBattery.attach(tlmBatteryCallback, 1.0f);
+
+    // Start Advertising the eddystone service. 
+    eddyBeacon.start(); 
+    
     printf("Running...\r\n");
     while (true) {
         ble.waitForEvent();