0% found this document useful (0 votes)
20 views13 pages

User Manual: Bluetooth Serial Communication Module

The HC-04 Bluetooth serial communication module is a dual-mode SPP/BLE 5.0 device designed for data transmission with a frequency of 2.4GHz. It features two sizes, standard and small, and includes various pin definitions for connection and operation. The user manual provides detailed instructions on module settings, electrical characteristics, and AT command usage for configuration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views13 pages

User Manual: Bluetooth Serial Communication Module

The HC-04 Bluetooth serial communication module is a dual-mode SPP/BLE 5.0 device designed for data transmission with a frequency of 2.4GHz. It features two sizes, standard and small, and includes various pin definitions for connection and operation. The user manual provides detailed instructions on module settings, electrical characteristics, and AT command usage for configuration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Translated from Chinese (Simplified) to English - www.onlinedoctranslator.

com

HC-04Bluetooth serial communication module

User ManualV2.4

Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room

Guangzhou Huicheng Information Technology Co., Ltd.

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

Software Version:HC-04 V2.4

release date

2022Year3moon31day

Modification Record

1.RevisionV2.0Firmware versionSPPConnection data is stuckBUG. (2022Year3moon2day)

2.RevisionBLETransferring large amounts of data causes the system to freezeBUG. (2022Year3moon2day)

3.repairV2.0Firmware versionAT+BTMODEInstructions cause the module to freezeBUG. (2022Year3moon2day)

4.RevisionV2.0The firmware version host memory is wrongBUG. (2022Year3moon2day)

5.Add small size module.2022Year3moon2day)

6.improveV2.2VersionBLEcommunication speed and communication compatibility.2022Year3moon31day)

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.

Small size moduleHC-04SDimensions and pin definitions:

HC-04SModules have16Pins, on-boardPCBThe antenna pins are specifically defined in the following table:

Pinout definition I/Odirection illustrate

1 GND Module common ground

2 VCC enter Power pin, requires DC3.3VPower supply, supply current not less than100mA

3 TXD Output UARTOutput port,3.3V TTLLevel


4 RxD Input, weak pull-up UARTInput port,3.3V TTLLevel
5 NC Dangling

6 NC Dangling

7 NC Dangling

8 NC Dangling

9 STATE Output Module connection status indication output pin (Note ②)

10 KEY+ Input, Pull-Down AT command setting footer (Note ④)

11 led Output Module working status indicator output pin (Note ①)

12 KEY- Input, weak pull-up AT command setting footer (Note ③)

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.

Standard size modulesHC-04Dimensions and pin definitions:

HC-04Modules have26Pins, on-boardPCBThe antenna pins are specifically defined in the following table:

Pinout definition I/O Direction illustrate

1 TXD Output URATOutput port,3.3V TTLLevel


2 RxD enter URATInput port,3.3V TTLLevel
3 NC Dangling NC
4 NC Dangling NC
5 NC Dangling NC
6 NC Dangling NC
7 NC Dangling NC
8 NC Dangling NC
9 NC Dangling NC
10 NC Dangling NC
11 RESET Input, weak pull-up The module reset pin must be no less than100msA low level resets

12 VCC enter Power pin,Requires DC3.3VPower supply, supply current not less than100mA

13 GND enter Module common ground

14 LEDCON enter OnboardledLight control pin, ground closedledlamp

15 KEY- Input, weak pull-up ATInstruction setting footer (Note ③)

16 led Output Module working status indicator output pin (Note ①)

17 STATE Output Module connection status indication output pin (Note ②)

18 KEY+ Input, Pull-Down ATInstruction setting footer (Note ④)

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:

parameter Test conditions Reference value

Operating voltage - DC3.0V~3.6V


Not connected 5mA~20mAchange
BLE
Slave Connected about7mA

Working current Not connected 5mA~20mAchange


SPP
Connected about9mA

Not connected about28mA


BLE
Host Connected about7mA

Working current Not connected about16.5mA


SPP
Connected about6.5mA

Module parameter settingsATinstruction

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.

Default factory parameters:

Baud rate9600N81,SPPBluetooth NameHC-04,BLEBluetooth NameHC-04LE;SPPPairing password1234, BLE


There is no pairing code.

1. General Instructions (SPP/BLEAll effective)

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:

parameter Serial port baud ratexx parameter Check digity

? Check the current baud rate

1200 1200bps N No verificationNONE(factory default)

2400 2400bps E Even parityEVEN

4800 4800bps O Odd ParityODD

9600 9600bps(factory default)


19200 19200bps
38400 38400bps
57600 57600bps
115200 115200bps
230400 230400bps
460800 460800bps
921600 921600bps

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.

3, getATCommand version command

instruction AT+VERSION
return www.hc01.com V2.4, 2022-03-31
illustrate Get the official website URL, software version and release date

4, switch light command

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

5, Parameter restore default value command

instruction AT+DEFAULT
return OK
illustrate Restore factory settings

Details The module will automatically restart!

6, module reset instruction

instruction AT+RESET
return OK
illustrate Restart module

Details The module will automatically restart!

7, Modify module mode instructions

instruction AT+BTMODE=x
return OK+BTMODE=x(and reboot)
illustrate Query/set module mode.

?: query
Details 0: Turn off silent mode

1: Turn on silent mode (default)

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.

8, Modify module role instructions

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!

send:AT+ROLE=S return:OK+ROLE=Slave(and restart) Returns:


send:AT+ROLE=M OK+ROLE=SppMaster(and restart) Returns:
Example
send:AT+ROLE=BM OK+ROLE=BleMaster(and restart) Returns:
send:AT+ROLE=? OK+ROLE=BleMaster

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

two,V2.1 SPPPartial instructions

10, Modify Bluetooth name

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.

11, Modify Bluetooth pairing password

instruction AT+PIN=xxxx
return OKsetPIN(and reboot)
illustrate parameterxxxx: The pairing password to be set, limited to16characters or less.

Details The factory default pairing password is:1234.

send:AT+PIN=8888 return:OKsetPIN
Example
send:AT+PIN=? return:OK+PIN=8888

12, Modify Bluetooth address command

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

13, modifyCOD(Device Type) Directive

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

three,V5.0 BLEPartial instructions

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.

15, Modify Bluetooth name

instruction AT+BNAME=xxx
return OKsetBNAME
illustrate Set Bluetooth name

Fill in "?" for query, otherwise it is to set the Bluetooth name.14characters.


Details
DefaultBLEBluetooth Name:HC-04LE

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

16, Modify Bluetooth address command

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

17, Set the module broadcast interval command

instruction AT+AINT=xx
return OK+AINT=xx
illustrate Query/set broadcast interval

xxThe unit is625us(That is, ifxx=1, the broadcast interval is625us*1=625us),scope

Details 32~16000(equivalent to20ms~10s). default100(Right now62.5ms)

enter:AT+AINT=? return:OK+AINT=100
Example
enter:AT+AINT=1600 return:OK+AINT=1600(Change the broadcast interval to1000ms)

18, Set the connection interval command

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.

xx: Minimum connection interval;yy: Maximum connection interval. Unit1.25ms, set

the range6~3199(7.5ms~4s). 1, This value directly affects the actual connection

interval:xx≤Actual connection interval≤yy 2, must meet the conditionsxx≤yy


Details

3, you can enter a parameter separatelyxx,yywill be directly equal toxx.

4,default value:8,11

enter:AT+CINT=? return:OK+CINT=8,11(The minimum connection interval found is

1.25*6=20ms, the maximum connection interval is

Example return:OK+CINT=16,32(Set
1.25*12=20ms) Input:AT+CINT=16,32 20ms~40ms) the connection interval to

enter:AT+CINT=80 return:OK+CINT=80,80(Set the connection interval to100ms)

19, Set the connection timeout instruction

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

20, Set slave delay instruction

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

twenty one, Set up searchUUIDinstruction

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.

defaultFFF0(meaning0xFFF0); the parameter must be in0~FIn range

enter:AT+LUUID=? return:OK+LUUID=FFF0(QueryLUUIDforFFF0)
Example
enter:AT+LUUID=1234 return:OK+LUUID=1234(set upLUUID)

twenty two, set up servicesUUIDinstruction

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)

twenty three, Set up transparent transmissionUUIDinstruction

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

four, query module parameter instructions

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”

OK+ROLE=Slave ) (Current role of module)

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.

connect5VDevice reference circuit

Website:www.hc01.com
Address: Jiangong Road, Tianhe Software Park, Keyun Road, Tianhe District, Guangzhou19Number608room No.12Page

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy