25
Best Bang For Your Buck www.banggood.com 1 HC-05 1. Overview: This module supports UART, USB, SPI, PCM, SPDIF and other interfaces, and supports SPP Bluetooth serial port protocol, which has the advantages of low cost, small size, low power consumption, high sensitivity of sending and receiving. 2. Feature Bluetooth V2.0+EDR Bluetooth Class 2 Built-in PCB RF antenna Built-in 8Mbit Flash Support SPI programming interface Support UART, USB, SPI, PCM and other interfaces Support master and slave Support software control master-slave module 3.3V power supply Passed REACH, ROHS certification 3. Application areas: Bluetooth car handsfree Bluetooth GPS Bluetooth PCMCIA, USB Dongle Bluetooth wireless data transmission; Industrial remote control, telemetry; POS system, wireless keyboard, mouse; Traffic, underground positioning, alarm; Automated data acquisition system; Wireless data transmission; banking system; Wireless data collection; Building automation, security, wireless monitoring of equipment room, access control system;

HC-05myosuploads3.banggood.com/products/20190722/...2019/07/22  · The BLK-MD-HC-05 embedded Bluetooth serial communication module has two working modes: command response working

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

  • Best Bang For Your Buck

    www.banggood.com 1

    HC-05

    1. Overview:

    This module supports UART, USB, SPI, PCM, SPDIF and other interfaces, and supportsSPP Bluetooth serial port protocol, which has the advantages of low cost, small size,low power consumption, high sensitivity of sending and receiving.

    2. Feature

    Bluetooth V2.0+EDRBluetooth Class 2Built-in PCB RF antennaBuilt-in 8Mbit FlashSupport SPI programming interfaceSupport UART, USB, SPI, PCM and other interfacesSupport master and slaveSupport software control master-slave module3.3V power supplyPassed REACH, ROHS certification

    3. Application areas:

    Bluetooth car handsfreeBluetooth GPSBluetooth PCMCIA, USB DongleBluetooth wireless data transmission;Industrial remote control, telemetry;POS system, wireless keyboard, mouse;Traffic, underground positioning, alarm;Automated data acquisition system;Wireless data transmission; banking system;Wireless data collection;Building automation, security, wireless monitoring of equipment room, accesscontrol system;

  • Best Bang For Your Buck

    www.banggood.com 2

    Smart home, industrial control;Vehicle inspection equipment;Interactive program voting equipment for television stations;Government street lamp energy saving equipmentWireless LED display systemBluetooth joystick, Bluetooth gamepadBluetooth printerBluetooth remote control toy

    4. Physical characteristics:

    Operating Frequency Band 2.4GHz ISM band

    Bluetooth Specification V2.0+EDR

    Output Power Class Class 2

    Operating Voltage 3.3V

    Host Interface USB 1.1/2.0 or UART

    Audio Interface PCM interface

    Flash Memory Size 8Mbit

    Dimension 27mm (L) x 13 (W) mm x 2mm (H)

    5. Electrical characteristics:

    Absolute Maximum RatingsRating Min MaxStorage temperature -40℃ +150℃Supply voltage: VBAT -0.4V 5.6VOther terminal voltages VSS-0.4V VDD+0.4V

    6. Power consumption:

    Operation Mode Connection Type UART Rate(kbps) Average UnitPage scan - 115.2 0.42 mAACL No traffic Master 115.2 4.60 mAACL With file transfer Master 115.2 10.3 mA

    Recommended Operating ConditionsOperating Condition Min MaxOperating temperature range -40℃ +150℃Guaranteed RF performance range(a) -40℃ +150℃Supply voltage: VBAT 2.2V 4.2V(b)

  • Best Bang For Your Buck

    www.banggood.com 3

    ACL 1.28s sniff Master 38.4 0.37 mAACL 1.28s sniff Slave 38.4 0.42 mASCO HV3 30ms sniff Master 38.4 19.8 mASCO HV3 30ms sniff Slave 38.4 19.0 mAStandby Host connection - 38.4 40 µA

    7. Functional block diagram:

    8. Application circuit diagram:

  • Best Bang For Your Buck

    www.banggood.com 4

    9. Pin function description:

    PIN NAME TYPE Function

    1 UART-TX CMOS output Serial data output

    2 UART-RX CMOS input Serial data input

    3 UART-CTS CMOS input Serial port clear send

    4 UART-RTS CMOS output Serial port request to send

    5 PCM-CLK Two way PCM clock

    6 PCM-OUT CMOS output PCM data output

    7 PCM-IN CMOS input PCM data input

    8 PCM-SYNC Two way PCM data synchronization

    9 AIO(0) Two way Programmable analog input and output

    10 AIO(1) Two way Programmable analog input and output

    11 RESETB CMOS input Reset/reset button

    12 3.3V power input +3.3V power supply

    13 GND Ground Ground

    14 NC Output NC (please hang)

    15 USB-DN Two way USB data negative

  • Best Bang For Your Buck

    www.banggood.com 5

    16 SPI-CSB CMOS input SPI chip select

    17 SPI-MOSI CMOS input SPI data input

    18 SPI-MISO CMOS output SPI data output

    19 SPI-CLK CMOS input SPI clock port

    20 USB-DP Two way USB data is positive

    21 GND Ground Ground

    22 GND Ground Ground

    23 PIO(0) Two way Programmable input/output port (0)

    24 PIO(1) Two way Programmable input/output port (1)

    25 PIO(2) Two way Programmable input/output port (2)

    26 PIO(3) Two way Programmable input/output port (3)

    27 PIO(4)Two way Programmable input/output port (4)

    28 PIO(5)Two way Programmable input/output port (5)

    29 PIO(6) Two way Programmable input/output port (6)

    30 PIO(7) Two way Programmable input/output port (7)

    31 PIO(8) Output Status indicator LED port 1

    32 PIO(9) Output Status indicator LED port 2

    33 PIO(10) Two way Programmable input/output port (10)

    34 PIO(11) Input

    Module state switching pin,

    High level -> AT command responds to working

    status;

    Low level or floating -> Bluetooth normal working

    status.

    10. Dimensions:

  • Best Bang For Your Buck

    www.banggood.com 6

    11. Serial port module pin definition:

    1. PIO(8) connects to the LED to indicate the working status of the module. Themodule flashes after power-on, and the different states flash differently.2. PIO (9) is connected to the LED to indicate that the module is successfullyconnected. After the Bluetooth serial port is successfully connected, the LED is on.3. PIO (11) module state switching pin, high level --> AT command response workingstate, low level or floating --> Bluetooth normal working state.4. The reset circuit is already on the module and reset when the power is turnedback on.

    12. Steps to set the master mode:

    1. PIO (11) is set high.2. Upon power-on, the module enters the AT command response state.3. HyperTerminal or other serial port tool, set baud rate 38400, data bit 8 bits, stopbit 1 bit, no parity bit,No flow control.4. The serial port sends the character "AT+ROLE=1\r\n" and successfully returns"OK\r\n", where \r\n is a carriage return line feed.5. PIO (11) is de-asserted, re-powered, the module is the main module, and the slavemodule is automatically searched to establish a connection.

    13. LAYOUT considerations

  • Best Bang For Your Buck

    www.banggood.com 7

    1. BLK-MD-HC-05 Bluetooth module serial port level needs 3.3V, if you connect with5V level system, you need to add level conversion chip.2. Bluetooth signals are greatly affected by the surrounding, such as trees, metal,walls and other obstacles will absorb or shield the Bluetooth signal, so it is notrecommended to install in the metal casing.3. Since the metal will weaken the antenna function, it is recommended that whenthe module is given to the Lay board, the ground under the module antenna shouldnot be laid and routed. It is best to hollow out.

    AT instruction set

    The BLK-MD-HC-05 embedded Bluetooth serial communication module has twoworking modes: command response working mode and automatic connectionworking mode. In the automatic connection working mode, the module can bedivided into master, slave and loopback three working roles.When the module is in the automatic connection working mode, it will automaticallytransfer data according to the preset setting; when the module is in the commandresponse working mode, it can execute all the AT commands described below, andthe user can send various AT commands to the module as modules. Set controlparameters or issue control commands. The dynamic conversion of the module'soperating state can be achieved by controlling the input level of the module'sexternal pin (PIO11).

    The pin definition used by the serial port module:1. PIO8 is connected to the LED to indicate the working status of the module. Themodule flashes after power-on, and the different states flash differently.2. PIO9 is connected to the LED to indicate that the module is successfully connected.After the Bluetooth serial port is successfully connected, the LED is on.3. PIO11 module status switching pin, high level --> AT command response workingstatus, low level or floating --> Bluetooth routineState.4. The reset circuit is already on the module and reset when the power is turnedback on.

    Steps to set up as the main module:1. PIO11 is set high.2. Upon power-on, the module enters the AT command response state.3. HyperTerminal or other serial port tool, set baud rate 38400, data bit 8 bits, stopbit 1 bit, no parity bit,No flow control.4. The serial port sends the character "AT+ROLE=1\r\n" and successfully returns"OK\r\n", where \r\n is a carriage return line feed.

  • Best Bang For Your Buck

    www.banggood.com 8

    5. PIO is set low, power is turned back on, the module is the main module, and theslave module is automatically searched to establish a connection.

    Detailed instructions

    (AT commands are not case sensitive and end with carriage return, newlinecharacters: \r\n)

    1. Test instructions:Command Response Parameter

    AT OK /

    2. Module reset (restart):Command Response ParameterAT+RESET OK /

    3. Obtain the software version number:Command Response Parameter

    AT+VERSION?+VERSION:OK

    Param: Software versionnumber

    for example:At+version?\r\n+VERSION:2.0-20100601OK

    4. Restore default state:Command Response ParameterAT+ORGL OK /

    Factory default state:1. Equipment class: 02. Search code: 0x009e8b333. Module Job Role: Slave Mode4. Connection mode: Specify the dedicated Bluetooth device connection mode5. Serial Port Parameter: Baud Rate - 38400bits/s; Stop Bit: 1 bit; Check Digit: /6. Pairing code: "1234"7. Equipment name: "H-C-2010-06-01"... ...

    5. Get module Bluetooth address:Command Response Parameter

    AT+ADDR?+ADDR:

    OKParam: Bluetooth address

    Bluetooth address representation method: NAP: UAP: LAP (hexadecimal)for example:

  • Best Bang For Your Buck

    www.banggood.com 9

    The module Bluetooth device address is: 12:34:56:ab:cd:efAt+addr?\r\n+ADDR:1234:56:abcdefOK

    6. Set/query device name:

    E.g:AT+NAME=HC-05\r\n ——Set the module device name: "HC-05"OKAT+NAME="HC-05"\r\n - Set the module device name to "HC-05"OKAt+name=Beijin\r\n ——Set the module device name: "Beijin"OKAt+name="Beijin"\r\n - Set the module device name to "Beijin"OKAt+name?\r\n+NAME: Bei jinOK

    7. Get the remote Bluetooth device name:Command Response Parameter

    AT+RNAME?

    1. +NAME:OK——Success

    2. FAIL——Failure

    Param1: Remote Bluetoothdevice address

    Param2: Remote Bluetoothdevice address

    Bluetooth address representation method: NAP: UAP: LAP (hexadecimal)E.g:The module Bluetooth device address is: 00:02:72:od:22:24, the device name is:BluetoothAt+rname? 0002,72,od2224\r\n+RNAME: BluetoothOK

    8. Setup / Query - Module Role:Command Response Parameter

    AT+ROLE= OK Param:Parameter takes thefollowing values:AT+ ROLE? + ROLE:

    Command Response ParameterAT+NAME= OK

    Param:Bluetooth device nameDefault name:"HC-05"AT+NAME?

    1. +NAME:OK——Success

    2. FAIL——Failure

  • Best Bang For Your Buck

    www.banggood.com 10

    0 - from the role (Slave)1 - Master role (Master)

    2 - Loopback role(Slave-Loop)Default: 0

    OK

    Module role description:Slave - passive connection;Slave-Loop - passive connection, receiving remote Bluetooth master data andreturning the data to the remote Bluetooth master as it is;Master - Query the surrounding SPP Bluetooth slaves and initiate a connection toestablish a transparent data transmission channel between the master and slaveBluetooth devices.

    9. Settings / Query - Device Class:Command Response Parameter

    AT+CLASS= OK Param:Parameter takes thefollowing values:

    Param: Equipment classThe Bluetooth device class is

    actually a 32 bitParameter, the Parameter isused to indicate the device

    classType, and the type of service

    supported.Default: 0

    AT+ CLASS?

    1. + CLASS:OK——Success

    2. FAIL——Failure

    In order to effectively filter the surrounding Bluetooth devices, quickly query orquery the custom Bluetooth device, the user can set the module to a non-standardBluetooth device class, such as: 0x1f1f (hexadecimal).

    10. Device / Query - Query Access Code:Command Response Parameter

    AT+IAC= 1. OK——Success2. FAIL——Failure

    Param: Query access codeDefault: 9e8b33

    See Appendix 2 for specificsettings: Query Access Code

    DescriptionAT+ IAC?

    +IAC:OK

    The access code is set to GIAC (General Inquire Access Code: 0x9e8b33) generalquery access code, which can be usedDiscovered or found all Bluetooth devices around; in order to efficiently query or bequeried in many Bluetooth devices aroundCustomize the Bluetooth device, the user can set the module query access code to anumber other than GIAC and LIAC, such as: 9e8b3f.Example:

  • Best Bang For Your Buck

    www.banggood.com 11

    AT+IAC=9e8b3f\r\nOKAT+IAC?\r\n+IAC: 9e8b3fOK

    11. Settings / Query - Query Access Mode:Command Response Parameter

    AT+INQM=,,

    1. OK——Success2. FAIL——Failure

    Param: Query mode0—inquiry_mode_standard1——inquiry_mode_rssiParam2: Maximum number

    of Bluetooth deviceResponses

    Param3: Maximum querytimeout

    Timeout range: 1 to 48(recombination time: 1.28seconds to 61.44 seconds)

    Default: 1, 1, 48

    AT+ INQM?

    +INQM:,,

    OK

    Example:AT+INQM=1,9,48\r\n——Query mode setting: with RSSI signal strength indication,more than 9 Bluetooth devices ResponseTo terminate the query, set the timeout to 48xl. 28=61.44 seconds.OKAT+INQM\r\n+INQM: 1, 9, 9, 48OK

    12. Settings / Query - Pairing Code:Command Response Parameter

    AT+PSWD= OKParam: Pairing codeDefault name:"1234"AT+ PSWD?

    + PSWD :OK

    13. Setup / Query - Serial Parameters:Command Response Parameter

    AT+UART=,, OK Param1: baud rate(bits/s)

    The values are asfollows (decimal):

    4800960019200

    AT+ UART?

    +UART=,,

    OK

  • Best Bang For Your Buck

    www.banggood.com 12

    3840057600115200234004608009216001382400

    Param2: stop bit0 - 1 bit

    1 - 2 digitsParam3: check

    digit0——None1 - Odd

    2——EvenDefault setting:9600, 0, 0

    Example: Set the serial port baud rate: 115200, 2 stop bits, Even checkAT+UART=115200,1,2,\r\nOKAT+UART?+UART: 115200, 1, 2OK

    14. Settings / Query - Connection Mode:Command Response Parameter

    AT+CMODE= OK Param:0 - specify the Bluetoothaddress connection mode

    (Specify the Bluetooth addressset by the binding Command)1——any Bluetooth address

    connection mode(not bound by the address setby the bound Command)

    2 - Loopback role(Slave-Loop)

    Default connection mode: 0

    AT+ CMODE?+ CMODE:

    OK

    15. Set / Query - Bind Bluetooth Address:Bluetooth address representation method: NAP: UAP: LAP (hexadecimal)

    Command Response ParameterAT+BIND= OK Param - Bind Bluetooth

    addressAT+ BIND? + BIND:

  • Best Bang For Your Buck

    www.banggood.com 13

    Default binding Bluetoothaddress:

    00:00:00:00:00:00

    OK

    Bluetooth address representation method: NAP: UAP: LAP (hexadecimal)Binding Command is only valid when the Bluetooth address connection mode isspecified!for example:In the specified Bluetooth address connection mode, bind the Bluetooth deviceaddress: 12:34:56:ab:cd:efThe command and Response are as follows:AT+BIND=1234,56,abcdef\r\nOKAT+BIND?\r\n+BIND:1234:56:abcdefOK

    16. Setup / Query - LED indicates drive and connection status output polarity:Command Response Parameter

    AT+POLAR=,

    OK Param1: The value is asfollows

    0——PI08 output low levelLED

    1——PI08 output high levelLED

    Param2: The value is asfollows

    0——PI09 output low levelindicates connection Success1——PI09 output high levelindicates connection Success

    Default setting: 1,1

    AT+ BIND?

    + POLAR=,

    OK

    HC-05 Bluetooth module definition: PI08 output drive LED indicates working status;PI09 output indicates connection status.for example:PI08 output low level LED, PI09 output high level indicates connection Success.The command and Response are as follows:AT+POLAR=0,1\r\nOKAT+POLAR?\r\n+POLAR=0,1OK

    17. Set PIO single port output:Command Response Parameter

  • Best Bang For Your Buck

    www.banggood.com 14

    AT+PIO=,

    OK

    Param1: PIO port number(decimal number)

    Param2: PIO port output status0——low level1 - high level

    The HC-05 Bluetooth module provides users with PIO port resources: PI00~PI07 andPI010, which users can use to expand the input.Output port.for example:1. PI010 port output high levelAT+PI0=10,1\r\nOK2. PI010 port output high levelAT+PI0=10,0\r\nOK

    18. Set PIO multiport output:Command Response Parameter

    AT+MPIO= OKParam: PIO port serial numbermask combination (decimal

    number)The HC-05 Bluetooth module provides users with PIO port resources: PI00~PI07 andPI010, which can be used by the user to expand the input. Output port.PIO port number mask = (1

  • Best Bang For Your Buck

    www.banggood.com 15

    19. Query PIO port input:

    The HC-05 Bluetooth module provides users with PIO port resources: PI00~PI07 andPI010~PI011, which can be used by the user to expand the input and output ports.

    20. Settings / Query - Page Scan, Query Scan Parameters:Command Response Parameter

    AT+IPSCAN=,,

    ,AT+IPSCAN?

    OK+IPSCAN: ,

    ,,

    OK

    Param1: Query intervalParam2: Query durationParam3: paging intervalParam4: paging duration

    The above Parameters are alldecimal numbers.

    Default: 1024, 512, 1024, 512for example:At+ipscan=1234,500,1200,250\r\nOKAt+ipscan?+IPSCAN: 1234, 500, 1200, 250

    21. Settings / Query - SHIFF energy saving parameters:Command Response Parameter

    AT+SNIFF=,,

    ,OK

    Param1: maximum timeParam2: minimum time

    Param3: Try timeParam4: Timeout

    The above Parameters are alldecimal numbers.Default: 0,0,0,0

    AT+IPSCAN?

    +SNIFF: , ,

    22. Set/Query Security and Encryption Mode:Command Response Parameter

    AT+SENM=,,1. OK——Success2. FAIL——Failure

    Param: Safe mode, the values areas follows:

    Command Response Parameter

    AT+MPIO?+MPIO:

    OK

    Param - PIO port value(16bits)

    Param[0]=PI00Param[1]=PI01Param[2]=PI02

    ⋯ ⋯

    Param[10]=PI010Param[11]=PI011

  • Best Bang For Your Buck

    www.banggood.com 16

    0--sec_mode0+off1--sec_mode1+non_secure2--sec_mode2_service3--sec_mode3_link

    4--sec_mode_unknownParam2 encryption mode, the

    values are as follows:0--hci_enc_mode_off

    1--hci_enc_mode_pt_to_pt2--hci_enc_mode_pt_to_pt_and_b

    castDefault: 0,0

    AT+ SENM?

    +SENM:,,OK

    23. Remove the specified authentication device from the Bluetooth pairing list:Command Response Parameter

    AT+PMSAD= OK Param: Bluetooth deviceaddress

    for example:Remove the device with the Bluetooth address: 12:34:56:ab:cd:ef from the pairinglistAt+rmsad=1234,56,abcdef\r\nOK - delete SuccessorAt+rmsad=1234,56,abcdef\r\nFAIL - 12:34:56:ab:cd:ef Bluetooth device does not exist in the pairing list

    24. Remove all Authenticated Devices from the Bluetooth pairing list:Command Response Parameter

    AT+RMAAD OK /for example:Remove all Bluetooth devices from the pairing listAt+rmaad\r\nOK

    25. Find the specified authentication device from the Bluetooth pairing list:Command Response Parameter

    AT+FSAD=1. OK——Success2. FAIL——Failure

    Param: Bluetooth deviceaddress

    for example:Find Bluetooth devices from the pairing list: 12:34:56:ab:cd:efAt+fsad=1234,56,abcdef\r\nOK - There is a 12:34:56:ab:cd:ef Bluetooth device in the pairing list.At+fsad=1234,56,abcde0\r\nFAIL - There is no 12:34:56:ab:cd:e0 Bluetooth device in the pairing list.

  • Best Bang For Your Buck

    www.banggood.com 17

    26. Obtain the number of authenticated devices in the Bluetooth pairing list:Command Response Parameter

    AT+ADCN?+ADCN:

    OKParam: Number of Bluetoothdevices in the pairing list

    for example:At+adcn?+ADCN: 0 - no Bluetooth device in the pairing trust listOK

    27. Obtain the most recently used Authenticated Device:Command Response ParameterAT+MRAD? + MRAD :

    OKParam: Recently used

    Bluetooth device addressfor example:At+mrad?+MRAD: 0:0:0 - no trusted Bluetooth devices have been used recentlyOK

    28. Get the working status of the Bluetooth module:Command Response Parameter

    AT+STATE?+ STATE:

    OK

    Param: module working statusThe return value is as follows:"INITIALIZED"--initial state

    "READY" - ready state"PAIRABLE" - pairable status"PAIRED" - pairing status

    "INQUIRING" - query status"CONNECTING" - the

    connection status"CONNECTED" - connection

    status"DISCONNECTED" -disconnected state

    "NUKNOW" - unknown state

    for example:At+state?+STATE:INITIALIZED - Initialization state

  • Best Bang For Your Buck

    www.banggood.com 18

    OK

    29. Initialize the SPP specification library:Command Response Parameter

    AT+INIT1. OK——Success2. FAIL——Failure

    /

    30. Query Bluetooth devices:Command Response Parameter

    AT+INQ

    +INQ: , ,,

    ⋯⋯

    OK

    Param1: Bluetooth addressParam2: device class

    Param3: RSSI signal strength

    Example 1:At+init\r\n - Initialize the SPP library (cannot be initialized repeatedly)OKAt+iac=9e8b33\r\n - Query the Bluetooth device of any access codeOKAt+class=0\r\n - query various Bluetooth device classesAt+inqm=1,9,48\r\n ——Query mode: with RSSI signal strength indication, more than9 Bluetooth devices Response will terminate the query, set the superThe time is 48x1.28=61.44 seconds.At+inq\r\n - Query peripheral Bluetooth devices+INQ: 2:72:D2224,3E0104,FFBC+INQ: 1234:56:0,1F1F,FFC1+INQ:1234:56:0,1F1F,FFC0+INQ: 1234:56:0,1F1F,FFC1+INQ: 2:72:D2224,3F0104,FFAD+INQ: 1234:56:0,1F1F, FFBE+INQ: 1234:56:0,1F1F, FFC2+INQ: 1234:56:0,1F1F, FFBE+INQ: 2:72:D2224,3F0104,FFBCOK

    Example 2:At+iac=9e8b33\r\n - Query the Bluetooth device of any access codeOKAt+class=1f1f\r\n - Query the Bluetooth device with device class 0x1f1fOKAt+inqm=1,9,48\r\n ——Query mode: with RSSI signal strength indication, more than9 Bluetooth devices Response will terminate the query, set the superThe time is 48x1.28=61.44 seconds.At+inq\r\n - Filter. Query peripheral Bluetooth devices+INQ: 1234:56:0,1F1F, FFC2

  • Best Bang For Your Buck

    www.banggood.com 19

    +INQ: 1234:56:0,1F1F,FFC1+INQ: 1234:56:0,1F1F,FFC1+INQ: 1234:56:0,1F1F,FFC1+INQ: 1234:56:0,1F1F, FFC2+INQ: 1234:56:0,1F1F,FFC1+INQ: 1234:56:0,1F1F,FFC1+INQ:1234:56:0,1F1F,FFC0+INQ: 1234:56:0,1F1F, FFC2OK

    Example 3:At+iac=9e8b3f\r\n ——Query the Bluetooth device with access code 0x9e8b3fOKAt+class=1f1f\r\n - Query the Bluetooth device with device class 0x1f1fOKAt+inqm=1,1,20\r\n ——Query mode: with RSSI signal strength indication, more than1 Bluetooth device Response will terminate the query, set the superThe time is 20x1.28=25.6 seconds.At+inq\r\n - Filter. Query peripheral Bluetooth devices+INQ:1234:56:ABCDEF,1F1F,FFC2OK

    31. Cancel the inquiry of Bluetooth devices:Command Response ParameterAT+INQC OK /

    32. Device pairing:Command Response Parameter

    AT+PAIR=,1. OK——Success2. FAIL——Failure

    Param1: Remote deviceBluetooth address

    Param2: Connection timeout(seconds)

    for example:Paired with a remote Bluetooth device: 12:34:56:ab:cd:ef, the maximum pairingtimeout is 20 seconds.At+pai=1234,56,abcdef,20\r\nOK

    33. Equipment connection:Command Response Parameter

    AT+LINK=1. OK——Success2. FAIL——Failure

    Param: Remote deviceBluetooth address

    for example:Establish a connection with the remote Bluetooth device: 12:34:56:ab:cd:ef

  • Best Bang For Your Buck

    www.banggood.com 20

    At+fsad=1234,56,abcdef\r\n——Query whether the Bluetooth device12:34:56:ab:cd:ef is in the pairing listOKAt+link=1234,56,abcdef\r\n——Query the Bluetooth device 12:34:56:ab:cd:ef in thepairing list, you can connect directly without query.OK

    34. Disconnect:Command Response Parameter

    AT+DISC

    1. +DISC:SUCCESS - Disconnect SuccessOK2. +DISC: LINK_LOSS - connection lostOK3. +DISC: NO_SLC - no SLC connectionOK4. +DISC: TIMEOUT - disconnect timeoutOK5. +DISC:ERROR - disconnect errorOK

    /

    35. Enter the energy saving mode:Command Response Parameter

    AT+ENSNIFF= OK Param: Device Bluetoothaddress

    36. Exit the energy saving mode:

    Command Response ParameterAT+EXSNIFF= OK Param: Device Bluetooth

    address

    Appendix 1: ATCommand Error Code DescriptionError code return form - ERROR: (error_code)

    error_code (hexadecimal number) Comment0 AT command error1 Command result is the default value2 PSKEY write error3 Device name is too long (more than 32 bytes)4 Device name length is zero5 Bluetooth address: NAP is too long6 Bluetooth address: UAP is too long7 Bluetooth address: LAP is too long8 PIO sequence number mask length is zero9 Countless PIO serial numbers

  • Best Bang For Your Buck

    www.banggood.com 21

    A Device class length is zeroB Device class number is too longC Query access code length is zeroD The query access code number is too longE Invalid query access codeF Pairing code length is zero10 Pairing code is too long (more than 16 bytes)11 Module role is invalid12 Invalid baud rate13 Invalid stop bit14 Check digit is invalid15 No authentication device exists in the pairing

    list16 SPP library is not initialized17 SPP library repeated initialization18 Invalid query mode19 Query timeout too large1A Bluetooth address is zero1B Invalid security mode1C Invalid encryption mode

    Appendix 2: Device Class DescriptionThe Class of Device/Service(COD)is a 32 bifs number that of 3 field specifies theservice supported by the device. Another field spcifies the minor device class, whichdescrbes the device type in more detailThe Class of Device /Service (CoD) field has a variable format. The format isindicated using the ’within the CoD .The length of the Format Type field is variableand ends with two bits different from’11’.The version field starts at the leastsignificant bit of the CoD and may extend upwards. In the ’format#1’ of the CoD(format Type field =00), 11 bits are assigned as a bit –mask(mulfiple bits can beset) each bit corresponding to a high level generic category of service class.Currently 7 categories are defined. These are primarily of a’ public service’nature. The remaining 11 bits are used to indicate device type category and otherdevice-specific characteristics. Any reserved but otherwise unassigned bits, suchas in the Major Service Class field, should be to 0.Figure 1.2: The Class of Device/Service field (format type). Please note the krderin which the octets are sent on the air and stored in memory. Bit number 0 is sentfirst on the air .1. MAJOR SERVICE CLASSESBit no Major Service Class13 Limited Discoverable Mode [Ref #1]14 (reserved)15 (reserved)16 Positioning(Location identification)

  • Best Bang For Your Buck

    www.banggood.com 22

    17 Networking (LAN,Ad hoc, ⋯ )18 Rendering (Printing ,Speaker,⋯19 Capturing (Scanner,Misrophone,⋯20 0bject Transfer (v-Inbox, v-Folder,⋯21 Audio (Speaker,Microphone,Headset service,⋯22 Telephony (Cordless telephony, Modem, Headset service,⋯23 Imformation (WEB-server, WAP- server,⋯TABLE 1.2:MAJOR SERVICE CLASSES[Ref #1 As defined in See Generic Access Profile,Bluetooth SIG]2. MAJOR DEVICE CLASSESThe Major Class segment is the highest level of granularity for defining a BluetoothDevice. The main function of a device is used to determine the major Class grouping.There are 32 different possible major classes. The assignment of this Major Classfield is defined in Table1.3.1 2 1 1 1 0 9 8 Major Device Class0 0 0 0 0 Miscel laneous [Ref #2]0 0 0 0 1 Computer (desktop, notebook,PDA, organizers,⋯0 0 0 1 0 Phone (cellular ,cordless ,payphone,modem,⋯0 0 0 1 1 LAN/Network Access point0 0 1 0 0 Audio/Video (headset,speaker,stereo, video display, vcr ⋯0 0 1 0 1 Periphereal (mouse, joystick, keyboards.⋯0 0 1 1 0 Imaging (printing, scanner, camera, display,⋯1 1 1 1 1 Uncategorized, specific device code not specifiedX X X X All other values reservedTABLE 1.3: MAJOE DEVICE CLASSES[Ref #2:Used where a more specific Major Device Class is not suited (but only asspecifiedas in this document) .Devices that do not have a major class assigned canuse the all-1 code until’ classified’]3. THE MINOR DEVICE CLASS FIELDThe’ Minor Device Class field’ (bits 7 to 2 in the CoD ), are to be interpretedonly in the context of the Major Device Class (but interpreted of the Service Classfield). Thus the meaning of the bits may change, depending on the value of the ’Major Device Class field’. When the Minor Device Class field indicates a deviceclass ,then the primary decvice class should be reported, e. g . a cellular phonethat can work as a cordless handset should4. MINOR DEVICE CLASS FIELD–COMPUTER MAJOR CLASSMinor Device Class7 6 5 4 3 2 bit no of CoD0 0 0 0 0 0 Uncategorized,code for device nof assigned0 0 0 0 0 1 Desktop workstation0 0 0 0 1 0 Server-class computer0 0 0 0 1 1 Laptop0 0 0 1 0 0 Handheld PC/PDA(clam shell)0 0 0 1 0 1 Palm sized PC/PDA

  • Best Bang For Your Buck

    www.banggood.com 23

    0 0 0 1 1 0 Wearable computer (Watch sized)X X X X X X All other values reservedTABLE 1.4: SUB DEVICE CLASS FIELD FOR THE’ COMPUTER ’MAJOR CLASS5. MINOR DEVICE CLASS FIELD – PHONE MAJOR CLASSMinor Device Class7 6 5 4 3 2 bit no of CoD0 0 0 0 0 0 Uncategorized,code for device not assigned000001 Cellular0 0 0 0 1 0 Cordless0 0 0 0 1 1 Smart phone0 0 0 1 0 0 Wired modem or voice gateway0 0 0 1 0 1 Common ISDN Access0 0 0 1 1 0 Sim Card ReaderX X X X X X All other values reservedTABLE1.5: SUB DEVICE CLASSES FOR THE’PHONE’ MAJOR CLASS6. MINOR DEVICE CLASS FIELD –LAN/NETWORK ACCESS POINE MAJOR CLASSMinor Device Class7 6 5 bit no of CoD0 0 0 Fully available0 0 1 1 – 17% utilized0 1 0 1 7 - 33% utilized0 1 1 3 3 – 50% utilized1 0 0 5 0 – 67% utilized1 0 1 6 7 – 83% utilized1 1 0 8 3 – 99% utilized1 1 1 No service available [REF #3]XXX All other values reservedTABLE1.6: THE LAN/NETWORK ACCESS POINE LOAD FACTOR FIELD[Ref #3:"Device is fully utilized and cannot accept additional connections at thistime, please retry later"]The exact loading formula is not standardized. It is up to each LAN/Network AccessPoint implementation to determine what internal conditions to report as autilization of communication requirement is that the box .As a recommendation, aclient that locates multiple LAN/Network Access Points should attempt to connectto the one reporting the lowest load.Minor Device Class4 3 2 bit no of CoD0 0 0 Uncategorized (use this value if no other apply )XXX All other values reservedTABLE1.7:RESERVED SUB-FIELD FOR THE LAN/NETWORK ACCESS POINE7. MINOR DEVICE CLASS FIELD – AUDIO/VIDEO MAJOR CLASSMinor Device Class7 6 5 4 3 2 bit no of CoD0 0 0 0 0 0 Uncategorized,code not assigned

  • Best Bang For Your Buck

    www.banggood.com 24

    0 0 0 0 0 1 Device conforms to the Headset profile000010 Hands-free0 0 0 0 1 1 (Reserved )0 0 0 1 0 0 Microphone0 0 0 1 0 1 Loudspeaker0 0 0 1 1 0 Headphones0 0 0 1 1 1 Portable Audio0 0 1 0 0 0 Car audio0 0 1 0 0 1 Set-top box0 0 1 0 1 0 HiFi Audio Device001011 VCR0 0 1 1 0 1 Camcorder0 0 1 1 1 0 Video Monitor0 0 1 1 1 1 Video Display and Loudspeaker0 1 0 0 0 0 Video Conferencing0 1 0 0 0 1 (Reserved)0 1 0 0 1 0 Gaming/Toy [Ref #4]X X X X X X All other values reserved[Ret #4: Only to be used with a Gaming/Toy device that makes audio/videocapabilitiesavailable via Bluetooth]TABLE 1.8: SUB DEVICES FOR THE ’AUDIO/VIOEO’MAJOR CLASS8. MINOR DEVICE CLASS FIELD – PERIPHERAL MAJOR CLASSMinor Device Class7 6 bit no of CoD0 1 Keyboard1 0 Pointing device1 1 Combo keyboard /pointing deviceX X X All other values reservedTABLE1.9: THE PERIPHERAL MAJOR CLASS KEYBOARD/POINTING DEVICE FIELDBits 6 and 7 independantly specify mouse, keyboard or combo mouse/keyboarddevices.These may be combined with the lower bits in a multifunctional decice.Minor Device Class5 4 3 2 bit no of CoD0 0 0 0 Uncategorized device0 0 0 1 Gamepd0 0 1 1 Remote control0 1 0 0 Sensing device0 1 0 1 Digitizer tabletX X X X All other values reservedTABLE1.10: RESERVED SUB-FIELD FOR THE DEVICE TYPE9. MINOR DEVICE CLASS FIELD – IMAGING MAJOR CLASSMinor Device Class

  • Best Bang For Your Buck

    www.banggood.com 25

    7 6 5 4 bit no of CoDX X X 1 DisplayX X 1 X CameraX 1 X X Scanner1 X X X PrinterX X X X All other values reservedTABLE 1.11: THE TMAGING MAJOR CLASS BITS 7 TO 7Bits 4 to 7 independent ly specify bi splay, camera, scanner or printer. These maybe combined in a multifunctional device.Minor Device Class3 2 bit no of CoD0 0 Uncategorized, defaultX X All other values reservedTABLE 1. 12: THE IMAGING MAJOR CLASS BITS 2 AND 3Bits 2 and 3 are reserved

    Appendix 3: The Inquiry Access Codes

    The General-and Device-Specific Inquiry Access Codes (DIACs)The Inquiry Access Code is the first level of filtering when finding BluetoothThe main purpose of defining multiple IACs is to limit the number ofReply that are received when scanning devices within range.0. 0x9E8B33 -- General/Unlimited Inquiry Access Code (GIAC)1. 0x9E8B00 - Limited Dedicated Inquiry Access Code (LIAC)2. 0x9E8B01 ~ 0x9E8B32 RESERVED FOR FUTURE USE3. 0x9E8B34 ~ 0x9E8B3F RESERVED FOR FUTURE USEThe Limited Inquiry Access Code(LIAC)is only intended to be used for limited timePeriods in scenarios where both are have been explicitly caused to enter this state,Usually by user action. For further explanation of the use of the LIAC, please referTo the Generic Access Profile.In contrast it is allowed to be continuously scanning for the General Inquiry AccessCode (GIAC) and respond whenever inquired.

    HC-05AT instruction set