labs.mediatek.com Philip Handschin Technical Consultant Bluetooth Low Energy communication with MediaTek LinkIt™ ONE
labs.mediatek.com
Philip Handschin Technical Consultant
Bluetooth Low Energy communication with MediaTek LinkIt™ ONE
Topics
2
WHAT IS MEDIATEK LABS HDK
Overview of GATT
Hello World example
Read temperature example
Questions
MediaTek Labs A Developer Centric Ecosystem
Global program – free to join
Supporting developers: Device creation
App development
Services
labs.mediatek.com
2016-03-08 Copyright © MediaTek Inc. All rights reserved. 4
Enabling Developer and Maker Success
Dev resources
Insights and inspiration
Access to hardware
SDKs for makers (Arduino), professional developers (C/Eclipse) and Linux (OpenWrt and Ubuntu)
Technical support
Peripherals (sensors, etc)
Cloud management of device data
Developer advice & matchmaking
Design, production & go-to-market help
Go from idea to prototype to product
MediaTek LinkIt™ portfolio Software and hardware development platforms for wearables & IoT
Copyright © MediaTek Inc. All rights reserved.
LinkIt Assist 2502 labs.mediatek.com/2502
Wearable form factors
For professional developers (C/Eclipse)
LinkIt ONE
labs.mediatek.com/linkitone
Unrivalled connectivity on a single board
For DIY & maker community (Arduino)
LinkIt Connect 7681 labs.mediatek.com/7681
The simple way to Wi-Fi enable your devices
For low-cost smart home or office deployment
LinkIt Smart 7688 labs.mediatek.com/7688
Open-source Wi-Fi platform for a more connected world
OpenWrt Linux, Python, Node.js, Arduino
2016-03-08 Copyright © MediaTek Inc. All rights reserved. 6
Rapidly growing LinkIt community
Topics
7
What is MediaTek Labs
HDK Overview of GATT
Hello World example
Read temperature example
Questions
LinkIt ONE HDK (Back View)
GPS Antenna
Wi-Fi / BT Antenna
GSM Antenna
GPS+GLONASS Antenna
Wi-Fi / BT Antenna
GSM Antenna
Topics
9
What is MediaTek Labs
HDK
OVERVIEW OF GATT Hello World example
Read temperature example
Questions
GATT
10
▪ GATT = Generic Attribute Profile
▪ Gatt prescibes how to send/receive data
▪ It’s reading writing attributes on the devices
• 4 different ways of transfering data
▪ 22 Bytes / transaction
Network topology
11
Central Device (Phone, Tablet,
Computer)
Peripheral Device
Peripheral Device
Peripheral Device
Peripheral Device
Peripheral device can only have one
connection at a time
Central Device can have multiple
connections at a time
Roles
12
▪ Server
• Sends notification that new data is available
▪ Client
• Receives data
▪ Peripheral and Central Device can be both
Server Client
Services and characteristics
13
▪ Services are collections of characteristics
▪ Characteristics store values and permissions
▪ Heart rate monitor
• Heartbeat (Read)
• Timestamp (Read/Write)
Profile
Service
Characteristic
Characteristic
Service
Characteristic
Characteristic
Characteristic
UUID
14
▪ implement as many profiles, services, and characteristics as you need.
▪ non-standard profile -> 128bit UUID is required and must be generated randomly by
▪ Bluetooth SIG profiles -> 16bit UUID (services, and characteristics) currently
BT SIG UUID’s
15
▪ List of set standard UUID as examples
▪ Service UUID • Battery Service 0x180F
• Running Speed and Cadence 0x1814
▪ Characteristic • Glucose Measurement 0x2A18
• Heart Rate Measurement 0x2A37
▪ https://developer.bluetooth.org/gatt/Pages/default.aspx
Data Transfer - types
16
▪ Read –requested by client Server responds with value.
▪ Write – requested by client Server stores the new value
▪ Notify – initiated by the server when a new value is written, then the new value is pushed to the client (Notifications are not acknowledged)
▪ Indicate – same as Notify but indications are acknowledged
Data Transfer - application
17
▪ If the client needs to send data to the server, use write.
▪ If the client needs to get data from the server on-demand (i.e. polling), use read.
▪ If the server needs to send data to the client without the client requesting it first, use notify or indicate. (The client must subscribe to these updates before any data will be transferred.)
Topics
18
What is MediaTek Labs
HDK
Overview of GATT
HELLO WORLD EXAMPLE Read temperature example
Questions
Hello World example
19
▪ Create a server
• Service
• Characteristic
▪ Handle read request from client
• “Hello GATT world!”
Client Server
20
Client Server
Read
“Hello world!”
BLE Scanner
21
▪ https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner
Hello World Example
22
1. Implement an LGATTService
2. Implement the onRead() function
3. Initialize the LGATTServer with your implementation
4. Handle incoming requests
Temperature Example
23
1. Implement an LGATTService
2. Initialize the LGATTServer with your implementation
3. Read temperature
4. If temperature changed, send indication to Client
Best Practice
24
▪ Start on our example code
▪ Arduino
• File
▪ Examples • LGATT
▪ UARTOverGATT
• LGATTS
Topics
25
What is MediaTek Labs
HDK
Overview of GATT
Hello World example
Read temperature example
QUESTIONS
Questions?
26
Download Resources:
labs.mediatek.com/linkit
MediaTek Cloud Sandbox:
labs.mediatek.com/mcs
Check the Forum:
labs.mediatek.com/forums
What’s Next ?
27
▪ March 17th, 2016 - From concept to consumer – make your IoT idea a commercial reality
More Info : http://home.labs.mediatek.com/march-
webinars-make-the-most-out-of-your-iot-project/
Copyright © MediaTek Inc. All rights reserved.