iBeacons are bluetooth devices that broadcast their information (position…) so that bluetooth aware devices (like smartphones, Raspberry Pi…) are able to detect them and get their information.

Learn more on Wikipedia (https://en.wikipedia.org/wiki/IBeacon).

In this tutorial, we show how to get the distance of an Estimote beacon (http://estimote.com) from the Pi.

Add a Bluetooth 4.0 dongle

You need to have a Bluetooth 4.0 dongle (you can buy it here pimoroni.com or adafru.it) and it should be plugged in a USB port of the TimeSquAir

Remember that only Pi3 has a bluetooth feature! add a dongle for previous Pi releases.

What to do with beacons

Some ideas:

  • Put a beacon in the bag of your kid and get an email when he comes back from school
  • Trigger some security when you go far your desk
  • Add a beacon to an important key and lights up a red light while the key is not back

Install the nodes

Click the right menu in the Node-RED web page. Choose Manage Palette then Install.

  • Type ttb-ibeacon in the edit box and click the OK button.

  • Wait for the install

The installation may take up to 5 minutes (a progress bar shows the progress), depending on what is already installed on your device.

  • Then reboot and then refresh the web browser page.

  • Browse the palette and look at the newly added nodes.

A first simple flow

Build that simple flow. It will scan around and create a node for each found beacon:

When you click “Go”, one node per beacon will be added to the workspace. The big number on it is some identifier.

Use a beacon node

Double click it to change its name to something better (we suppose here that the beacon is wrapped to the cat), then add a Go and Display node:

Do not forget to activate (with the button with the same name). The blue bullets will then disappear.

Then the display tab gets filled with

There is one line each time the beacon sends a position information (quite often).

The message on the flow contains more information: use a debug node instead of the display to see the distance in meter into the payload:

The debug node also allows to see the complete msg:

Do not use “accuracy” property which seems inapropriate

Trigger events

The distance value in the payload can be used to trigger events.

Use a switch node and add a conditionabout the distance of the beacon:

and use it to trigger a light when the cat comes near its food!

Back to top