Reading IBeacons using a UWP app on your Raspberry Pi

As you probably know, Bluetooth low energy (BT LE)  is a wireless personal area network technology which uses a minimum of power to broadcast messages to receivers nearby.

Bluetooth LE is a common standard but it is most popular under the name of IBeacons. IBeacons is a protocol coming from Apple, so it is just a class of Bluetooth low energy (LE) devices that broadcast their identifier to nearby portable electronic devices.

IBeacons can basically exchange two parts of data: that unique identifier and the signal strength. This makes it possible to figure out the (fixed) position of the IBeacon. And if you receive the signals of multiple beacons you can triangulate your own position between them.

In 2015 Google launched a competing, but similar, beacon standard called Eddystone. It has a richer functionality because it can exchange more information.

Far less known is that Windows 10 also supports the beacon technology, it’s not just Apple and Android which are having fun with it. In Windows, there is this Windows.Devices.Bluetooth.Advertisement library:
“It allows apps to send and receive Bluetooth Low Energy (LE) advertisements.”

A sample app is available at github. And if you run this UWP app on multiple Windows 10 devices you can see that a Windows 10 device can interact both as sender or receiver. And this can be done actively (in the foreground) and as a background process. This is all based on Bluetooth LE.

And the best thing is: it also supports IBeacons and Eddystone beacons!

For example, identity these beacons with the Bluetooth beacon interactor app from the Windows Store. Yes, you can detect both IBeacons and Eddystone beacons with it. This app is based on this GitHub code, the programmer actively supports it. He even provided a nice NuGet package.

So let’s build a UWP app ourself. This is not that hard, the example code is already provided by the programmer of the NuGet package (copy from here).

Note that this example code needs the nuget package and you will have to enable the Bluetooth capability. If you run it on your PC with an IBeacon nearby, you will see something like this:

win10 Ibeacon ondersteuning

Nice, I can think about so many projects I want to do with just this technology 🙂

But can it run also on a Raspberry pi? The simplest answer is a question: does the Raspberry Pi support Low energy? Yes, it is supported (Bluetooth Low Energy (BLE) Generic Attribute Profile (GATT)).

The next issue is: does Windows 10 IoT core has drivers for it? Or, which dongles are supported on the Pi? At this time Microsoft supports two kinds of dongles:

1. CSR Mini USB Bluetooth V4.0 Adapter
2. ORICO BTA-403 Mini Bluetooth 4.0 USB Dongle

But I have a problem with this CSR support.

Because I actually have a CSR dongle. It works fine in general and I use it all the time on my Raspberry Pi to communicate with Bluetooth dongles like the HC-05 and HC-06. But when I tried the IBeacon example, nothing happened. No dongle was recognized in the neighbourhood.

In the end, I bought this Orico dongle. And I tried the example with that one. The Orico recognizes beacons and it recognizes them on the Raspberry Pi.

Here is a picture to show both of the dongles. On top of these dongles, on both of them, “Bluetooth 4.0” is written.

WP_20160327_00_35_36_Pro_LI-crop

It’s very annoying, Bluetooth 4.0 does not automatically means Bluetooth LE. If you have better experiences with these or other dongles, please submit it in the comments.

Here’s a picture of my 5-inch screen on my Rpi. It shows the beacon found and the signal strength too.

9584fa28-7ebf-42e2-af22-c8807688f9ad

This is a good base for many projects involving IBeacon (and Eddystone) support using the Raspberry Pi and Windows 10 IoT Core.

Advertenties