Actions

Bluetooth serial modules

From Just in Time

Revision as of 23:46, 21 December 2016 by Danny (talk | contribs) (→‎Uplink Command list)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The bluetooth modules that are offered on ebay all seem to have the same hardware, but have different firmware. This page has some notes on the ones that we have.

Bolutek

Currently used in the GPS from Android to Nikon Camera project.

Initially at 9600bps, commands terminated with crlf and recognized by the following response to AT+VERSION:+BOLUTEK Firmware V2.43, Bluetooth V2.0, HCI V2.1, HCI Rev37, LMP V4, LMP SubV37.Default name is Bolutek and default PIN is 1234.

AT commands

The following tables are from electrodragon.com and have been copied here for reference.

Downlink Command

Command Name Command Response Parameter
testing connection AT OK Null
Check version AT+VERSION +VERSION=<Para1> <Para1>: Firmware version number, the Bluetooth version number,
the local HCI version, HCI amendments,
LMP version number, LMP sub-version number
check help AT+HELP ...
check/set name AT+NAME
AT+NAME< Para1>
OK or error <Para1>:device name
Reset to default AT+DEFAULT OK null
reset AT+ RESET OK null
check/set pins AT+PIN
AT+PIN< Para1>
OK or error <Para1>: pins
check/set baud rate AT+BAUD
AT+BAUD< Para1>
OK or error 1---1200
2---2400
3---4800
4---9600
5---19200
6---38400
7---57600
8---115200
9---230400
A---460800
B---921600
C---1382400
Default :4---9600
check/set device type AT+COD
AT+COD< Para1>,<Para2>
OK or error <Para1>: Local device type (length must be 6 bytes) from the mode is in effect,
the end retrieval
<Para2>: Filtration equipment type effect in the main mode for filtering
search to equipment (if you set 000,000 returns all search equipment) default: 001f00, 000000
check/set module SPP master/slave mode AT+ROLE
AT+ROLE< Para1>
OK or error <Para1>: 0 --- from the device;
1 --- master; Default: 0 from equipment
check/set GIAC AT+IAC< Para1> OK or Error <Para1>: The query access code, default value: 9e8b33
specific settings, see Appendix 2: query access code Description
check/set remote bluetooth device name AT+RNAME< Para1> OK or Error <Para1>: remote Bluetooth device address
check/set inquiry mode AT+INQM<Para1>,<Para2>,<Para3> OK or Error <Para1>: Query mode: 0: inquiry_mode_standard,1: inquiry_mode_rssi,
2: inquiry_mode_eir, Length: 1 byte,
<Para2>: Up Bluetooth Device response, Length: 2 bytes,
<Para3>: Query timeout, Timeout range :1-30(Converted into time :1.28-61.44 seconds), Length: 2 bytes, Default: 1,9,30 (16 hex)
check/set connection mode AT+CMODE< Para1> OK or Error <Para1>:
0: specified Bluetooth address connected mode
(specified Bluetooth address set by the BIND command)

1: Any Bluetooth address connection mode
(not the BIND command set address the constraints), the default value:

check/set bluetooth address AT+BIND<Para1> OK or Error <Para1>:

Set binding Bluetooth address format: 11,22,33,44,55,66
Reply the Bluetooth address format: 11:22:33:44:55:66
Default: 00:00:00:00:00:00

clear memory address AT+CLEAR OK Null
check/set UART MODE AT+ UARTMODE<Para1>,<Para2> OK or Error <Para1>: Stop bit: 0:1 stop bit, 1:2 stop bit

<Para2>: Parity: 0: no parity, 1: Odd, 2: Even parity, default value: 0,0

check local BT address AT+LADDR +LADDR=<Para1> <Para1>: Local Bluetooth address,
for example: 11:22:33:44:55:66
checkt BT module working status AT+STATE +STATE=<Para1> Example
check/set Remote Bluetooth device automatically search AT+ AUTOINQ<Para1> Ok or Error 0=no, 1=yes
check remote bluetooth device AT+INQ Ok null
cancel check remote bluetooth device AT+INQC Ok null
check/set Whether to automatically connect to a remote Bluetooth device AT+ AUTOCONN<Para1> OK or Error 0=Not Auto, 1= Auto
Connect to remote bluetooth device AT+CONNECT<Para1> OK or Error <Para1>:

Set the remote bluetooth address format:
11,22,33,44,55,66
Reply Bluetooth address format:
11:22:33:44:55:66

check/set Page scan and inquiry scan parameters AT+IPSCAN<Para1>,<Para2>,<Para3>,<Para4> OK or Error <Para1>: Query interval

<Para2>: Query duration
<Para3>: Paging time intervals
<Para4>: Paging duration
The above parameters are hexadecimal numbers.
Default: 800,12,800,12

check/set Encrypt mode AT+SENM<Para1>,<Para2> OK or Error <Para1>: Safe mode, the following values ​​(1 byte):

0 - sec_mode0_off
1 - sec_mode1_non_secure
2 - sec_mode2_service
3 - sec_mode3_link
4 - sec_mode4_ssp
<Para2>: Encryption mode, the following values ​​(1 byte):
0 - hci_enc_mode_off
1 - hci_enc_mode_pt_to_pt
2 - hci_enc_mode_pt_to_pt_and_bcast
Default: 0,0

Check/set low power Mode AT+ LOWPOWER<Para1> ok or error 0=not support, 1=support, default =1
check/set sniff energy save mode AT+SNIFF<Para1>,<Para2>,<Para3>,<Para4> ok or error <Para1> - max time, <Para2> - min time, <Para3> - trial time, <Para4> - timeout time
check/set indication upward command AT+ENABLEIND<Para1> ok or error 0= close, 1= open, default 1
check Bluetooth pairing list AT+LSP LSP=<Para1>,<Para2>,<Para3>
……
LSP=E
<Para1>:number(0-7)
<Para2>:bluetooth address code
<Para3>:name
default feedback:LSP=E
Clear all bluetooth pairing list AT+RESETPDL Ok -
clear selected bluetooth pairing record AT+REMOVEPDL<Para1> OK <Para1>:number(0-7)
check/set linkloss checking time AT+SUPERVISION<Para1> Ok or error <Para1> response time, unit in second (Hex), default 5

Uplink Command list

Command Name Command Response Parameter
ready +READY - -
inquiry status +INQUIRING - -
inquiry pairing status +PAIRABLE - -
connecting +CONNECTING<Para1> - -
connected +CONNECTED - -
connection fail +CONNECTION FAILED - -
report remote bluetooth device name +RNAME=<Para1> <Para1>: report remote bluetooth name
report inquiry result +INQS start inquiry

+INQ=<Para1>,<Para2>,<Para3>
…… device information
+INQE inquiry completed

<Para1>:bluetooth address
format:11:22:33:44:55:66
<Para2>:device type
<Para3>:RSSI signal strength (normal is decimal) signal strengthness (default in decimal return 7fff when is not available)

Connecting using Ubuntu

Adapted from this askubuntu answer:

  1. use hcitool scan to find the device
  2. pair the device in the bluetooth gui menu
  3. make sure /etc/bluetooth/rfcomm.conf contains the following:
rfcomm0 {
        bind no;
        device <mac address>;
        channel 1;
        comment "Serial Port";
        }
  1. (differing from askubuntu.com) sudo rfcomm bind rfcomm0 <mac address>