Puck.js and 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.

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 Goo.gl URL shortener
  • Create a shortened URL and then copy it into a require("ble_eddystone").advertise("goo.gl/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:

  ], {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:


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