Creating Bluetooth Beacon with Raspberry Pi by using Bluetooth Developer Studio


This post shows how to make a Raspberry Pi a Bluetooth Beacon by using Bluetooth Developer Studio and its Beacon plugin. Bluetooth Developer Studio is a free application development tool from Bluetooth SIG and with Beacon plugin, it generates a script file which makes a Raspberry Pi a Bluetooth beacon.

The steps below basically follow a tutorial (Turning your Raspberry Pi into a Beacon using Bluetooth Developer Studio v1.0) which is included in Beacon plugin for Bluetooth Developer Studio but are simplified for my learning purpose. Please note, this is not very practical but rather kind of “getting started with” Bluetooth Developer Studio and Bluetooth Beacon.

Here are the contents of this post.

 

Prerequisites

  • Raspberry Pi
    Assuming your Raspberry Pi is up and running. If it’s not already, please set it up first. Raspberry Pi 3 or Raspberry Pi Zero W is recommended since they have a built-in Bluetooth chip. If you want to use other model which doesn’t have Bluetooth chip, you need a Bluetooth Low Energy USB dongle such as this.
  • Windows PC (Windows 7 or higher)
    Bluetooth Developer Studio works on only Windows 7 and higher.

 

Steps
1. Install Bluetooth Developer Studio and Beacon plugin
1-1. Download Bluetooth Developer Studio from here. As of 9/2/2017, the latest version is 1.1. It requires registration to download.

1-2. Install Bluetooth Developer Studio by following the Setup wizard.

1-3. Download Beacon plugin from here.

1-4. Unzip the downloaded file and go to \beacon-1\tutorial\RaspberryPi\starter-files.

1-5. Then, copy “beacon-plugin” folder into Bluetooth Developer Studio’s plugins folder.
(e.g. “C:\Program Files (x86)\Bluetooth SIG\Bluetooth Developer Studio\Plugins”)

1-6. Go into the newly copied folder (i.e. “beacon-plugin”) and open “plugin.js” with a text editor.

1-7. Search the lines below and change “true” to “false” on the if statement.

* Note: Change the permissions to modify the file if needed.

 

2. Create Beacon Profile
2-1. Launch Bluetooth Developer Studio.

2-2. Create a new project from “FILE” > “NEW”

2-3. Enter “Beacon” in the “NAME” field of “NEW PROJECT” window.

2-4. Enter “org.bds.beacon” in the “NAMESPACE” field, then click “OK” button.

2-5. Click on “New Profile”, change the name to “Beacon”, then click “SAVE”.

2-6. Click on the “Custom Service” button.

2-7. Click on “Beacon new service” and change it to “Beacon”, then, “SAVE”.

2-8. Click on “GAP” button

2-9. Enter beacon data as below and click on “DONE”.
TX Power : “-127″
Manufacturer Specific Data” : “ffeeddccbbaa99887766554433221100facefeed”

2-10. From the menu bar, select “FILE” > “SAVE” to save the profile.

 

3. Generate Beacon script

3-1. From the top menu, select “TOOLS” > “GENERATE CODE”.

3-2. Select “Beacon” plugin and click on “GENERATE”.

 

3-3. After “Code generated successfully”, check on “Open output location when finished”, then click on “FINISH”.

The folder which contains the generated script file will be opened automatically.

 

4. Execute Beacon script on Raspberry Pi

4-1. Copy the generated “Beacon.sh” script to Raspberry Pi’s home directory. (e.g. via USB drive, scp)

4-2. Open terminal on Raspberry Pi and add execute access to the script.

4-3. Run the script.

If it worked you should be able to see output such as:

If you get an error like,

and/or,

that is because the script file has Windows style line endings and bash doesn’t understand it. You can fix the error by changing the line endings from Windows style to Unix style by the following command.

 

5. Verify
You can check if it’s really broadcasting the beacon data by using a smartphone app such as “BLE Scanner” on Android.

 

 

Sponsor Link

Leave a Reply

Your email address will not be published. Required fields are marked *