blu2i_Application_Scenarios.pdf

Schemat podłączenia modułu bluetooth BTM 330.

Tutaj są inne przykłady połączen modułów i komendy do nich.Niestety innych producentów ale może okazać się przydatne...


Module Application Scenarios
The information contained in this document is subject to change without notice. Ezurio makes no warranty of any kind with
regard to this material including, but not limited to, the implied warranties of merchant ability and fitness for a particular purpose.
Ezurio shall not be liable for errors contained herein or for incidental or consequential damages in connection with the
furnishing, performance, or use of this material.
(C) Copyright 2005 Ezurio Limited.
All rights reserved.
This document contains information that is protected by copyright. All rights reserved. No part of this document may be
photocopied, reproduced, or translated to another language without the prior written consent of Ezurio.
Other product or company names used in this publication are for identification purposes only and may be trademarks of their
respective owners.

1 of 12

Example 1: Light Switch Controller
Background
Consider a small microcontroller controlling a single light switch. The
microcontroller's serial port is connected to the blu2i Module and a digital
output line drives a relay which controls a light. The remote host sends
the text "ON" to switch on the relay and "OFF" to switch it off.

AT Command Sequence
AT Command
ATZ

Response
OK

Comment
Resets the device and sets all S
Register values as per the values in
non-volatile memory database.
ATS0=1
OK
Auto answer incoming connection after
1 ring
AT+BTP
OK
Will accept incoming connection from
any device and will also be
discoverable
CONNECT
Call has been answered automatically,
123456789012
and the Bluetooth address of the peer
device is provided.
At this point the light switch protocol takes in commands from the remote. For
example ON, OFF etc
NO CARRIER
If the remote end drops the connection
OR
^^^
OK
Puts the device in to command mode
ATH
OK
Drops the call.

2 of 12

Example 2: Remote Data Logger
Background
A data logger on a remote site gathers data which is then transferred to
a central site via a Bluetooth enabled phone. Assume that the remote
site is accessed via the telephone 02089388609 and the PC connected
to the modem logs the data to a file, so all the data logger has to do is
open a connection and then send textual data corresponding to the
gathered data.
Assume that the data logger knows the Bluetooth address of the phone
and assume it is 123456789012
Further, assume that the Bluetooth Phone exposes a serial port profile
through which an AT modem can be accessed.

AT Command Sequence
AT Command
ATZ

Response
OK

ATD12345678
9012
ATZ

Comment
Resets the device and sets all S
Register values as per the values in
non-volatile memory database.

CONNECT
123456789012
OK

The response is coming from the
Bluetooth phone

ATD02089388 CONNECT
609
The data logger sends data which is captured at the remote end.
+++
OK
Puts the Bluetooth Phone Modem into
command mode
ATH
OK
Drops the call to 02089388609
^^^
OK
Puts the device into command mode
ATH
OK
Drops the Bluetooth connection

3 of 12

Example 3: Trusted Device Management
Background
Bluetooth provides for secure connections through the use of link keys.
The link keys are 128 bit entities which are uniquely created for each
Bluetooth device via the device's Bluetooth address. Since all Bluetooth
addresses are unique, this results in unique keys. The link keys are
'private' objects and as such are never exposed via the AT interface. At
all times they remain within the blu2i Module. Therefore the module
allows link key management by using Bluetooth addresses as handles.
The device has a database of link keys. Each record in the database has
two fields. One field contains the Bluetooth address and the other
contains the 128 bit link key. Only the address field is viewable.
The following subsections describe AT command sequence for typical
pairing functions.

Obtain a new Link Key
This process will obtain a new link key for a remote device whose
address is 123456789012 and whose pin code is known to be 12345.
AT Command
AT+BTW1234567
89012

AT+BTK="12345"

Response
OK

Comment

PIN?
123456789012
PIN?
123456789012
OK

This is sent to the host every 2000ms

PIN 0
123456789012

Pairing complete. The link key is stored
in a volatile cache
Pairing successful

Obtain a new Link Key and autosave
This process will obtain a new link key for a remote device whose
address is 123456789012 and whose pin code is known to be 12345
and will auto save the link key to the database.
AT Command
ATS538=1
AT+BTW1234567
89012

Response
OK
OK

Comment

PIN? 123456789012
PIN? 123456789012

This is sent to the host every 2000ms

4 of 12

AT+BTK="12345"

OK
PIN 0
123456789012 00

Pairing complete. The link key is
stored in a volatile cache
Pairing successful and saved
automatically

Obtain a new Link Key and autosave fails
This process will obtain a new link key for a remote device whose
address is 123456789012 and whose pin code is known to be 12345
and will auto save the link key to the database.
AT Command
ATS538=1
AT+BTW1234567
89012

AT+BTK="12345"

Response
OK
OK

Comment

PIN? 123456789012
PIN? 123456789012
OK

This is sent to the host every 2000ms

PIN 0
123456789012 22

Pairing complete. The link key is
stored in a volatile cache
Pairing successful and database is
full

Store link key in trusted device database
This process assumes that the procedure described in "Obtain a new
link key" has been done, a link key exists in the cache and that the
database is not full.
AT Command
AT+BTT

Response
OK

Comment

List trusted device database
This process assumes that the procedure described in "Obtain a new
link key" has been done, a link key exists in the cache and that the
database is not full.
AT Command
AT+BTT?

Response
123456789012
123456789013
123456789014
123456789015
123456789016
OK

5 of 12

Comment

Store link key in trusted device database (full)
This process assumes that the procedure described in "Obtain a new
link key" has been done, a link key exists in the cache and that the
database is full.
AT Command
AT+BTT
ATI6

AT+BTT?

AT+BTD12345678
9016
AT+BTT

Response
ERROR
8

Comment
The data base is full
The maximum size of trusted devices
database

OK
123456789012
123456789013
123456789014
123456789015
123456789016
OK
OK
OK

6 of 12

Deletes the key associated with
123456789016
The store will work

Example 4: Bluetooth Enabling a Modem for
DUN
Background
You have a spare external serial modem which you wish to Bluetooth
enable and provide Dial-Up Networking services (DUN Profile) for PDAs
or PCs within range. You also want to ensure that not anyone can use it,
so that new users will need to pair to be able to use its services. The
modem will be plugged into the telephone socket and the blu2i Module
will be connected to the serial port of the modem.
This will allow internet access from anywhere in the home, where the
client will access the DUN profile as described in the Bluetooth
specification.
The blu2i Module will need to be prepared as per the table of AT
Commands in the next section, and the blu2i Module shall be connected
to the modem (assuming it has a 9 way male D type connector) using an
adapter cable as per the diagram in the subsequent section.
In this configuration, the blu2i Module is acting as a proxy host to the
modem.

AT Commands to set up the Module
AT Command
AT & F*
ATS0=-1
ATS504=1
ATS538=1
ATS512=7

Response
OK
OK
OK
OK
OK

ATS502=1
ATS102=5
AT & W
AT+BTK="123
4"

OK
OK
OK
OK

Comment
Clear non-volatile storage
Autoanswer on 1 Ring
Enable Silent Operation
Auto save link keys in trusted device database
On power up, become discoverable and
connectable
Force authentication
Enable SPP and DUN profiles
Save register settings to non-volatile storage
Pin code to use during pairing. This can be set to
any 4 digit number

7 of 12

Wiring between Modem and Module
9 way D-Type MALE
Modem End

9 way D-Type MALE
blu2i Module End

1:DCD & gt;
3:RX & lt;
2:TX & gt;
6:DTR & gt;
5:GND
4:DSR & lt;
8:RTS & gt;
7:CTS & lt;
9:RI & gt;

1:DCD & gt;
2:TX & gt;
3:RX & lt;
4:DSR & lt;
5:GND
6:DTR & gt;
7:CTS & lt;
8:RTS & gt;
9:RI & gt;

8 of 12

Example 5: Modem as a remote host for a
module
Background
You have a room full of Bluetooth peripherals (e.g. vending/gaming
machines) which you want to remotely access via a telephone network
using a modem.
This will allow a remote PC to dial into the modem which auto-answers
and then subsequently it will be like having the Bluetooth blu2i module
connected locally.
The serial module will need to be prepared as per the table of AT
Commands in the next section, the modem will need to be prepared as
per the table of AT Commands in the subsequent section and the serial
module shall be connected to the modem (assuming it has a 9 way male
d-type connector) using an adapter cable as per the diagram in the
subsequent section.
In this configuration, the modem is acting as a proxy host to the
Bluetooth serial module

AT Commands to set up the Module
AT Command
AT & F*
ATS512=1

Response
OK
OK

ATS506=0
ATS539=1
AT & W

OK
OK
OK

Comment
Clear non-volatile storage
On power up, do not become discoverable and
connectable
Disable echoes
Ignore UART RX when DSR is deasserted
Save register settings to non-volatile storage

AT Commands to set up the Modem
AT Command
ATS0=1
ATE0
AT & W

Response
OK
OK
OK

Comment
Autoanswer on 1 Ring
Disable echoes
Save register settings to non-volatile storage

9 of 12

Wiring between Modem and Module
9 way D-Type MALE
Modem End

9 way D-Type MALE
blu2i Module End

1:DCD & gt;
2:TX & gt;
3:RX & lt;
4:DSR & lt;
5:GND
6:DTR & gt;
7:CTS & lt;
8:RTS & gt;
9:RI & gt;

1:DCD & gt;
2:TX & gt;
3:RX & lt;
4:DSR & lt;
5:GND
6:DTR & gt;
7:CTS & lt;
8:RTS & gt;
9:RI & gt;

10 of 12

Example 6: Auto Cable Replacement Via
Pairing
Background
You have a legacy host which needs to connect to a Bluetooth device
(say a mobile phone) automatically on an ad-hoc basis as a master. The
master module will be configured to auto connect to a Bluetooth address
using the AT+BTR command and it will assume that the device will
change often. The Bluetooth address specified via AT+BTR needs to be
set on an ad-hoc basis as new phones come along to offer their data
bearing services.
In this case, the module is configured to accept incoming pairing
attempts, and if the pairing is successful, then the address of the new
device is used next for automatic connection attempts.

AT Commands to set up the Module (one-off)
AT Command
AT & F*
ATS500=1
ATS512=1
ATS538=1
ATS507=1

Response
OK
OK
OK
OK
OK

ATS505=10
ATS530=15000

OK
OK

ATS543=1

OK

AT & W
AT+BTK="8938"
AT+BTR00809800
0001

OK
OK
OK

Comment
Clear non-volatile storage
Default authentication for outgoing connections
Idle mode
Autosave Link keys
Allows DSR input to be used to inhibit
autoconnect cycle
Connection attempts timeout after 10 seconds
Wait period in milliseconds between
connection attempts
Accept incoming pairing during wait phase
between connection attempts
Store new S Register settings
Set Pin Code to 8938 - can be any number
Specify a random Bluetooth address for
connection attempts. The address
008098000001 is safe to use as EZURIO have
not issued a Bluetooth device with that address

Notes: If the device specified in the AT+BTR is in the neighbourhood,
then it MUST be switched off to allow a pairing with a new device.

11 of 12

Example 7: Use the module as a headset
Background
Bluetooth headsets allow an audio connection to be established with a
mobile phone. This example shows how a module mounted on a blu2i
Module Development Kit motherboard can be used as a headset.
It is assumed that a terminal emulator is connected, to allow commands
defined in the headset profile specification to be sent.

AT Commands to set up the Module (one-off)
AT Command
AT & F*
ATS515=$200404
ATS512=4
ATS538=1
ATS0=1
ATS102=2
ATS532=1
AT & W
AT+BTK="8938"
AT+BTN="Ezurio
Headset"

Response
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK

Comment
Clear non-volatile storage
Set device class as headset
Wait for connection
Autosave Link keys
Autoanswer on first RING
Enabled Headset Server profile only
Switch on audio channel on connection
Store new S Register settings
Set Pin Code to 8938 - can be any number
Specify a random Bluetooth address for
connection attempts. The address
008098000001 is safe to use as EZURIO have
not issued a Bluetooth device with that address

After setting up the module with these commands and power cycling it, it
is ready and waiting for a pairing. Initiate pairing from your mobile phone.
On success, you should see the response "PAIR 0 nnnnn" on your
terminal emulator. Now the module can be used as a headset.
For example, call your mobile phone - but do not accept the call via the
phones keypad.
While the phone is ringing you will see that the module has automatically
accepted the Bluetooth connection and there are RING indications being
sent on a regular basis. The RING is being sent by the mobile phone
and NOT the module.
The headset profile specification states that the command
AT+CKPD=200 must be sent from the headset to the phone to answer
the audio call. Send AT+CKPD=200 and you will see that your phone
answers the call and you should then be able to sustain a conversation
via a headset connected to the motherboard.

12 of 12


Pobierz plik - link do postu