User Manual: Bluetooth Serial Communication Module
User Manual: Bluetooth Serial Communication Module
com
User ManualV2.4
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room
post code:510665
Telephone:020-84083341
Website: www.hc01.com
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
Version Information
release date
2022Year3moon31day
Modification Record
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.1Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
Product Introduction
HC-04The Bluetooth serial communication module is a new generation ofSPP&BLE5.0Bluetooth dual-mode data transmission module. The
wireless operating frequency band is2.4GHz ISM, the modulation method isGFSKThe maximum transmission power of the module is6dBm, receiving
sensitivity is -92dBm.
The module adopts stamp hole packaging, which can be soldered. The module has two sizes. The standard size module model
is HC-04, module size26.9mm×13mm×2.7mm(with shielding cover); small size module model isHC-04S, Module size
18.5mm×13mm×1.7mm(Without shielding cover). Two sizes of modules are very convenient for customers to embed into the
application system.
HC-04SModules have16Pins, on-boardPCBThe antenna pins are specifically defined in the following table:
2 VCC enter Power pin, requires DC3.3VPower supply, supply current not less than100mA
6 NC Dangling
7 NC Dangling
8 NC Dangling
13 NC Dangling
14 NC Dangling
15 NC Dangling
16 RESET Input, weak pull-up The module reset pin must be no less than100msA low level resets
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.2Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
HC-04Modules have26Pins, on-boardPCBThe antenna pins are specifically defined in the following table:
12 VCC enter Power pin,Requires DC3.3VPower supply, supply current not less than100mA
19 NC Dangling NC
20 NC Dangling NC
twenty one NC Dangling NC
twenty two NC Dangling NC
twenty three led Output Module working status indicator output pin (Note ①)
twenty four STATUS Output Module connection status indication output pin (Note ②)
25 NC Dangling NC
26 KEY+ Input, Pull-Down ATInstruction setting footer (Note ④)
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.3Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
Note ①: The module indicator light output pin, high level output, connected toledPlease connect a resistor in series.
As a slave:
Before connecting,ledEvery200msBright100ms(fast flash), occasionally flash slowly; after
connecting,ledSteady on.
As a host:
Before connecting,
When the host does not record the slave address,ledEvery200msBright100ms(fast flash), occasionally flash slowly;
when the host has recorded the slave address,ledEvery1000msBright500ms(slow flash); After connecting,ledSteady on.
Note ②: Output pin, module connection status indication. Output high level before connection, output low level after connection.
Note ③: Input pin, internal weak pull-up. In the connected state, this pin is connected to a low level to enterATInstruction settings
Mode; connect this pin to high level (or leave it unconnected) to return to serial port transparent transmission mode. If it is a host, connect this pin
to low level, the module will clear the memory first, reset it and then enterATCommand setting mode.
Note ④: Input pin, internally pulled down. In the connected state, this pin is connected to a high level to enterATCommand setting mode
mode; this pin is connected to low level (or left floating) to return to serial port transparent transmission mode. If it is a host, this pin is connected
to high level, the module clears the memory first, resets and then entersATCommand setting mode.
Electrical characteristics:
In the following descriptions, module pins refer toHC-04Standard size module pins,HC-04SFor smaller sizes, please match the pin
positions yourself.
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.4Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
ATThe command is used to set the parameters of the module. The module can be operated when it is not connected.ATAfter connecting,
enter the serial port transparent transmission mode.18Pin set high or15Pin set low100msback, will also enterATInstruction status;18The pin is
set to low level (or left floating) or15The pin is set to high level (or left floating)100msback, will exitAT Command status, return transparent
transmission status.
The module starts up in about200ms, so it is best to power on the module250msWill be carried out laterATInstruction operation.250mSDo not send data to the
module serial port during this time.Unless otherwise specified,ATThe parameter settings of the command take effect immediately. At the same time, the modification of
parameters and functions will not be lost when the power is off.
ATInstruction format:AT+There is no need to add a carriage return or line feed at the end.
1, test communication
send:AT return:OK
2, Change the Bluetooth serial communication baud rate and check bit
instruction AT+BAUD=xx(orAT+BAUD=xx,y)
return OK+BAUD=9600
illustrate Serial port settings, without parametersyIt means keeping the previous check digit.
Details As shown in the following table, the parametersxx,yRepresents baud rate and parity bit respectively.
send:AT+BAUD=? return:OK+BAUD=9600,NONE
Example send:AT+BAUD=19200,E return:OK+BAUD=115200,EVEN
(and reboot)(Set the serial port parameters to: baud rate115200, even parity)
xxIt is the serial port baud rate code.yIs the check digit code, as shown in the following table:
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.5Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
In order to achieve high-speed transmission, it is recommended to select the highest baud rate.SPPmodel/921600Under baud rate conditions, the host and slave
communicate with each other, the master sends to the slave or the slave sends to the master, close distance (1Meters) communication speed can reach60KBytes/sAbove;
Master and slave send and receive at the same time, close distance (1Meters) communication speed can reach40KBytes/sabove.
BLEIn this mode, the master and slave communicate with each other, the master sends to the slave or the slave sends to the master, close distance (1Meters)
communication speed can reach30KBytes/sAbove; master and slave send and receive at the same time, close distance (1Meters) communication speed can reach18KBytes/s
above.
instruction AT+VERSION
return www.hc01.com V2.4, 2022-03-31
illustrate Get the official website URL, software version and release date
instruction AT+LED=x
return OK+LED=x
illustrate Query/SetledWorking mode, takes effect immediately after successful setting. Applicable to the module's internal LED output.
?: query
Details 0:closure
1:Open
instruction AT+DEFAULT
return OK
illustrate Restore factory settings
instruction AT+RESET
return OK
illustrate Restart module
instruction AT+BTMODE=x
return OK+BTMODE=x(and reboot)
illustrate Query/set module mode.
?: query
Details 0: Turn off silent mode
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.6Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
When the silent mode value is set0: When a mobile phone or other Bluetooth device establishes a connection with the module, the module will
prompt a successful connection status message, which means that the silent mode is turned off.
When the silent mode value is set1: It means that the silent mode is turned on and the module will not prompt the current connection status.
instruction AT+ROLE=x
return Slave/SppMaster/BleMaster
Set up the master and slave machines.SSet up the slave (SPP&BLEDual-mode coexistence);Mset upSPPHost (single mode) ;
illustrate
BMset upBLEHost (single mode).
Details The default slave, after setting, the module will automatically restart.250msYou can then perform new operations!
9, The host clears the recorded slave address instruction (only valid for the host)
instruction AT+CLEAR
return OK(and reboot)
illustrate Clear the memory address, which is equivalent to the function of pressing the button
As long as the host has connected to a slave, it will remember the address of the slave that was connected last time.
If you want to connect to another slave, you must clear the currently memorized slave address. There are two ways to clear
Details the memory. The first is to clear the module's18foot(KEY+pin) connected to a high level200mSOr change the module15foot(
KEY-Pin) connected to low level200mSThe above; another way is to enter in the unconnected stateAT+CLEARinstruction.
Example
instruction AT+NAME=xxx
return OKsetNAME
illustrate Set Bluetooth name
Fill in "?" for query, otherwise it is to set the Bluetooth name.16characters or less.
Details
defaultV2.1Bluetooth Name:HC-04
send:AT+NAME=? return:OK+NAME=HC-04
Example send:AT+NAME=www.hc01.com return:OKsetNAME(and reboot)
send:AT+NAME=? return:OK+NAME=www.hc01.com
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.7Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
instruction AT+PIN=xxxx
return OKsetPIN(and reboot)
illustrate parameterxxxx: The pairing password to be set, limited to16characters or less.
send:AT+PIN=8888 return:OKsetPIN
Example
send:AT+PIN=? return:OK+PIN=8888
instruction AT+ADDR=xxxxxxxxxx
return OKsetADDR(and reboot)
illustrate Modify the moduleMACaddress
The address is12Position0~FUppercase characters, i.e.16Only the last 10 digits of the address can be modified, and the first 2
Details
digits are fixed.04. To search, fill in “?”
send:AT+ADDR=? return:OK+ADDR=04xxxxxxxxxx
(Current Bluetooth address of the module)
Example
send:AT+ADDR=2112220001 return:OKsetADDR(and reboot)
send:AT+ADDR=? return:OK+ADDR=042112220001
instruction AT+CLASS=xxxx
return OKsetCLASS(and reboot)
Modify the moduleCOD,The default value is001F00.support6~8PositionCOD,less than6Position,
illustrate
front fill0If there is input except0~FCharacters other thanCODSet to000000.
send:AT+CLASS=? return:AT+CLASS=001F00
(Current device type of the module)
Example
send:AT+CLASS=100680 return:OKsetCLASS
send:AT+CLASS=? return:AT+CLASS=100680
14,set upBLEBroadcast
instruction AT+BLE=x
return OK+BLE=x
illustrate Query/SetBLEWhether to broadcast, the setting will take effect immediately after successful, the defaultOpen Broadcast.
?: query
Details 0:closure
1:Open
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.8Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
instruction AT+BNAME=xxx
return OKsetBNAME
illustrate Set Bluetooth name
send:AT+BNAME=? return:OK+BNAME=HC-04LE
Example send:AT+BNAME=www.hc01.com return:OKsetBNAME
send:AT+BNAME=? return:OK+BNAME=www.hc01.com
instruction AT+BADDR=xxxxxxxxxx
return OKsetBADDR
illustrate Modify the moduleMACaddress
The address is12Position0~FUppercase characters, i.e.16Only the last 10 digits of the address can be modified, and the first 2
Details
digits are fixed.C4. To search, fill in “?”
send:AT+BADDR=? return:OK+BADDR=C4xxxxxxxxxx
(Current Bluetooth address of the module)
Example
send:AT+BADDR=2112220001 return:OKsetBADDR
send:AT+BADDR=? return:OK+BADDR=C42112220001
instruction AT+AINT=xx
return OK+AINT=xx
illustrate Query/set broadcast interval
enter:AT+AINT=? return:OK+AINT=100
Example
enter:AT+AINT=1600 return:OK+AINT=1600(Change the broadcast interval to1000ms)
instruction AT+CINT=xx,yy
return OK+CINT=xx,yy
illustrate Query/set connection interval
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.9Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
4,default value:8,11
Example return:OK+CINT=16,32(Set
1.25*12=20ms) Input:AT+CINT=16,32 20ms~40ms) the connection interval to
instruction AT+CTOUT=xx
return OK+CTOUT=xx
illustrate Query/set connection timeout
unit10ms,scope10~3200(100ms~32s). This value directly affects the disconnection time, that is, the time of "accidental
Details disconnection". (Active disconnection is not affected by this value) default value:200
enter:AT+CTOUT=?return:OK+CTOUT=200 (The
Example query connection timeout is10ms*200=2s) Input:
AT+CTOUT=100 return:OK+CTOUT=100
instruction AT+LATENCY=x
return OK+LATENCY=x
illustrate Query/set slave delay time
Setting range:0~499
Details
default value:0
enter:AT+LATENCY=? return:OK+LATENCY=0
Example
enter:AT+LATENCY=1 return:OK+LATENCY=1
instruction AT+LUUID=xxxx
return OK+LUUID=xxxx
illustrate Query/Set ConnectionUUID(searchUUID)
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.10Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
Due to the large number of Bluetooth devices, most Bluetooth hosts (which have no display and are difficult to select
Details manually) have a search function set up.UUIDFilter. In this case, onlyUUIDOnly the same slaves can be searched.
enter:AT+LUUID=? return:OK+LUUID=FFF0(QueryLUUIDforFFF0)
Example
enter:AT+LUUID=1234 return:OK+LUUID=1234(set upLUUID)
instruction AT+SUUID=xxxx
return OK+SUUID=xxxx
illustrate Query/Setup ServiceUUID
This serviceUUIDIt is the basis for the host to find the service. Only by finding the service can the specific characteristic
Details
value be found. defaultFFE0(meaning0xFFE0); the parameter must be in0~FIn range
enter:AT+SUUID=? return:OK+SUUID=FFE0(QuerySUUIDforFFE0)
Example
enter:AT+SUUID=1234 return:OK+SUUID=1234(set upSUUID)
instruction AT+TUUID=xxxx
return OK+TUUID=xxxx
illustrate Query/set transparent transmissionUUID
This pass-throughUUIDIt must be correct to ensure normal transparent transmission and data sending and
Details
receiving. defaultFFE1(meaning0xFFE1); the parameter must be in0~FIn range
enter:AT+TUUID=? return:OK+TUUID=FFE1(QuerySUUIDforFFE1)
Example
enter:AT+TUUID=1234 return:OK+TUUID=1234(set upSUUID)
4. Comprehensive Instructions
To facilitate the query of module parameters, add1Instructions for querying multiple parameters of a moduleAT+RX, the functions are as follows: twenty
instruction AT+RX
OK+NAME=HC-04 (Module currentSPPBluetooth name, factory default is "HC-04”)
OK+BNAME=HC-04LE (Module currentBLEBluetooth name, factory default is "HC-04LE" )
OK+PIN=1234 (The current pairing password of the module is "1234”)
OK+ADDR=xxxxxxxxxxxx (Module currentSPPBluetooth Address)
return
OK+BADDR=xxxxxxxxxxxx(Module currentBLEBluetooth Address)
OK+BAUD=9600 (The current serial port baud rate of the module is factory defaulted to "9600”
illustrate Query the basic parameters of the module.If the above parameters have been modified, they will be displayed according to the modified parameters!
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.11Page
HC-04 SPP/BLEDual-mode Bluetooth Serial Communication Module User Manual Guangzhou Huicheng Information Technology Co., Ltd.
Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.12Page