Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.
This guide contains steps to create a Bluetooth* Smart/Low Energy (BLE) iBeacon* application that runs on an Intel® Galileo board or Intel® Edison board, advertising the board's presence as a BLE device. Once the application is running, you can use a mobile app to scan for and measure the distance between the mobile device and your board. The source code for the BLE iBeacon application that runs on your board can be found here: https://github.com/gomobile/iotapp-template-ble-ibeacon.
This example demonstrates the usefulness of BLE iBeacon technology for identifying the location of a BLE device (in this case, your board) in reference to a mobile device's location. For design considerations, including in-depth technical information about this application, visit https://github.com/gomobile/iotapp-template-ble-peripheral#design-considerations. This project was tested on an Intel® Edison board with the Arduino* expansion board.
Since all communication between the mobile device and your board is via Bluetooth Low Energy, they do not have to be on the same wireless network. The Intel® XDK IoT Edition and your board, however, must be on the same network.
Requirements
Creating a new project with BLE iBeacon functionality
This section contains steps to use sample code to advertise your board's presence via BLE.
- Run the Intel XDK IoT Edition.
- In the top left, click the Projects tab.
- Click Start a New Project.
- Under Internet of Things Embedded Application, click Templates.
- From the right, click (BLE) BLE-iBeacon. Click Continue.
- Type a name for the project in the Project Name field, then click Create. Your new project opens.
Enabling BLE on your board
This section contains steps to enable BLE on your board.
In the steps below, you can connect to your board using the SSH Terminal or Serial Terminal tabs within the Intel XDK IoT Edition. For detailed steps to create a serial terminal connection to your board outside of the Intel XDK IoT Edition, see the following:
- Within an SSH or serial terminal connection, type the following commands:
rfkill unblock bluetooth
hciconfig hci0 up
- Enter the following command to open the base-feeds.conf file in the vi text editor:
vi /etc/opkg/base-feeds.conf
- Insert the following lines into base-feeds.conf:
src/gz all http:
src/gz edison http:
src/gz core2-32 http:
Save your changes and exit the editor. For more information on the vi editor, visit http://www.cs.colostate.edu/helpdocs/vi.html. - To get the bleno Node.js package to work successfully, enter the following commands:
rfkill unblock bluetooth
killall bluetoothd
hciconfig hci0 up
Uploading the BLE-iBeacon Node.js* application to your board
This section contains steps to build, upload, and run the relevant code to advertise, read and write data via the Bluetooth Low Energy module.
- In the bottom toolbar of the Intel XDK IoT Edition, click the Upload icon to upload the project to your board.
- Click the Run icon to run your project.
Note: If the bottom console window displays a message about being unable to find MRAA, you must update the MRAA library on your board. To do so, click the Manage your daemon/IoT device icon in the bottom right of the Intel XDK IoT Edition, then select Update libraries on board.
Testing your application
The recommended way to test this application is to download and use a mobile application that allows you to view your nearby board (iBeacon), as well as other BLE iBeacon devices. Use Locate Beacon, which lets you find any nearby beacon with real-time distance estimates:
References