Actions

Difference between revisions of "Bluetooth serial modules"

From Just in Time

(Created page with "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==...")
 
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
==Bolutek==
 
==Bolutek==
Initially at 9600bps, commands terminated with crlf and recognized by the following response to '''AT+VERSION''':
+
Currently used in the [[Sending location information from an Android phone to a Nikon camera|GPS from Android to Nikon Camera]] project.
''+BOLUTEK Firmware V2.43, Bluetooth V2.0, HCI V2.1, HCI Rev37, LMP V4, LMP SubV37''
 
  
'''AT+HELP''' Gives a list of commands:
+
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 [http://www.electrodragon.com/w/index.php?title=BC04 electrodragon.com] and have been copied here for reference.
 +
 
 +
==== Downlink Command ====
 +
{| class="wikitable"
 +
|-
 +
! Command Name !! Command !! Response !! Parameter
 +
|-
 +
| testing connection || AT || OK || Null
 +
|-
 +
| Check version || AT+VERSION || +VERSION=<Para1> || <Para1>: Firmware version number, the Bluetooth version number, <br /> the local HCI version, HCI amendments, <br /> LMP version number, LMP sub-version number
 +
|-
 +
| check help || AT+HELP || ...||
 +
|-
 +
| check/set name || AT+NAME <br />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 <br />AT+PIN< Para1> || OK or error || <Para1>: pins
 +
|-
 +
| check/set baud rate || AT+BAUD <br /> AT+BAUD< Para1> || OK or error || 1---1200 <br /> 2---2400 <br />3---4800 <br />4---9600 <br />5---19200 <br />6---38400 <br />7---57600 <br />8---115200 <br />9---230400 <br />A---460800 <br />B---921600 <br />C---1382400 <br />Default :4---9600
 +
|-
 +
| check/set device type || AT+COD <br /> AT+COD< Para1>,<Para2> || OK or error  || <Para1>: Local device type (length must be 6 bytes) from the mode is in effect, <br />the end retrieval<br /><Para2>: Filtration equipment type effect in the main mode for filtering <br />search to equipment (if you set 000,000 returns all search equipment) default: 001f00, 000000
 +
|-
 +
| check/set module SPP master/slave mode || AT+ROLE <br /> AT+ROLE< Para1> || OK or error || <Para1>: 0 --- from the device; <br />1 --- master; Default: 0 from equipment
 +
|-
 +
| check/set GIAC || AT+IAC< Para1> || OK or Error || <Para1>: The query access code, default value: 9e8b33 <br />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, <br />2: inquiry_mode_eir, Length: 1 byte, <br /><Para2>: Up Bluetooth Device response, Length: 2 bytes, <br /><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>:<br />0: specified Bluetooth address connected mode <br />(specified Bluetooth address set by the BIND command)
 +
1: Any Bluetooth address connection mode <br />(not the BIND command set address the constraints), the default value:
 +
|-
 +
| check/set bluetooth address || AT+BIND<Para1> || OK or Error || <Para1>:<br />
 +
Set binding Bluetooth address format: 11,22,33,44,55,66<br />
 +
Reply the Bluetooth address format: 11:22:33:44:55:66<br />
 +
Default: 00:00:00:00:00:00<br />
 +
|-
 +
| 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<br />
 +
<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, <br />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:<br />
 +
11,22,33,44,55,66<br />
 +
Reply Bluetooth address format:<br />
 +
11:22:33:44:55:66<br />
 +
|-
 +
| check/set Page scan and inquiry scan parameters || AT+IPSCAN<Para1>,<Para2>,<Para3>,<Para4> || OK or Error || <Para1>: Query interval<br />
 +
<Para2>: Query duration<br />
 +
<Para3>: Paging time intervals<br />
 +
<Para4>: Paging duration<br />
 +
The above parameters are hexadecimal numbers.<br />
 +
Default: 800,12,800,12<br />
 +
|-
 +
| check/set Encrypt mode || AT+SENM<Para1>,<Para2>  || OK or Error|| <Para1>: Safe mode, the following values ​​(1 byte):<br />
 +
0 - sec_mode0_off<br />
 +
1 - sec_mode1_non_secure<br />
 +
2 - sec_mode2_service<br />
 +
3 - sec_mode3_link<br />
 +
4 - sec_mode4_ssp<br />
 +
<Para2>: Encryption mode, the following values ​​(1 byte):<br />
 +
0 - hci_enc_mode_off<br />
 +
1 - hci_enc_mode_pt_to_pt<br />
 +
2 - hci_enc_mode_pt_to_pt_and_bcast<br />
 +
Default: 0,0<br />
 +
|-
 +
| 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> <br />……<br />LSP=E <br /> || <Para1>:number(0-7)<br /><Para2>:bluetooth address code <br /> <Para3>:name<br /> default feedback:LSP=E <br />
 +
|-
 +
| 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 ====
 +
{| class="wikitable"
 +
|-
 +
! 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<br />
 +
+INQ=<Para1>,<Para2>,<Para3> <br />
 +
……      device information <br />
 +
+INQE inquiry completed <br />
 +
||
 +
<Para1>:bluetooth address<br />
 +
format:11:22:33:44:55:66 <br />
 +
<Para2>:device type<br />
 +
<Para3>:RSSI signal strength (normal is decimal) signal strengthness (default in decimal return 7fff when is not available) <br />
 +
||
 +
|}
 +
 
 +
==Connecting using Ubuntu==
 +
[http://askubuntu.com/questions/248817/how-to-i-connect-a-raw-serial-terminal-to-a-bluetooth-connection Adapted from this askubuntu answer]:
 +
# use hcitool scan to find the device
 +
# pair the device in the bluetooth gui menu
 +
# make sure /etc/bluetooth/rfcomm.conf contains the following:
 
<pre>
 
<pre>
Command              Description
+
rfcomm0 {
-----------------------------------------------------------------
+
        bind no;
AT                  Check if the command terminal work normally
+
        device <mac address>;
AT+RESET            Software reboot
+
        channel 1;
AT+VERSION          Get firmware, bluetooth, HCI and LMP version
+
         comment "Serial Port";
AT+HELP              List all the commands
+
         }
AT+NAME              Get/Set local device name
 
AT+PIN              Get/Set pin code for pairing
 
AT+BAUD              Get/Set baud rate
 
AT+CLEAR            Remove the remembered remote address
 
AT+LADDR            Get local bluetooth address
 
AT+RNAME            Get remote device name
 
AT+DEFAULT          Restore factory default
 
AT+CMODE            Get/Set connection mode
 
AT+BIND              Get/Set bind bluetooth address
 
AT+COD              Get/Set local class of device
 
AT+IAC              Get/Set inquiry access code
 
AT+ROLE              Get/Set master or slave mode
 
AT+STATE            Get current state
 
AT+SENM              Get/Set security and encryption mode
 
AT+IPSCAN            Get/Set page and inquiry scan parameters
 
AT+SNIFF            Get/Set sniff power table parameters
 
AT+LOWPOWER          Start/Stop low power mode
 
AT+UARTMODE          Get/Set uart stop bits and parity
 
AT+ENABLEIND         Enable/Disable Indication print
 
AT+LSP              List Paired Device List
 
AT+RESETPDL          Reset Paired Device List
 
AT+REMOVEPDL         Remove one entry from Paired Device List
 
AT+SUPERVISION      Get/Set supervision timeout
 
AT+AUTOINQ          Start/Stop auto inquiry
 
AT+INQ              Start inquiry
 
AT+INQC              Cancel ongoing inquiry
 
(M)AT+AUTOCONN      Start/Stop auto connection
 
(M)AT+INQM          Get/Set inquiry parameters
 
(M)AT+CONNECT        Connect to a remote device by BD address
 
-----------------------------------------------------------------
 
Note: (M) = The command support master mode only, other commands
 
support both master and slave mode.
 
For more information, please visit http://www.bolutek.cn
 
Copyright@2012 www.bolutek.cn. All rights reserved.
 
 
</pre>
 
</pre>
 
+
# (differing from askubuntu.com) sudo rfcomm bind rfcomm0 <mac address>
Default name is ''Bolutek'' and default PIN is ''1234''.
 

Latest revision as of 23:46, 21 December 2016

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>