Mini PC Raspberry Pi 3 was released quite recently, and very shortly after the appearance of the system on the market based on it began to create interesting projects. One of them, very specific - is the transformation of the "raspberry" in the Eddystone URL beacon.
Eddystone is Google’s own open source beacon format (the specification is here ), and this technology is compatible with both Android OS and iOS. In order for this to work, you need to keep Bluetooth LE permanently on your smartphone - this is probably the only condition. All that is required to turn an RPI 3 into an Eddystone URL beacon is the mini PC itself, the power supply for it and the SD card. The rest is under the cut. So, a little more about Eddystone. Its advantage is the ability to send three packets instead of one. This is a UID, URL, telemetry.
Eddystone-uid. This is the same identifier - analogue of iBeacon (UUID, major, minor). It consists of 2 parts: Namespace ID (10 bytes), Instance ID (6 bytes).
Eddystone-URL. Now the beacons broadcast the URL to 18 bytes. The problem of long URLs will help us solve URL shorteners. For example, a service from the same Google goo.gl. From this address touchin.ru/portfolio/squawk you can get a short version of goo.gl/PidTf3. This is a major innovation, a little later I will explain why.
Eddystone-TLM (Telemetry). The following beacon data is available:
charge level
the number of packets sent since connecting to the power supply
lighthouse activity time since connecting to power supply
temperature
')
The phone that receives these packets can either warn you of the receipt of information of a particular type, or perform some kind of action.
$ sudo nmap -sP 192.168.2.0/24 or $ arp -a |grep "b8: 27"
4. Connect to Raspberry:
$ ssh pi @ <the_ip_of_your_pi>
5. We are looking for information on the hciconfig command
$ hciconfig -h
6. Turn on the Bluetooth device
pi @ raspberrypi: ~ $ sudo hciconfig hci0 up
7. Set the mode "advertise and not-connectable"
pi @ raspberrypi: ~ $ sudo hciconfig hci0 leadv 3
8. Enter data for Beacon
pi @ raspberrypi: ~ $ sudo hcitool -i hci0 cmd 0x08 0x0008 17 02 01 06 03 03 aa fe 0f 16 aa fe 10 00 02 77 65 62 67 61 7a 65 72 08 00 00 00 00 00 00 00 00
We broadcast:
Option
Description
0x08
#OGF = Operation Group Field = Bluetooth Command Group = 0x08
0x0008
#OCF = Operation Command Field = HCI_LE_Set_Advertising_Data = 0x0008
17
Length The hexadecimal 17 converts to 23 decimal which is the number of bytes that follow
02
Length
01
Flags data type value
06
Flags data
03
Length
03
Complete list of 16-bit Service UUIDs data type value
aa
16-bit Eddystone UUID
fe
16-bit Eddystone UUID
0f
Length The hexadecimal 0f converts to 15 decimal which is the number of bytes that follow
sixteen
Service Data data type value
aa
16-bit Eddystone UUID
fe
16-bit Eddystone UUID
ten
Frame Type = URL
00
TX Power (this should be calibrated)
02
Scheme URL (http: // = 0x02)
77
'w' in hexadecimal
65
'e' in hexadecimal
62
'b' in hexadecimal
67
'g' in hexadecimal
61
'a' in hexadecimal
7a
'z' in hexadecimal
65
'e' in hexadecimal
72
'r' in hexadecimal
08
.org (.org = 0x08)
00
00
00
00
00
00
00
00
The example above allows you to send the blog address of the author of the idea for Eddystone and Malinka. If you need to send your URL, change it here .
To detect the Raspberry Pi beacon from iPhone, use the following video tutorial:
Android should do everything automatically, provided that Android OS 4.3.2 or newer is available, bluetooth enabled, geologic, and permission to determine the location for Chrome. You can also use the web application to make it all work immediately and without problems.