SmartFinder Development Guide.

Transcription

SmartFinder Development Guide.
Smart Finder Development Guide
PCB boards:KF-4A/KF-Li
Authors: Jeffrey Peng, Charlie Xia
Ace Sensor Inc.
Every reasonable effort has been made to ensure the information and procedures detailed in this guide are complete and accurate at the
time of printing. However, information contained in this guide is subject to change without notice.
© Copyright of Ace Sensor Inc. 2012. All rights reserved.
The copyright in this work is vested in Ace Sensor Inc. and the information contained herein is confidential. This work (either in
whole or in part) must not be modified, reproduced, disclosed or disseminated to others or used for purposes other than that for which
it is supplied, without the prior written permission of Ace Sensor Inc.. If this work (or any part of it) is provided to a party ("Other
Party") under a contract between Ace Sensor Inc. and the Other Party, then the use of the work by the Other Party shall be governed by
the provisions of the contract.
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
Cha
ange History
Versiion
1.0
1.1
1.2
Datte
Aug. 22
2nd
2012
Nov. 4tth
2012
Nov. 16
6th
2013
Author
A
Jeffrey
y Peng,
Charliie Xia
Jeffrey
y Peng,
Charliie Xia
Jeffrey
y Peng
Desccription
Creation off the documennt based on Sm
mart Finder
firmware deesign.
iOS 6 updatte
iOS 7 updatte. Adding m
more exampless.
Table of Conttents
1. 2. 3. 4. 5. Abstract
A
............................................................................................................................ 2 Introduction
I
..................................................................................................................... 2 Configuratio
C
on and Notifi
fication ........................................................................................ 3 Access
A
Conttrol ................................................................................................................. 5 Firmware
F
Up
pgrade ........................................................................................................... 6 5.1
1. Using th
he On-Board
d Debugging
g Interface .............................................................. 6 5.2
2. Using th
he Over-Thee-Air Downlo
oad......................................................................... 7 6. Testing
T
with
h 3rd Party To
ools ............................................................................................ 9 6.1
1. Turning
g Off Access Control ..................................................................................... 9 6.2
2. Control the Immediate Alert .................................................................................. 111 6.3
3. Notificaation from th
he Smart Fin
nder Tag ................................................................ 112 Page 1
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
1.
1 Abstra
act
This document iss written for developers who
w want too develop innnovative appplications
g the Ace Sen
nsor’s Smartt Finder prod
ducts. It covvers the proggramming aspect on
using
accesss control, co
onfiguration and firmware upgrade m
methods for Smart Findeer (PCB
board
ds: KF-4A an
nd KF-Li).
2.
2 Introdu
uction
Smarrt Finder products are designed for lo
ocating mispplaced objectts via buzzerr sound and
BLE signal streng
gth. Clear audible
a
buzzeer sound andd long batterry life are thee design
objecctives. Stand
dard Bluetootth Low Enerrgy profiles: Link Loss, Immediate A
Alert, Tx
Poweer and Batterry Service arre supported
d. In additionn, a tight access control m
mechanism
allow
ws Smart Fin
nder productss be used as basic proxim
mity tag in aareas such as external
inputt device, hom
me automatio
on, office seccurity, enterrprise inventory trackingg, etc. etc.
Modeel KF-4A
 Color: Black
B
(other color also possible)
p
 Dimensio
on: 52.7x32x
x10.2mm (Lx
xWxH)
 Weight: 23g/0.8oz
2
 Battery: 2xAAAA
2
battteries.
 Estimated
d battery life: 2+ years (3
3 uses per daay)
Modeel KF-Li
 Color: White
W
(otherr color also possible)
p
on: 58x36x10
0mm. (LxWxH)
 Dimensio
 Weight: 22g/0.8oz
2
L
batteriies with USB
B charging innterface.
 Battery: Li-ion
d battery life: one full ch
harge: 6 monnth with no eexposure to ssunlight; onee
 Estimated
hour of su
un exposure will last 7 days.
d
b
on TI CC2541
C
Bluuetooth Low Energy chipp with 256K
Kb
Both KF-4A and KF-Li are based
T
dettails of TI CC
C2541 can bbe found at
flash memory. Technical
http:///www.ti.com//general/docs/lit/getliteratu
ure.tsp?generiicPartNumbeer=cc2541&fiileType=pdf
Page 2
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
Acee Sensor provides a free iOS app, Sm
mart Finder A
App, which works with
KF--4A and KF--Li. You can
n download iit from here::
http
ps://itunes.ap
pple.com/app
p/id5284606659
3.
3 Config
gurationandNottification
n
Smarrt Finder tag is fully conffiguration drriven. This m
makes it posssible tailorinng for
differrent use scen
narios. The configuratio
on is done wiith a private profile in thhe service
0xAC
CE0. This co
onfiguration
n parameters controls
 auto or manual
m
adverttising
val
 auto adveertising interv
 access con
ntrol: authorrizing connection, passcoode setting
 connectio
on interval
When
n configuring Smart Find
der tag, you need to balaance battery consumptioon with user
experrience (respo
onsiveness). If the Smartt Finder tag is intended tto be a standdard
proxiimity tag, thee 0xACE0 seervice does not
n need to bbe used. Forr a full accesss control,
please refer to Seection 4 for how
h to use seervice 0xAC
CE0.
The notification
n
event
e
is defin
ned in servicce 0xFFE0 w
which notifiees button preesses.
Table 1: Configu
uration and
d Notificatio
on Private P
Profile Defin
nition.
Servicce 0xFFE0
0 0xACEE0 Charactte
ristics Attribute
e Descriptio
on Value Meanin
ng Note Service fo
or button press events 0xFFE1 Notify Button pre
ess event 1
Left key presssed 2
Right key prressed Access Control 0
Key lifted
Smarrt Finder tag on
nly has this button R/W Advertisingg Interval Control 0
Manual conttrol uint8
1
2
3
4
5
645 ms
768 ms
961 ms
1065 ms
1294 ms
0xACE1 Page 3
The aadvertising will run for 30
0 seconds by presssing the button
n, 200m
ms Interval Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
0xACE2 0xACE3 0xACE4 R Access Control >5
0
Set broadcasting interval in 10ms incrementall Off uint8 1
On When access control is turneed on, if the correect passcode iss not received during connection, the keyy fob disconnect the will d
unau
uthorized connection in 30 nds. secon
W Connection
n Interval Control 0
Disconnect
uint8 Notify Authorized
d / RSSI n notification
byte
Write <20
0xF0~0
xFF
1
‐128~0
Set passcode uint8[5]
0xACE5 Page 4
Connection interval in 100ms incrementall Set Keyfob sside RSSI notificaation interval in 100ms incrementall. 0xF0 turns off thee interval Authorized
Keyfob side RSSI
Under the condition off connection being authorized, this can be used to set de new passcod
and turn thee Access Conttrol on. All 0 indicates Access turning off A
Control When the Access n, Control is on
until you sett the correct passscode, you have no
o write permission tto any characteristic of this service aand proximity seervices Hold the button forr over 3 seconds to orize current autho
connection. When the access he contrrol is on, set th
correect passcode to
o autho
orize current connection. Passccode and advertising intervall configurations are mory storeed in flash mem
and p
persist during poweer loss. Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
4.
4 AccesssControll
To prrevent unautthorized acceess over BLE
E, Smart Finnder tag usess a private prrofile to
suppo
ort a passcod
de based acccess control mechanism.
m
This privatte profile alloows passcodde
exchaange during the pairing process.
p
Wh
hen a smartphhone or tableet tries to coonnect to the
Smarrt Finder tag,, the correct passcode must be sent w
within 30 secconds. Otherrwise the
conneection is disaabled and drropped.
The access
a
contro
ol mechanism
m is provideed by the serv
rvice 0xACE
E0. The folloowing is a
work
k flow that an
n iOS app sh
hould do to enable
e
accesss control.
Initia
al Setup: Ap
pp adds a Sm
mart Finder tag:
1. The app connects
c
to th
he tag, turnss on the Notiify in Characcteristics 0xA
ACE4.
2. The app displays
d
a meessage requeesting the usser to press aand hold the button for 3
second. Once
O
the useer has done so,
s the app w
will receive a notificationn in
Characterristics 0xACE4 with valu
ue 0x01.
3. The app writes
w
to Chaaracteristics 0xACE5 a 5 byte passcoode. This turrns on access
control. Please
P
note that
t the passccode cannott be all zero, which indiccates turningg
access con
ntrol off.
4. The app writes
w
0x05 to
t Characterristics 0xACE
E1 to turn onn auto broaddcasting.
0x05 indicates a slow
w broadcastin
ng interval. O
Other broadccasting intervvals are alsoo
available, see table in
n Section 3. If
I the value iis set to 0x000, broadcastiing only
happens for
f 30 second
ds when the button is preessed.
5. If you neeed to conserv
ve battery, th
he connectioon interval shhould be exttended. The
default vaalue is 30ms,, set by iOS.. Without coompromise uuser experiennce, the
recommen
nded value is 0x03 for an interval off 300ms to bbe set in Chaaracteristics
0xACE3.
6. Once the access contrrol is enabled
d, the tag is bbond to the paired iOS ddevice and
will not reespond to requests from unpaired deevices.
der tag
Regu
ular Use: Ap
pp connects to a paired
d Smart Find
1. The app connects
c
to th
he tag, turnss on the Notiify in Characcteristics 0xA
ACE4.
2. The app writes
w
to the passcode seet previouslyy to Characteeristics 0xAC
CE5. The appp
will receiv
ve a notificaation in Charracteristics 00xACE4 withh value 0x011 confirmingg
authorizattion.
3. If you neeed to conserv
ve battery, th
he connectioon interval shhould be exttended. The
default vaalue is 30ms,, set by iOS.. Without coompromise uuser experiennce, the
recommen
nded value is 0x03 for an interval off 300ms to bbe set in Chaaracteristics
0xACE3. If there is no
n data transsmission in 5 seconds, thhe connection is closed.
a tag can then perform
m required int
nteraction.
4. The app and
This access contrrol process iss shown in Section
S
6.1 w
with a 3rd parrty tool.
Page 5
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
5.
5 Firmw
ware Upgrrade
5.1.
5
Using
gtheOn‐B
BoardDeb
bugging
Interrface
KF-4
4A/KF-Li come with on--board debug
gging interfaace.
This consists of 5 through-ho
oles (shown in
i the red
rectan
ngle in the picture
p
on thee right) in th
he dimensionn of
0.3-0
0.4mm. Distaance between
n the pins is 2mm.
 R: Reset
 P2.1: CC2
2541 P2_1
 P2.2: CC2
2541 P2_2
3
 + : VDD 3.3V
 - : GND 0V
0
Stand
dard 2mm to
ouch-pin con
nnection can be used to
conneect to the deb
bugging inteerface. This debugging
interfface can be used
u
to repro
ogram the firrmware usinng
TI’s CC-debugge
C
er and SmarttRF™ Flash Programmeer.
Pleasse find the deetails of the CC Debuggeer here:
http:///www.ti.com
m/tool/cc-debugger Notte that batterries
shoulld be removeed when usin
ng CC-debug
gger.
Page 6
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
5.2.
5
Using
gtheOverr‐The‐AirD
Download
d
To up
pgrade the firmware
fi
usin
ng the BLE wireless inteerface, you’lll need to
install TI’s BLE Multitool on
n your iOS ddevice:
https://itunes.app
ple.com/ca/ap
pp/ti-ble-muultitool/id5800494818
Pleasse follow thee steps below
w to upgradee you firmwaare.
Step 1: Upload th
he new firmw
ware, e.g. “K
KF4A-OAD .bin”, via em
mail or Droppbox to your
iOS device.
d
The following
f
sccreenshots sh
hows how too upload the new firmwaare from
Dropbox into TI BLE Multito
ool.
mart Finder tag into OA
AD mode. Reemove a batttery. Press aand hold thee
Step 2: Set the Sm
button on the Sm
mart Finder taag while puttting the batteery back on.. The LED w
will stay lit,
indicating it’s in OAD mode..
f
up
pdate with TII BLE Multiitool app. Noote: there’s a bug in iOS
Step 3: Perform firmware
64bitt device, i.e. iPhone 5S, iPad
i
air and iPad mini 2 . Please use a 32bit deviice, i.e.
iPhon
ne 4S/5, iPad
d 3/4/mini orr iPod Touch
h 5th generattion. The folllowing screeenshots show
w
this process.
p
Page 7
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
Step 4: After the firmware up
pgrade comp
plete, the Sm
mart Finder ttag will reboot, beep andd
then LED
L
turns off.
o If the LE
ED stays on all
a the time, the firmwarre upgrade iss not
succeessful. Possib
ble problemss: (a). You’rre using a 644 bit iOS devvice. (b). You have a
corru
upted firmwaare bin file.
Page 8
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
r
6.
6 Testing
g with 3rd
Party Tools
T
You can
c test the Smart
S
Finderr tag with 3rdd party toolss. Our favorite tool is
Lightb
blue iOS app
p. https://itu
unes.apple.coom/app/lighhtblue/id5574428110
6.1.
6
Turn
ningOffAcccessContrrol
If thee access conttrol has been
n turned on in
n the Smart Finder tag, tthe connectiion will be
dropp
ped if a correect passcodee is not received within 330 seconds. T
To turn off tthe access
contrrol, follow th
he steps belo
ow.
1. Connect Lightblue
L
to the Smart Finder
F
tag, too inspect servvice 0xACE
E0, if
Characterristic 0xACE
E2 has value 0x01, the acccess controol is on.
Page 9
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
2. Press and hold the buttton on the Smart
S
Finderr tag for 3 seecond until a beep is
sounded to
t complete pairing.
p
Wrrite to Characcteristic 0xA
ACE5 the vaalue of
0x000000
00000 (10 zeeros, i.e. 5 by
ytes of 0x00). Confirm tthat Charactteristic
0xACE2 has
h changed
d its value to 0x00. The aaccess controol has been tturn off.
Page 10
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
6.2.
6
ControltheIm
mmediateA
Alert
Follo
ow the steps below to turrn on the buzzzer and LED
D on the Sm
mart Finder taag. Setting
the “A
Alert Level”” to 0x01 turns on the bu
uzzer; 0x02 tturns on the bbuzzer and fflashing the
LED;; 0x00 turns off the alertt.
Page 11
Ace Sennsor Inc.
11 – 3000 Earl Grey Dr. Suitee 383,
Ottawa, Ontario, K2T 1C1
Tel: 6133 3667799 Fax: 613 800-0726
_______
__________________
_________________
__________________
_______________________________________________________________________
6.3.
6
Notifficationfro
omtheSm
martFinde
erTag
The service
s
0xFF
FE0 providess the notificaation to show
w whether thhe button is ppressed.
When
n the button on the Smarrt Finder tag is pressed, C
Characteristtic 0xFFE1 sshows value
0x02. When the button
b
is lifteed, Characteeristic 0xFFE
E1 shows vaalue 0x00.
Follo
owing the steeps below to receive notiification from
m the Smartt Finder tag.
Page 12