当前位置:网站首页>Communication module sorting (II) hc-05
Communication module sorting (II) hc-05
2022-07-24 00:25:00 【FmixZA】
HC-05 Bluetooth module
Module introduction
HC-05 Module is a high-performance master-slave Bluetooth serial port module , It can be paired with a variety of intelligent terminals ( Including all kinds of computers with Bluetooth function 、 Bluetooth Host 、 mobile phone 、PDA、PSP etc. ). This module supports multiple baud rates , And compatible 5V or 3.3V Single chip system , It is flexible and convenient to use .
How to connect
Module export 6 A word , In actual use, connect VCC、GND、RXD、TXD Just four wires :
STATE
RXD—— Single chip microcomputer TX
TXD—— Single chip microcomputer RX
GND——GND
VCC——5V
EN
debugging
HC-05 The Bluetooth serial communication module has two working modes : Command response working mode and automatic connection working mode . In the automatic connection working mode, the module can be divided into main (Master)、 from (Slave) And loop (Loopback) Three job roles .
When the module is in the auto connect operating mode , The data transmission that will be automatically connected according to the preset mode ;
When the module is in command response mode, it can execute AT command , The user can send various messages to the module AT Instructions , Set control parameters or issue control commands for the module .
Enter the command response working mode
Connect the module with USB-TTL Well connected , Open the serial debugging assistant
There are two debugging methods :
1、 Press and hold the button on the module and power on , Put the module into debugging mode , At this time, the baud rate is fixed to 38400
2、 Send when pressing and holding the key AT command , Only one sentence can be sent at a time , You can modify the configuration parameters under the baud rate at work , The baud rate in working state defaults to 9600
It is recommended to use the first debugging method , In addition, pay attention to ,AT There must be \r\n
| Instruction name | Command response | Instruction meaning |
|---|---|---|
| AT | OK | Test instruction |
| AT+RESET | OK | Module reset |
| AT+VERSION | +VERSION: OK | Get the software version number |
| AT+ORGL | OK | Restore default state |
| AT+ADDR? | +ADDR: OK | Get the Bluetooth module address |
| AT+NAME=BLUETOOTH | OK | Set the device name |
| AT+PSWD=“1234” | OK | Get the module password |
| AT+UART=115200,0,0 | OK | Set serial port parameters |
| AT+ROLE= | OK | Select the working mode |
| AT+RMAAD | OK | Clear the pairing list |
| AT+CMODE= | OK | To configure A、B Connection mode |
| AT+BIND= | OK | Bind Bluetooth B Address |
among , There are three parameters of serial port , Baud rate 、 Stop bit 、 Inspection position . Its value is as follows :
| Parameter name | Value |
|---|---|
| Baud rate | 2400、4800、9600、19200、38400、5760、115200、230400、460800、921600、1382400 |
| Stop bit | 0:1 position 1:2 position |
| Check bit | 0:NONE 1:Odd 2:Even |
Working mode of Bluetooth module
AT+ROLE Instructions are used to select HC05 The role of Bluetooth module , There are three roles in total :
| The role type | Configuration instructions | explain |
|---|---|---|
| master | AT+ROLE=0\r\n | Set as slave , Only passive connection |
| slave | AT+ROLE=1\r\n | Set to host , You can query the surrounding SPP Bluetooth slave , And actively connect |
| loop-slave | AT+ROLE=2\r\n | Set to loopback mode , Passive connection , Receive the host data and return the data as it is |
These instructions are used in different situations , When setting the Bluetooth module as a slave , You can connect the device with the relevant Bluetooth serial port software of the mobile phone , To communicate ; When set as the main character , You can search the surrounding Bluetooth slaves , And connect , This mode is commonly used in applications ; Loopback mode is often used for testing .
Communicate with mobile phones
- Bluetooth module and USB-TTL Conversion module connection , Press and hold the key and connect to the computer , Enter the command response working mode
- Open the serial debugging assistant , Set the baud rate of the serial port 38400, Open the serial port , Check send new line
- send out AT+VERSION Return version number , Confirm that the connection is successful
- send out AT+ORGL, Reply to default settings
- send out AT+NAME=HC05 , The configuration module name is HC05
- send out AT+PSWD=“1234” , The configuration module password is 1234
- send out AT+UART=115200,0,0 Set serial port parameters
- send out AT+RESET, Change baud rate 115200( Or power on again )
- Turn on the Bluetooth debugging assistant , Search and connect modules , Send messages to each other
STM32 Communicate with mobile phones through modules
After the configuration is completed, receive USART or UART Pin , It can be used as an ordinary serial port
Transparent transmission between modules
- Prepare two pieces HC-05 Bluetooth module ( The following is called BT-M and BT-S)
- BT-M and BT-S Respective and USB-TTL Conversion module connection , Connect to the computer and enter the command response working mode
- Open two serial port debugging assistants , Set the baud rate of the serial port 38400, Open the serial port , Check send new line
- send out AT+VERSION Return version number , Confirm that the connection is successful
- send out AT+ORGL, Reply to default settings
- send out AT+ADDR, Get the device address and record
- BT-M Address 12:14:1442;BT-S Address 12:14:1443
- Send separately AT+NAME=BT-M and AT+NAME=BT-S , Configuration module name
- send out AT+PSWD=“1234” , The configuration module password is the same
- send out AT+UART=115200,0,0 Set serial port parameters ( Can be different )
- send out AT+ROLE=1,BT-M Select host mode ; send out AT+ROLE=0,BT-S Select slave mode
- send out AT+RMAAD, Clear the pairing list
- send out AT+CMODE=0, To configure BT-M、BT-S Bluetooth connection mode is any address connection mode
- Bind Bluetooth address :AT+BIND=12,14,1443;AT+BIND=12,14,1442( Change colon to comma )
- send out AT+RESET, Change baud rate 115200( Or power on again )
- Wait for the module to match successfully , You can send messages to each other
边栏推荐
- Redis主从同步机制
- MySQL client to server character set conversion
- Problem note - unable to open include file: "direct.h": no such file or directory
- Pytest interface automated test framework | pytest generates simple test reports
- The prediction of domestic AI protein structure reproduced a breakthrough and solved the 3D structure with a single sequence. Peng Jian's team: "the last piece of puzzle since alphafold2 has been comp
- How to improve data quality
- 【电赛训练】非接触物体尺寸形态测量 2020年电赛G题
- Table custom table encapsulation
- [translation] Introduction to go RPC: Hello World
- ansible命令自动补全
猜你喜欢

Inode, soft link, hard link

盘点为下个牛市做准备的10个新Layer1

Docker builds sonarqube, mysql5.7 environment

English grammar_ Demonstrative pronoun - so

Flutter | the easiest way to add header and footer to listview

vulnhub wpwn: 1

PayPal subscription process and API request

Mysql database foundation

Beifeng communication appeared in China (Xiamen) emergency exhibition | intelligent communication means are strong and eye-catching!

Detectron2 installation based on Anaconda under win10
随机推荐
mongodb的多数据源配置
Pytest interface automated testing framework | how to get help
二叉搜索树的简易实现及剖析
Multi data source configuration of mongodb
High number_ Chapter 2 differential calculus of multivariate functions__ Geometric application of partial derivatives_ Tangent and normal plane of space curve
Redis持久化机制RDB、AOF
vulnhub wpwn: 1
[speech synthesis] tensorflowtts Chinese text to speech
GBase 8c 模式可见性查询函数(一)
What are blue-green deployment, Canary release and a/b test
GBase 8c模式可见性查询函数(二)
Tencent cloud was affirmed by international professional streaming media evaluation: video coding performance is the best in all three scenarios
Reverse linked list drawing demonstration
IIS deployment.Netcore
GBase 8c 访问权限查询函数(二)
GBase 8c访问权限查询函数(六)
Scheme for importing XMIND use cases into tapd (with code)
GBase 8c 会话信息函数(五)
【低代码】低代码发展的局限性
Happiness of progress and growth