当前位置:网站首页>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 )
边栏推荐
- A complete set of indicators for the 10000 class clean room of electronic semiconductors
- MySQL blind note common functions
- VESC Benjamin test motor parameters
- Pointnet++ classification practice
- Extended application of single chip microcomputer-06 independent key
- Count and sort the occurrence times of specific fields through SQL statements
- Temperature sensor DS18B20 principle, with STM32 routine code
- Win10 shortcut key
- Global and Chinese markets for waste treatment air switches 2022-2028: Research Report on technology, participants, trends, market size and share
- 找不到实时聊天软件?给你推荐电商企业都在用的!
猜你喜欢
C WinForm [exit application] - practice 3
Altium Designer 19.1.18 - 清除测量距离产生的信息
C, Numerical Recipes in C, solution of linear algebraic equations, LU decomposition source program
如何将EasyCVR平台RTSP接入的设备数据迁移到EasyNVR中?
软件设计师:03-数据库系统
C WinForm [change the position of the form after running] - Practical Exercise 4
C language enhancement -- pointer
Makefile application
Cadence simulation encountered "input.scs": can not open input file change path problem
Matlab2018b problem solving when installing embedded coder support package for stmicroelectronic
随机推荐
Detailed explanation of C language pointer
Ten thousand words detailed eight sorting must read (code + dynamic diagram demonstration)
Class of color image processing based on Halcon learning_ ndim_ norm. hdev
研究发现,跨境电商客服系统都有这五点功能!
Significance and requirements of semiconductor particle control
Programming knowledge -- basis of C language
Altium designer 19.1.18 - hide the fly line of a network
[popular science] some interesting things that I don't know whether they are useful or not
Basic embedded concepts
Global and Chinese markets for flexible endoscopic lithotripsy devices 2022-2028: Research Report on technology, participants, trends, market size and share
A complete set of indicators for the 10000 class clean room of electronic semiconductors
Fundamentals of C language
Ads usage skills
Some errors in configuring the environment
Carrier period, electrical speed, carrier period variation
Network port usage
Acwing - the collection of pet elves - (multidimensional 01 Backpack + positive and reverse order + two forms of DP for the answer)
Cadence learning records
Global and Chinese market of digital shore durometer 2022-2028: Research Report on technology, participants, trends, market size and share
PMSM dead time compensation