Webtronico BTM-5 Bluetooth User manual

BTM-5 Bluetooth
Wireless TTL Master/Slave Transceiver Module
AT Command User Guide
Rev 1.1, Oct 2010
http://www.webtronico.com

BTM-5 Bluetooth Module Datasheet Rev1.1
1
Contents
1Introduction.............................................................................................................................2
2Hardware Connection.............................................................................................................2
3AT Command Set....................................................................................................................3
3.1 TEST Command..................................................................................................................3
3.2 RESET Command...............................................................................................................3
3.3 Restore Default Setting Command....................................................................................3
3.4 Get Firmware Version Command......................................................................................3
3.5 Get Address..........................................................................................................................4
3.6 Get the Device Name...........................................................................................................4
3.7 Set the Device Name............................................................................................................4
3.8 Set / Get Role.......................................................................................................................4
3.9 Get Device Type...................................................................................................................5
3.10 Set / Get Password...............................................................................................................5
3.11 Set / Get Baudrate...............................................................................................................5
3.12 Set / Get Link Mode............................................................................................................6
3.13 Set / Get Bind BluetoothAddress.......................................................................................6
3.14 Set Single PIO Output ........................................................................................................6
3.15 Set Multiple PIO Output....................................................................................................6
3.16 Get Multiple PIO Input......................................................................................................7
4Appendix A: AT command error code refernce....................................................................8

BTM-5 Bluetooth Module Datasheet Rev1.1
2
1Introduction
The BTM-5 Module has two operation modes, one is normal auto link mode, and the other is
AT command mode. User can switch between two modes via pull the mode select pin PIO11 low
and high respectively.
The normal auto link mode is the basic operation mode, each Master/Slave BTM-5 pair auto
link with the default device address after power up. After link is established, user can transmit and
receive data via the UART interface with each other. The transmission is almost transparent to user,
it acts as tow UART connect with each other wirelessly.
The AT command mode is the advanced operation mode. User can use supported AT
command to change the default configurations, such as device name, link password, UART baud
rate and etc.
2Hardware Connection
Pin Description
1 UART_TXD
2 UART_RXD
3 UART_CTS
4 UART_RTS
9~11 NA
12 3.3V Supply input
13 GND
14~20 NA
21,22 GND
23 NA
24 NA
25 PIO2 Programmable IO port
26 PIO3 Programmable IO port
27 PIO4 Programmable IO port
28 PIO5 Programmable IO port
29 PIO6 Programmable IO port
30 PIO7 Programmable IO port
31 Operation Mode LED
32 Link Status LED
33 PIO10 Programmable IO port
34 PIO11 Programmable IO port

BTM-5 Bluetooth Module Datasheet Rev1.1
3
The pin PIO8 is the indicator for the operation mode, user can use a LED to connect to this
pin. The LED starts to blink after power up, and the blink frequency subject to change between
different operation modes.
The pin PIO9 is the indicator for the link status. It is high when the link established, user can
use this pin to determine the link status of the BTM-5 module.
The pin PIO11 is the switch input to select two operation modes. When high it enter the AT
command mode, when low it enter auto link mode. User can use this pin to change between tow
modes in real time.
3AT Command Set
Note: All AT commands (not case sensitive) should be ended up with \r\n characters.
3.1 TEST Command
Command Response Parameter
AT OK NULL
Example:
Command :AT\r\n
Response : OK
3.2 RESET Command
Command Response Parameter
AT+RESET OK NULL
Example:
Command :AT+RESET\r\n
Response : OK
3.3 Restore Default Setting Command
Command Response Parameter
AT+ORGL OK NULL
Default Setting is :
1. Device class: 0
2. Inquiry code: 0x009e8b33
3. Device mode: Slave mode
4. Binding mode: SPP
5. Serial port: 38400 bits/s; 1 stop bit, no parity
6. Pairing code: “1234”
7. Device name: H-C-2010-06-01
Example:
Command : AT+ORGL \r\n
Response : OK
3.4 Get Firmware Version Command
Command Response Parameter
AT+VERSION? +VERSION:< Param >
OK
Param: firmware version

BTM-5 Bluetooth Module Datasheet Rev1.1
4
Examples:
Command : AT+VERSION? \r\n
Response :
+VERSION:2.0-20100601
OK
3.5 Get Address
Command Response Parameter
AT+ADDR? +ADDR:< Param >
OK
Param: the Bluetooth address
Representation of the address: NAP:UAP:LAP (HEX)
Examples:
The address of the Bluetooth device is: 10:7:180004
Command : At+ ADDR?\r\n
Response :
+ADDR:10:7:180004
OK
3.6 Get the Device Name
Command Response Parameter
AT+NAME? OK NULL
Examples:
Command : AT+NAME? \r\n
Response :
+NAME:HC05S
OK
3.7 Set the Device Name
Command Response Parameter
AT+RNAME=<Param> OK Param: bluetooth device name
Examples:
Command :AT+NAME=BTM-5\r\n
Response :
OK
3.8 Set / Get Role
Command Response Parameter
AT+ROLE=<Param> OK
AT+ROLE? + ROLE:< Param >
OK
Param
0: Slave (be connected by other device)
1: Master (Actively poll the nearby device and
initialize binding to other devices)
2: Slave-loopback (be connected by other device,
receive and send back whatever received)
Default:0

BTM-5 Bluetooth Module Datasheet Rev1.1
5
Examples:
Command : AT+ROLE?\r\n
Response :
+ROLE:0
OK
3.9 Get Device Type
Command Response Parameter
AT+CLASS? + CLASS:< Param >
OK
Param: device type
Device type is a 32-bit parameter. It is used to
indicate the device class and the service it supports
Default: 0
The actual meaning is explained in appendix 1.
Examples:
Command :AT+CLASS?\r\n
Response :
+CLASS:0
OK
3.10 Set / Get Password
Command Response Parameter
AT+PSWD=<Param> OK
AT+ PSWD? + PSWD:< Param >
OK
Param : link password
Default : 1234
3.11 Set / Get Baudrate
Command Response Parameter
AT+UART=
<Param1>,<Param2>,<Param3>
OK
AT+ UART? +UART:
<Param1>,<Param2>,<Param3>
OK
Param 1:baudrate (bps)
4800
9600
19200
38400
57600
115200
230400
460800
921600
1382400
Param2: Stop bit
0: 1bit
1: 2bit
Param3: Parity
0: None
1: Odd

BTM-5 Bluetooth Module Datasheet Rev1.1
6
2: Even
Default:38400,0,0
3.12 Set / Get Link Mode
Command Response Parameter
AT+CMODE=<Param> OK
AT+ CMODE? + CMODE:< Param >
OK
Param
0: Specify bluetooth link
address
1: Any bluetooth link address
2: Slave-Loopback
Default : 0
3.13 Set / Get Bind Bluetooth Address
Command Response Parameter
AT+BIND=<Param> OK
AT+ BIND? + BIND:< Param >
OK
Param : Bluetooth address to
be bind
Default : 00:00:00:00:00:00
3.14 Set Single PIO Output
Command Response Parameter
AT+PIO=<Param1>,<Param2> OK Param1: PIO port number (decimal)
Param2L PIO port output
0- Low voltage
1- High voltage
Examples:
Set the PIO10 outputs high
Command :AT+PIO=10,1\r\n
Response :
OK
Set the PIO10 outputs low
Command :AT+PIO=10,0\r\n
Response :
OK
3.15 Set Multiple PIO Output
Command Response Parameter
AT+MPIO=<Param> OK Param: PIO port number mask combination (hex)
The useable port is PIO2- PIO7 and PIO10.
PIO port mask = (1 << port number)
PIO port mask combination = ( PIO port mask 1| PIO port mask 2 |PIO port mask 3 |…)
Example:
PIO2 mask= (1<<2)=0x004
PIO10 mask = (1<<10)=0x400
PIO port mask combination= (0x004 | 0x400)=0x404

BTM-5 Bluetooth Module Datasheet Rev1.1
7
PIO 2 and PIO 10 output high:
Command :AT+MPIO=404\r\n
Response : OK
3.16 Get Multiple PIO Input
Command Response Parameter
AT+MPIO? +MPIO: <Param>
OK
Param- PIO port value (16bits)
Param[0]=PIO0
Param[1]=PIO1
Paramp2]=PIO2
…
Param[10]=PIO10
Param[11]=PIO11
Example:
Command : AT+MPIO?\r\n
Response :
+MPIO:E04
OK

BTM-5 Bluetooth Module Datasheet Rev1.1
8
4Appendix A: AT command error code refernce
Error code (hex) Description
0 AT command error
1 The result is default value
2 PSKEY write error
3 Device name is too long (more than 32 bytes)
4 Device name is 0 byte
5 Bluetooth address: NAP is too long
6 Bluetooth address: UAP is too long
7 Bluetooth address: LAP is too long
8 PIO port mask length is 0
9 Invalid PIO port
A Device class is 0 byte
B Device class is too long
C Inquire Access Code length is 0
D Inquire Access Code is too long
E Invalid Inquire Access Code
F Pairing password is 0
10 Pairing password is too long (more than 16 bytes)
11 Role of module is invalid
12 Baud rate is invalid
13 Stop bit is invalid
14 Parity bit is invalid
15 No device in the pairing list
16 SPP is not initialized
17 SPP is repeatedly initialized
18 Invalid inquiry mode
19 Inquiry timeout
1A Address is 0
1B Invalid security mode
1C Invalid encryption mode
Table of contents