Creating an Eddystone Beacon

 

Introduction

This article describes how to create an Eddystone beacon using Silicon Lab’s BlueGecko-based SoCs and modules.

 

Eddystone Beacons

The Eddystone format defines four different packet types. This article describes how to implement the Eddystone-URL packet.

 

Implementation

The Eddystone-URL packet advertises a URL in compressed format. To accomplish this, we need to set up the BlueGecko to advertise custom user data. The first step is to create an array to store the data to be advertised :

static uint8_t eddystone_data[EDDYSTONE_DATA_LEN] = {

 

  0x03,          //Length of service list

  0x03,          //service list

  0xAA, 0xFE,    //Eddystone ID

  0x10,          //length of service data

  0x16,          //service data

  0xAA,  0xFE,   //Eddystone ID

  0x10,          //frame type Eddyston-URL

  0x00,          // tx power

  0x00,          //http://www.

  's','i','l','a','b','s','.','c','o','m'

 

};

Once the data to be advertised is set, we can point to this data and start advertising it.

Start by setting the advertising parameters. The following call sets the minimum and maximum advertise interval to 100 ms ( 625 us * 160) and uses all three advertising channels (37,38,39)

gecko_cmd_le_gap_set_adv_parameters(160,160,7);

 

Next, make a call to the following API to point to the array containing the advertising data

 

gecko_cmd_le_gap_set_adv_data(NO_SCAN_RESPONSE,

                  EDDYSTONE_DATA_LEN,

                        eddystone_data);

In this instance, the device will not respond to scan requests.

Now set the transmit power. The Eddystone-URL packet format includes the transmit power in the 10th byte. This data can be used by receivers of the beacon to  determine distance so it is important that this data and the actual transmit power match

gecko_cmd_system_tx_power(0);

The BliueGecko is now ready to start advertising the Eddystone-URL beacon data. This is accomplished by making the following call

gecko_cmd_le_gap_set_mode(le_gap_user_data, le_gap_non_connectable);

This tells the stack to use the custom user  data and to make the beacon nonconnectable.

 

Building and Running the Example

To being working with this example, extract the zip file to a convenient location and import it into a new workspace in SimplicityStudio.

Import the project into the workspace using the file menu -> import feature. In the import dialog, select ‘existing projects into workspace’ under the general category. Click next and browse to the folder where project has been extracted to and click finish.

Build the project by selecting project menu -> build project .

Download the executable to your target hardware by right-clicking on eddystone.hex under binaries and flash to device. In the flash programmer dialog, click program.

Once the flash programming completes, press reset on the WSTK board. The Eddystone beacon should now be broadcasting. You can verify this with a modile device app such as BeaconScanner.

 

Conclusion

This article is a brief introduction to an implementation of the Eddystone-URL packet format, for more detailed information please see the links below.

 

Additional Reading

More information on the Eddystone-URL packet type can be found here

https://github.com/google/eddystone/tree/master/eddystone-url

Detailed information on the BlueGecko API is available in the reference manual

http://www.silabs.com/Support%20Documents/RegisteredDocs/BluetoothSmart_APIRefMan.pdf

 

  • Knowledge Base Articles
  • Bluetooth Low Energy
  • Bluetooth Classic