Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.
SensorTag with iBeacon
- 1 Introduction
- 2 Update SensorTag Firmware
- 3 Configuring the iBeacon parameters
- 4 Run SensorTag with iBeacon
- 5 Compiling the iBeacon source code – Using IAR
This wiki provides necessary steps to explore the iBeacon technology using the SensorTag. Within this wiki page, using iBeacon technology on the SensorTag will be referred to as iBeacon Mode. To use iBeacon on the SensorTag, Apple require you to be an iBeacon licensee. To apply for an iBeacon licensee go to the Apple MFI program and fill in the application form. After you are approved, you can request access to the iBeacon software for SensorTag at the SensorTag SW page
To enable iBeacon Mode, the SensorTag firmware must be updated.
The most easiest and convenient way is to use a Bluetooth SMART Ready device (iPhone 4S/5/5C/5S etc.) to do an Over-the-Air Download (OAD) which is described below
If you do not have a SensorTag, it can be ordered here.
Update SensorTag Firmware
- iPhone 4S/5/5C/5S or iPad (Bluetooth SMART Ready)
- SensorTag app version 3.4 or later.
If you have the compiled object code (*.bin) this must be loaded into the SensorTag app. Connect the phone to a PC and start iTunes to update the file. This is done by clicking the SensorTag app and load the files in the "SensorTag Documents" window. Load both the A and B version of the file.
Update to the latest SensorTag app version and perform a firmware update on the SensorTag once it’s connected (You will be prompted). If not prompted you may have a custom or old firmware on the SensorTag that doesn’t include OAD Profile and thereby you cannot use this method. When prompted, click "Upgrade" and follow this procedure:
In the upgrade screen select "Shared files" and select the binary file with iBeacon support
After completing the upgrade the SensorTag is now enabled to support iBeacon.
Configuring the iBeacon parameters
The iBeacon configuration data can be modified in the SensorTag app. Note that this can only be done while the SensorTag is in “normal” BLE mode. To access the configuration data connect to the SensorTag and go to the sensor data screen.
In this screen the minor and major number of the iBeacon can be configured. It is important to give a unique minor number for each SensorTag that is used as an iBeacon. If you are using more than one SensorTag as iBeacon you will need to configure different “minor” number in the beacon service. Let the first SensorTag be minor 0, and the second minor 1.
Run SensorTag with iBeacon
Default mode, the SensorTag resides in deep sleep (~0.5µA) and can be woken up by pressing the side button. Pressing the button will toggle advertising on and off. If the side button is held down for 2 second, the SensorTag will switch to iBeacon Mode. When doing so, the SensorTag will broadcast one beacon packet on the three advertising channels each 100ms if no other beacon interval has been set.When the SensorTag is in iBeacon mode the LED will blink every 10 second.
Locationing with iBeacon app
Start the Locationing with iBeacon app, If you have started the iBeacon on the SensorTag it will now be displayed on the map in the app.
In the app you can move the iBeacon, change the scale of the signal, give the iBeacon custom names, or enable actions when the phone approaches an iBeacon. The red rings around the iBeacon shows if the phone is far, near, or in immediate distance from the iBeacon. Note that any changes made on the iBeacon in the locationing app only apply to the app, the iBeacon is not able to receive commands from the phone while iBeacon is enabled.
Turning off an iBeacon
When you are done testing with the iBeacon it can be turned off by holding the side button for 5 seconds, the SensorTag will now change to normal BLE and search for a phone to connect to for 90 seconds. In this period the LED will blink quickly. After this period the SensorTag will enter power down mode until the side button is pressed again.
BLE Packet Sniffer
A CC2540 USB Dongle can be used as a BLE sniffer and monitor iBeacon packets as well as the communication when connected to the SensorTag. The SmartRF Protocol Packet Sniffer software can downloaded here.
Compiling the iBeacon source code – Using IAR
It’s possible to compile and program the SensorTag with the CC2541DK-Sensor build of the SensorTag Project. Note that when doing so, the OAD Profile is not included, so no further OAD update can be made.
- SensorTag Beacon Software Package v1.0 - Available Upon Request
- 1 x CC Debugger (estore.ti.com)
- BLE Stack v1.4 (www.ti.com/ble-stack)
The SensorTag Beacon Software Package v1.0 includes:
- Switch function to be able to switch between SensorTag standard mode and iBeacon mode
- Low power LED Blink functionality for iBeacon mode.
- Default beacon data
- Beacon Config Service
Unzip and patch to the default install directory: C:\Texas Instruments\BLE-CC254x-1.4.0
The project is then located at \Projects\ble\SensorTag_Beacon\CC2541DB and is called SensorTag Beacon. Open SensorTag.eww project with IAR. There are three builds available for OAD update:
When programming the CC2541DK-Sensor build, the original SensorTag Test Service will be included along with characteristic descriptors for the Beacon Config Service (BCS).
Note that you can modify the CC2541DK-Sensor-OAD-ImgA/B builds and generate custom .bin files that can be used to perform OAD on a SensorTag. When compiling OAD images, test service is removed as well as the beacon service descriptors due to size constraints. After compiling, the bin files are found in \CC2541DB\CC2541DK-Sensor-OAD-ImgA\Exe