Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar
Master Guru

People were asking me when you could throw some more acronyms into an article. So I did that.

iBeacons are tiny devices that are broadcasting over Bluetooth Low Energy (BLE) that are very good for advertising and for broadcasting proximity. I have been thinking of the retail space so I purchased a beacon, got a beacon simulator on my phone and found a really cool gateway device. It reads the BLE transmissions from these devices, packages them as JSON MQTT messages and sends them over WIFI to a MQTT Broker of your choice. I am using a cloud hosted MQTT broker to hold these and then Apache NiFi subscribes to these messages. This can happen amazingly fast as MQTT is very light weight, NIFI is fast and BLE is fast. These tiny messages are constantly advertising their identity and other information. With multiple beacons in a building, store, room, facility; you can see who is close to where.

As you might expect there's multiple standards for this, iBeacon is Apple's and Google Eddystone. Fortunately this gateway works with both and so can you. Walk into the Physical Web.

Use Cases

Happy Bubbles Technology

14941-happybubblesv2.jpg

14942-ibeacondevice.jpg

14943-beacondataflow.png

In Apache NiFi, it doesn't matter the data or location, it's easy as pie to ingest Beacon data via MQTT and store it in ORC files for Hive table queries.

14944-beaconzeppelindata.png

Easy to visualize and analyze the data in Apache Zeppelin against these Hive tables.

What I like about this gateway from Happy Bubble technology besides the awesome Hippo logo is that this gateway is dead simple to setup. Plug it in, wait a bit, connect to it's WIFI, set WIFI and MQTT settings. Then you are running! They also provide an open source server you can use to see the data. If BLE messages are ibeacon format, they will get one JSON format. If they are Google Eddystone format it's a second one. And if it's something else, it will get a generic format. I have three listeners in NiFi to grab them all.

14945-beaconweb7.png

14946-beacon8.png

14947-beacon9.png

Example Messages

happy-bubbles-ble
{"rssi":-63, "heap_free":27912}

{"hostname": "happy-bubbles-ble",
 "mac": "fa909c522836",
 "rssi": -51,
 "is_scan_response": "1",
 "type": "0",
 "data": "020a000816f0ff640000000011094d696e69426561636f6e5f3331303033"}
 

{"hostname": "happy-bubbles-ble",
 "beacon_type": "ibeacon",
 "mac": "fa909c522836",
 "rssi": -51,
 "uuid": "e2c56db5dffb48d2b060d0f5a71096e0",
 "major": "0000",
 "minor": "0000",
 "tx_power": "c5"}

Phones

There's a great free application for IPhone called Locate Beacon that let's you simulate beacons. This is great for testing.

For the inexpensive beacon from Happy Bubbles I bought it is a minew MS49_nrf51822 and there's an app for that called BeaconSET. This will let you set properties and see it over your phone's BlueTooth.

DDL

CREATE EXTERNAL TABLE IF NOT EXISTS beaconstatus (rssi INT, heap_free INT) 
STORED AS ORC  LOCATION '/beacons';

CREATE EXTERNAL TABLE IF NOT EXISTS ibeacon (hostname STRING, beacon_type STRING, mac STRING, rssi INT, uuid STRING, major STRING, minor STRING, tx_power STRING) 
STORED AS ORC  LOCATION '/beacons/ibeacon';

CREATE EXTERNAL TABLE IF NOT EXISTS beacongateway (hostname STRING, mac STRING, rssi INT, is_scan_response STRING, type STRING, data STRING) 
STORED AS ORC  LOCATION '/beacons/gateway';

Reference

https://en.wikipedia.org/wiki/IBeacon

https://en.wikipedia.org/wiki/Bluetooth_low_energy

http://developer.estimote.com/ibeacon/tutorial/part-3-ranging-beacons/

https://en.wikipedia.org/wiki/MQTT

https://developers.google.com/beacons/proximity/guides

https://www.beaconzone.co.uk/BeaconTriggerDataAndServers

https://developer.apple.com/ibeacon/

https://developers.google.com/beacons/

https://www.happybubbles.tech/presence/detector

https://www.happybubbles.tech/presence/docs/setup/

https://github.com/happy-bubbles/

https://itunes.apple.com/us/app/locate-beacon/id738709014?mt=8

4,636 Views