Eddystone Beacons

Note: For iBeacons, see this page

Eddystone is an open beacon format from Google that allows you to transmit a URL that will appear as a notification on a user's phone.

Android phones > 4.4 will have support - but it may need enabling. See here for more information.

Note: Google has now disabled Eddystone notifications because of abuse by advertisers, so Eddystone devices will no longer appear as Android Notifications.

All you need to do to use it is use the ble_eddystone (About Modules) module:


From then on, Puck.js will broadcast the URL to anything that will listen. It is helpful if you use a descriptive title on the web page you're using, as this will appear in the notification area.

Note: Since you can't advertise while you're connected via Bluetooth LE, you will have to disconnect from your Puck for it to start transmitting.

While Puck.js can transmit pretty much anything, your phone will only notify you for certain URLs.

The URLs:

Realistically the easiest way to do this is to use Goo.gl as a URL shortener. You can still use # to pass data - for instance https://goo.gl/D8sjLK#42.

While you only have 17 characters, https://, www., .com, .org, .edu, .net, .info, .biz and .gov in URLs are automatically shortened. So for example require("ble_eddystone").advertise("https://www.esprino.com/Puck.js") is still fine, even if it would appear to be far too long.

To turn Eddystone advertising off simply call NRF.setAdvertising({});

Note: While advertising Eddystone, Puck.js will not advertise its own name, so will not be connectable.

An Example

  • Go to the Meme Generator website
  • Generate a suitable image and copy the (https) URL
  • Go to the Bitly](https://bitly.com/) URL shortener
  • Create a shortened URL and then copy it into a require("ble_eddystone").advertise("https://bit.ly/abcdef"); command
  • Once executed (and you have disconnected), Puck.js will start advertising Eddystone
  • You can also call NRF.setAdvertising({}); to stop advertising


You can also use require("ble_eddystone").get with the same options as advertise to get the raw array of advertising data to use. You can then feed this directy into NRF.setAdvertising()'s first argument and can set other options such as advertising rate.

In Puck.js 1v92 and later you can also supply an array of advertising data:

  {} // this will add a 'normal' advertising packet showing name/etc
], {interval:100});

In which case Puck.js will send each advertising packet in turn.

This library's default behaviour is to overwrite Puck.js's advertising (name, services, etc) with Eddystone. However you can easily add the advertising in addition to Espruino's existing advertising by setting the Eddystone advertising inside the Advertising Scan Response:


EddyStone UUID

Eddystone URLs are just one type of Eddystone advertising - you can also use UUIDs using ble_eddystone_uid - you just need to supply namespace and instance arrays as shown on https://github.com/google/eddystone/tree/master/eddystone-uid :

  require("ble_eddystone_uid").get([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], // namespace
                                   [0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), // instance
  {} // this will add a 'normal' advertising packet showing name/etc
], {interval:100});

// or 

        [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],  // namespace
        [0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); // instance

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.