Triggering action based on proximity to iBeacon

by Blue Charm

Version 1 (December 13, 2021)

Download (432 downloads)

This simple flow shows how to trigger actions based on proximity to a specific iBeacon based on the MAC address of that beacon. In this example, the actions triggered are simple notifications and sounds, but of course you can modify this to suit your needs, e.g. play music, turn on lights, etc.

The Active Low Energy Bluetooth scan setting works best for this flow. You should get a report of in range or out of range every eleven seconds or so with this setting.

I also added a second block for checking the rssi signal strength of the beacon. This allows you to make more subtle adjustments rather than just a simple "in range" or "out of range" binary decision. For example, if you want the beacon to be not only in range but also super close to the phone.

I used my own Blue Charm BC021 beacon from Amazon for this, but any standard iBeacon should work the same. In fact, anything with a fixed scannable MAC should work also...I think.

Note: the app tended to give occasional false positives or false negatives. I'm not sure why but when I adjusted the interval of the beacon from 1000ms to 200ms, the false reports completely stopped. Unless you plan to use a USB-powered beacon (no batteries needed), this fast/short interval will wear out the beacon battery faster than normal. There might be a way to set the interval back to 1000ms and then have the app check twice before it sends the notification. For example, rather than notifying out of range if the app doesn't see the beacon's MAC one time, add another set of blocks to double check before sending the notification.

To customize this flow, just change the MAC address to match your iBeacon's MAC. Also you can adjust the minimum rssi needed from "> -85" to whatever you prefer.

5.0 average rating from 1 reviews

5 stars
1
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.