Bluetooth LE Button

20
[email protected] u.sa Product Description A physical button that connects to smart phones to enable functions on the phone side. Design Focus Small Fast response Long battery life The Button

description

The technical documentation of how to make a BLE button working with an iso device. A Demo video of this project can be found in the link below. http://youtu.be/aoQFClP3_eY

Transcript of Bluetooth LE Button

Page 1: Bluetooth LE Button

[email protected]

Product Description

A physical button that connects to smart phones to enable functions on

the phone side.

Design Focus

SmallFast response

Long battery life

The Button

Page 2: Bluetooth LE Button

Component Selection

Components Parts Remarks

Bluetooth LE TI CC2541 Cost-effective, MCU embedded

Battery CR1632 Small, ø16×3.2mm3V, 140mAh (Marked power)

Buck convertor TI TPS62730 Enable BLE low power mode

Tactile Switch SKQYAAE010 SMD, Compact, High-speed

Antenna Puls W3008 Ceramic SMD, 1.7 dBi gain

LED LED RED 0402 Small forward voltage (1.8 V)

Passive components SMD 0402 Save PCB space

Page 3: Bluetooth LE Button

Design Breakdown

Power supply

Buck convertor

Power management

3~2.2 V

Button

Sensing and Display

CC2541

Bluetooth

MCU (8051)

LED

2.1 V

Antenna +MatchingNetwork

Communication

GPIO write

TX

RX

GPIO read

Page 4: Bluetooth LE Button

Schematic

Page 5: Bluetooth LE Button

PCB Layout

Top

Bottom

GND

PWR

4 layer PCB

Top side:•CC2541•TPS62730•Switch•Antenna•Crystal•LED•Passive SMD

Bottom side:•Battery•Debug port

*Preliminary design, refinement required

Page 6: Bluetooth LE Button

Mechanical Concept Design

20 mm

8 m

m

Page 7: Bluetooth LE Button

Peripheral

Smart phoneButton

Central device

scan

Establish connection

turn on key press notification

advertise

read P0_0 ?1

0

send notification characteristic change

N

Y

create event

GATT clientGATT server

Flash LED (P1_0)

System Flow Chart

Page 8: Bluetooth LE Button

Firmware Development• The firmware of the button function is programed in the 8051 MCU of

CC2540, which is included in the mini Keyfob module (shown below) from TI CC2540 mini development kit.

• Programming environment: IAR Embedded Workbench for 8051.

• The right Key and LED of the mini Keyfob module are enabled.

• The “SimpleBLEPeripheral” project provided by TI is used as a reference.

Page 9: Bluetooth LE Button

Code Implementation

2. Declare HandleKeys function

1. Enable “simplekeys” service and register Key event to be processed in “SimpleBLEPeripheral_ProcessEvent” task function

simpleBLEPeripheral.c

simpleBLEPeripheral.c

SimpleBLEPeripheral_Init

3. Process Key event in “simpleBLEPeripheral_ProcessOSALMsg”

simpleBLEPeripheral.c

S..Peripheral_ProcessEvent

S..Peripheral_ProcessOSALMsg

4. Response with enable/disable advertising1 by updating GAP and send notification2 through GATT

simpleBLEPeripheral.c

S..Peripheral_ProcessEvent

S..Peripheral_ProcessOSALMsg

S..Peripheral_HandleKeys

Code Location

1

2

Page 10: Bluetooth LE Button

Software Development• The debugging and testing is performed on an Iphone 5.

• Programming environment: Xcode 5.

• An App is developed with button connection, button test, and flappy bird game functions.

• Bluetooth communication is handled by BLE Controller object, when BLE notification is sent to the Iphone, the updated key information is passed to BLE Connection View Controller through delegation.

BLE Connection View Flappy Bird View• BLE Connection View includes BLE

initialization view and button test view.

• Source Code of CC2540 Keyfob IOS demo and Spritybird app are used as references.

Page 11: Bluetooth LE Button

App Flow AppDelegateobject

AppDelegateobject

BLE Connection View Controller

object

BLE Connection View Controller

object

Flappy Bird View Controller

object

Flappy Bird View Controller

object

BLE Controllerobject

BLE Controllerobject

Flappy Bird View Controller

View

Flappy Bird View Controller

View

BLE Connection View Controller

View

BLE Connection View Controller

View

UIButtonUIButton

SceneobjectSceneobject

BirdNodeBirdNode

SKSpriteNode

SKSpriteNode

UILabel UILabel

UISwitchUISwitch

UIImageUIImage

Page 12: Bluetooth LE Button

Button Connection Interface

BLE ButtonStart scanning

Key status indicator

Connection statusindicator

Button Connection Interface handles the Bluetooth scanning and connection status indication.

Page 13: Bluetooth LE Button

Button Test Interface

Real time updated data

Minimum time intervalbetween clicks/touches

Maximum frequency(mean of 5)

Screen touch dataBLE button click data

Button Test Interface implements a function to get the button clicking time interval for studying the usability of the BLE button as well as providing data for power consumption test.

Page 14: Bluetooth LE Button

Button Characterization• The power consumption of the BLE button is

characterized using a 34410A high precision multimeter and an external power supply.

• The firmware is modified to control one key and one LED only. As there are other peripheral devices connected on the Keyfob such as buzzer, accelerometer which introduce leakage current to the module, the measured power consumption only reflects the relative power performance of the BLE key press application.

• In the following test, the multimeter is configured with 0.6 ms sample interval time, 50000 current data of the button performing different tasks within 30 seconds is recorded and analyzed.

Page 15: Bluetooth LE Button

Test Result Connection interval: 100 msSlave latency: 0, RF power: 0 dB

Page 16: Bluetooth LE Button

Clicking Frequency Comparison

Calculated Ieffective

1.17 mA

1.30 mA

2

The button can reach a clicking frequency of 7 Hz, close to 9 Hz maximum frequency of the screen touching.

Page 17: Bluetooth LE Button

Conclusion• For simple BLE applications, using embedded MCU reduces circuit complexity.

In this case, battery size becomes the major constrain for the further miniaturization of the device. 16 mm diameter CR1632 could be an option when the power consumption is properly managed.

• For more complicated system on button cell sized board, 6/8 layers PCB design needs to be considered.

• By using the plastic button, ceramic chip antenna can be placed on the top side of the board, which saves the overall board space.

• CC2541 Low power mode saves additional 20% energy.

• Red LED using as a indicator, powered directly by the MCU, avoiding additional transistors.

• In data transmission mode, the effective current consumption of the BLE with button function is above 1 mA.

• The BLE button can be used for action intense applications.

Page 18: Bluetooth LE Button

ReferencesCC2541-TPS62730EM Reference DesignCC2541 Programming GuideCC2541 Mini Development Kit Sample Codehttps://github.com/kirualex/SprityBird (Sprity Bird Source Code)http://processors.wiki.ti.com/index.php/Category:KeyFobDemo (Keyfob Source Code)

Software usedCircuit and PCB design: Diptrace Freeware EditionFirmware development: IAR Embedded WorkbenchSoftware development: Xcode 5.1.1Mechanical concept design: SketchUp

http://youtu.be/aoQFClP3_eY

A Demo can be found in the link below.

Page 19: Bluetooth LE Button

Time Line*

CC2540 received

Design completed

July 14

July 16

July 27

July 9

Order placed for CC2540 MINI DK

Firmware completed

July 19

Apple developer license received

July 23

Software completed

Characterization &Demo

July 30

* Completed during spare time

Page 20: Bluetooth LE Button

Thank you!