Play with BLE(1)_Eddystone beacon

1 Introduction

Do you believe that two commands can turn your broken phone into a Beacon node? If you don't believe me, just read on.

Through the previous articles related to "Bluetooth Protocol Analysis", especially " Bluetooth Protocol Analysis (3)_Bluetooth Low Energy (BLE) Protocol Stack Introduction ", I believe that everyone has a basic understanding of the BLE protocol stack. Before continuing the follow-up analysis, it is necessary for us to change our perspective, from the application point of view, with a "play" mentality, to learn and understand the working principle of BLE, and use it as an introduction and entry for subsequent analysis articles. That's why I wrote the "Fun with BLE" series of articles.

The reason why it is named "Fun" is because I will not cover any technical details in these articles, but just describe some operation steps and popularize some usage scenarios related to Bluetooth BLE.

In addition, because the Bluetooth protocol stack used by the Linux platform is Bluez [1] , the Bluez protocol stack provides many convenient, flexible and powerful testing tools (such as hcitool, gatttool, etc.). So, to keep things simple, I try to use these testing tools as much as possible without introducing complex programming techniques when writing the "playing" series of articles. From another point of view, the "Fun" series of articles is also a summary of some steps of the BLE test, which is convenient for yourself and others to consult.

This article is the first of the "Fun" series of articles. With two simple hcitool commands, you can turn your mobile phone or development board into a BLE Beacon node, and then experience the simplicity and magic of BLE technology.

2. Introduction to Eddystone beacon

Eddystone beacon is a low-power Bluetooth Beacon technology released by Google in July 2015, an open source, multi-platform, and challenging platform iBeacon.

This article will go straight to the topic and introduce how to turn your mobile phone or development board into an Eddystone beacon node, and use the Android APP to test this node. If readers need to know the technical details of Eddystone beacon, please refer to the source code and documentation of Eddystone on Github [2] , or refer to the subsequent analysis articles on this site.

3. Create Eddystone beacon

To create one (or more, if you like) Eddystone beacon, the following conditions and steps are required.

1) A hardware capable of Bluetooth 4.0 (and above), running a Linux system, having a Bluez protocol stack, and running the hcitool command, which can be:

A PC running a Linux system (such as Ubuntu, Debian), with Bluetooth 4.0 or above, or a dongle with Bluetooth 4.0;

A development board with Bluetooth 4.0 function, such as Raspberry Pi 3, or Raspberry Pi 2 + Bluetooth 4.0 dongle;

An Android mobile phone with Bluetooth 4.0 function (the mobile phones that everyone uses now generally support Bluetooth 4.0, but the Android version is preferably below 4.3, because Android above 4.3 no longer uses the Bluez protocol stack);

other.

The example used in this article is a broken mobile phone (Coolpad 5872), which just meets the conditions. Ha ha ha, a broken mobile phone is good! !

2) A tablet (or mobile phone, or development board) with Bluetooth 4.0 (and above) function running Android 5.1 system, used to run the APP for testing

This condition is not easy to meet. Try to find it. If you can't find it, you can leave a message. I will recommend some development boards, such as the S900 96board (this is not an advertisement, because no one pays me advertising fees, huh).

3) Take my mobile phone as an example, turn on the bluetooth function, use adb to log in to the shell (if it is in other environments, no need for adb), enter the following two commands:

# enable BLE advertising 
hcitool -i hci0 cmd 0x08 0x000A 01

# set advertising data to Eddystone UUID 
hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 06 03 03 aa fe 17 16 aa fe 00 -10 00 01 02 03 04 05 06 07 08 09 0a 0b 0e 0f 00 00 00 00

That's right, don't be surprised, your phone has become an Eddystone beacon node. This article will not explain these two magical commands (the follow-up Bluetooth analysis article will take this as an example to analyze the advertising function of Bluetooth BLE, so don't worry about it).

Next let's download an APK on Android to see our results.

4. Use the Android APP to test the Beacon function

4.1 APP download

Android has Bluetooth 4.0 capabilities, and is Android 5.1 (and later). There are two APKs for testing (that I know of):

1)iBeacon & Eddystone Scanner

Developed by Google, it can be downloaded and run from Google Play (address: https://play.google.com/store/apps/details?id=de.flurp.beaconscanner.app&hl=zh_CN ).

If your Android device cannot access Google Play, you can also download the APK to your computer through the online APK download website ( https://apkpure.com/ ) and install it.

If you can't download it anyway, find me, I will share the downloaded APK.

2)EddystoneValidator

Eddystone's github production, the URL is as follows:

https://github.com/google/eddystone/releases/download/v1.0.0/EddystoneValidator-release-1.0.0.apk

4.2 Install APP and test

This article takes "iBeacon & Eddystone Scanner" as an example, the other one I don't have screenshots, so I won't describe it. After the installation is successful, open it, click the scan button in the lower right corner, and the list of Beacon devices will be scanned, as follows:

1

Click on the Beacon device in the list, and the following status interface will appear:

2

 

The specific meaning of each state will not be explained too much in this article, and everyone will understand it after playing.

5. Reference Documentation

[1] bluez,http://www.bluez.org/

[2] Eddystone beacon spec,https://github.com/google/eddystone

[3] Google beacon developer page, https://developers.google.com/beacons/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325416227&siteId=291194637