2. How BLE communication works?
Peripheral Devices
● act like servers
Central Devices
● act like clients
Publish & Subscribe
● Peripheral publish
● Central subscribe, by reading or letting
peripheral notify when changes happen
3. BLE: Advertise and Connect
Advertising is one way: peripheral -> central
Packets can be up to 47 bytes
advertising communication
channels the access address
is always 0x8E89BED6
4. BLE: Advertise and Connect
After peripheral is discovered,
connection can be established
Central can then read or
write to peripheral
(GATT)
get temp/
humidity
readings
temp: x
humidity: y
set desired temp
temp: x
5. Beacons only advertise
Transmit packets of data in regular intervals, that gets
picked up by devices like smartphones
Data coming from an Estimote beacon:
You can capture such data with PacketLogger
(Download in Xcode/more developer tools
6. iBeacon advertisement format is
fixed by Apple
Data coming from an
Estimote beacon:
beacons in a chain of stores:
same UUID
beacons in one of the stores:
same Major #
in one store, every beacon has a
different Minor #
TX power is strength of signal used to
estimate distance
7. Beacon? iBeacon??
Every iBeacon is a Beacon.
iBeacon is built into iOS 7 that let devices
constantly scan for nearby bluetooth devices.
When iBeacon identifies a beacon, it can wake
up an app even if app is closed.
For this to work:
● bluetooth need to be on
● app using iBeacon needs to
be downloaded
● need to accept location
services in the app
8. Working with iBeacon
Building apps that are responsive to iBeacon:
Use Apple’s Core Location API
iBeacon scanning apps:
iOS: iB Locator
Android: iBeacon Scanner
These can be turned into iBeacon
iPhone 4S+, Android 5.0, Bluetooth 4 laptops, Raspberry Pi
11. Thank you!
References:
How do iBeacons work
Tom’s BLE docs from the BLE workshop
iOS Developer Library Core Bluetooth Programming
Guide
@OhJia
Editor's Notes
peripheral: provide data from sensors as readable and provide read/writable chars to control motors, lights, etc (like a server)
central: read and write data from peripherals (like a client)
multiple centrals can read from same peripheral
For advertisement communication channels, the access address is always 0x8E89BED6. For data channels, it is different for each connection.
The PDU in turn has its own header (2 bytes: size of the payload and its type – whether the device supports connections, etc.) and the actual payload (up to 37 bytes).
Finally, the first 6 bytes of the payload are the MAC address of the device, and the actual information can have up to 31 bytes
GATT is an acronym for the Generic Attribute Profile, and it defines the way that two Bluetooth Low Energy devices transfer data back and forth using concepts called Servicesand Characteristics. It makes use of a generic data protocol called the Attribute Protocol (ATT), which is used to store Services, Characteristics and related data in a simple lookup table using 16-bit IDs for each entry in the table.
GATT comes into play once a dedicated connection is established between two devices, meaning that you have already gone through the advertising process governed by GAP.
For advertisement communication channels, the access address is always 0x8E89BED6. For data channels, it is different for each connection.
The PDU in turn has its own header (2 bytes: size of the payload and its type – whether the device supports connections, etc.) and the actual payload (up to 37 bytes).
Finally, the first 6 bytes of the payload are the MAC address of the device, and the actual information can have up to 31 bytes
iBeacon prefix
- proximity UUID: beacons in a chain of store -> same UUID
- major number: group related set -> beacons in one store -> same major number
- minor number: individual beacons - > where customer is in the store
- TX power: strength of signal measured at 1 meter from the device, strength of signal decreases as get further, iOS calculate the distance
obstacles such as furniture, people or communication congestion can weaken the signal. distance is estimate
every iBeacon is Beacon, not every Beacon is iBeacon
anyone can build Beacon device, need Apple certify to build iBeacon device
any platform that support BLE can use Beacon and iBeacon
purpose: Apple control end user experience of beacon-enabled apps on iOS and to market beacon tech as something Apple developed
iBeacon is built into iOS 7 that let devices constantly scan for nearby bluetooth devices. When iBeacon identifies a beacon, can wake up app even if app is closed. iPhones and iPads can be beacons to wake up apps in other iPhones.
iBeacons receive notification from downloaded apps and when bluetooth is turned on, also need to accept location services