当前位置:网站首页>Bluetooth hc-05 pairing process and precautions
Bluetooth hc-05 pairing process and precautions
2022-07-05 08:00:00 【Drink more hot water-】
bluetooth HC-05 Pairing process and precautions
such MCU The Bluetooth module used has been integrated , One module is the host , A slave , Send directly through serial port after pairing , The other end of the serial port can receive , Equivalent to one Wireless serial port , It's often said that it's transparent , It's quite simple
【5 I played it years ago Come back and write notes I'm really old 】
To use AT command , The first thing to know is HC-05 Baud rate , And then get into AT Command mode .
Three elements must be known when using serial port , One is baud rate , Second, serial port number , Third, data format ,
HC-05 Only one data format is supported : Data bits 8 position , Stop bit 1 position , No parity bit , No flow control
BOM:
2 individual HC-05, One or 2 A serial port module
Get into AT There are two ways to command :
1, Press and hold the key or EN Pull your feet up , At this time, the light flashes slowly ,SPP-05 Get into AT Command mode , The default baud rate is 38400;
This pattern is called primitive pattern . The original mode has been in AT Command mode status .
2,HC-05 Power on boot , The red light flashes , Press and hold the key or EN pull up ,HC-05 Get into AT Command mode , Default baud rate
yes 9600; This mode is called normal mode . In normal mode, only press and hold the key or pull it up EN Just in AT Command mode status .
Be careful : If the baud rate is not the correct device ,AT The command is invalid .
Because the master side needs to bind the slave , So first get the slave addr :
be-all AT Instructions , Remember to add enter
AT+ORGL
AT+PSWD="1234"
AT+ROLE=0
AT+ADDR?
AT+UART=9600,0,0
AT+UART?
AT+CMODE=0
The host AT Command list , Also add the carriage return
【 After obtaining the address of the slave , Assigned to the host AT+MIND Used as binding 】, But the address should be " : " Switch to " , "
AT+ORGL
AT+ROLE=1
AT+PSWD="1234"
AT+BIND=0021,04,083DB9
AT+UART=9600,0,0
AT+CMODE=0
Problems encountered
After plugging in , The Bluetooth light flashes slowly , Description enter the original mode , Direct use 38400 Baud rate can be configured
however , perform AT+ORGL after , Or after power on , Bluetooth is flashing , Represents that Bluetooth is in normal mode ,
It's the same thing at this time , send out AT Instructions cannot be accepted , This is because : Flash down to enter AT Pattern , Must be raised EN Or press and hold the key , To enter AT Command mode , At this time, the serial port should be changed to 9600 Hold down EN Can only be AT To configure
All in all :
want AT When it comes to configuration , Slow flashing light , Just use 38400 Baud rate , that will do AT Command pairing
Flash lamp , Just press and hold the button , use 9600 Baud rate of AT Command can
Anyway, how does the goddess' heart beat , We'll just jump along
“------------------------------------------------------------------------------------------------------”
After that, you can send and receive in both directions
The last attached HC-05 Of AT Instructions reference
1,AT+ROLE Set master-slave mode : AT+ROLE? Is to query the master-slave status ;AT+ROLE=1 Is set as the master ,AT+ROLE=0
Is set to start from ,AT+ROLE=2 Set it as a loopback role (Slave-Loop( Loopback character )—— Passive connection , Receive far
Process the Bluetooth master device data and return the data to the remote Bluetooth as it is ). 2,AT+RESET:HC-05 Reset
3,AT+VERSION?: obtain HC-05 Software version number of , Can only get , Do not modify .
4,AT+ORGL: Restore factory default settings , When the module is set disorderly , Use this command to restore the default values .
5,AT+ADDR?: obtain HC-05 Bluetooth address code , Can only get , Do not modify .
6,AT+NAME?: obtain HC-05 Name ,AT+NAME=BSP-06, Change the name of the module to BSP-06, Specifically
The name changes itself .
7,AT+CLASS?: Set the type of query device , Try not to modify this parameter . The default is 1F00. 8,AT+IAC?: Query setting query access code , The default is 9E8B33, Try not to modify this parameter .
9,AT+PSWD?: Query and set the pairing password ,AT+PSWD=”0000”, The password should have double quotation marks , The password is four digits .
10, AT+UART:AT+UART? Is to query the baud rate of the current module ,AT+UART= Baud rate is set .
11, AT+CMODE:AT+CMODE? Is to query the current connection mode .AT+CMODE=0,1,2(0—— finger
Set the Bluetooth address connection mode ( The specified Bluetooth address is set by the binding instruction )1—— Any Bluetooth address connection mode
type ( Not bound by the address set by the binding instruction )2—— Loopback character (Slave-Loop) Default connection mode :
0).
12, AT+BIND:AT+BIND? Query the current binding address ,AT+BIND=NAP,UAP,LAP( Separated by commas ).
13, AT+RMADD: Delete all certified devices from the Bluetooth pairing list .
14, AT+STATE?: Get the working status of Bluetooth module .
15, AT+LINK=NAP,UAP,LAP: Establish a connection with the remote device .
16, AT+DISC: disconnect .
17, AT+RNAME?NAP,UAP,LAP: Get the name of the remote Bluetooth device .
18, AT+ADCN?: Get the number of certified devices in the Bluetooth pairing list .
19, AT+MRAD? Get the recently used Bluetooth authentication device address .
20, AT+INQM: Set query mode ,AT+INQM=1,9,48(1- belt RSSI Signal strength indication ,9- exceed 9 individual
The Bluetooth device responds and terminates the query ,48- Set the timeout to 48*1.28=61.44 second )
边栏推荐
- Relationship between line voltage and phase voltage, line current and phase current
- Measurement fitting based on Halcon learning [III] PM_ measure_ board. Hdev routine
- Can't find real-time chat software? Recommend to you what e-commerce enterprises are using!
- Altium Designer 19.1.18 - 隐藏某一个网络的飞线
- Shell script basic syntax
- Linked list (establishment, deletion, insertion and printing of one-way linked list)
- UEFI development learning 4 - getting to know variable services
- Global and Chinese market of plastic recycling machines 2022-2028: Research Report on technology, participants, trends, market size and share
- Altium designer 19.1.18 - clear information generated by measuring distance
- Global and Chinese markets of nano biosensors 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
Altium designer 19.1.18 - hide the fly line of a network
Halcon's practice based on shape template matching [2]
Record the visual shock of the Winter Olympics and the introduction of the screen 2
Shell script basic syntax
[untitled] record the visual shock of the Winter Olympics and the introduction of the display screen
Extended application of single chip microcomputer-06 independent key
Network communication model -- Network OSI tcp/ip layering
Introduction of air gap, etc
Altium Designer 19.1.18 - 清除测量距离产生的信息
Embedded AI intelligent technology liquid particle counter
随机推荐
生产中影响滑环质量的因素
Extern keyword function
Measurement fitting based on Halcon learning [III] PM_ measure_ board. Hdev routine
Global and Chinese market of urban rail connectors 2022-2028: Research Report on technology, participants, trends, market size and share
Screen record of the opening ceremony of the Beijing winter olympics 2
Count and sort the occurrence times of specific fields through SQL statements
Global and Chinese markets for medical oxygen machines 2022-2028: Research Report on technology, participants, trends, market size and share
Acwing-宠物小精灵之收服-(多维01背包+正序倒序+两种形式dp求答案)
Baiwen 7-day smart home learning experience of Internet of things
Embedded composition and route
Shape template matching based on Halcon learning [viii] PM_ multiple_ models. Hdev routine
[untitled] record the visual shock of the Winter Olympics and the introduction of the display screen
String judgment
C WinForm [realize the previous and next selection pictures] - practice 7
C WinForm [view status bar -- statusstrip] - Practice 2
Some thoughts on extracting perspectives from ealfa and Ebeta
Can't find real-time chat software? Recommend to you what e-commerce enterprises are using!
Embedded AI intelligent technology liquid particle counter
Altium designer 19.1.18 - hide the fly line of a network
Create inf module in AMI code