Bluetooth module
● Bluetooth module description
The Bluetooth module is a high-performance master-slave integrated Bluetooth serial port module. It adopts the Bluetooth 2.0 protocol and can be paired with various smart terminals such as computers, Bluetooth hosts, mobile phones, PDAs, and PSPs with Bluetooth function to realize the serial port transparent transmission function.
When driving the Bluetooth module kit, you only need to use the TTL level standard serial port (5V/3.3V voltage can be used), the supported baud rate range is 4800~1382400, it can be easily connected with the product, and the use is very flexible and convenient.
● Bluetooth module specifications
Project | Bluetooth module description |
---|---|
Interface features | TTL, compatible with 3.3V/5V microcontroller system |
Support baud rate | 4800, 9600 (default), 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1382400 |
Other features | Master-slave integration, command switching, the default is slave. with status indicator, |
Communication distance | 10M (open space) |
Operating temperature | -25℃~75℃ |
Bluetooth module size | 20.37mm*38.84mm |
Operating Voltage | 3.3v~5.0v |
Working current | Pairing: 30~40mA; No communication after pairing: 1~8mA; During communication: 5~20mA Sleep current: less than 1mA |
Frequency band | 2.40GHz-2.48GHz |
Bluetooth module communication protocol | Bluetooth 2.0. With EDR, 2Mbps-3Mbps modulation degree |
Antenna | Onboard 2.4GHz antenna, adaptive frequency hopping technology |
Wireless transmit power | -4~6dBm adjustable (Bluetooth Class2 power level) |
Wireless reception sensitivity | -80dBm |
Bit error rate | 0. But there will be errors in the transmission link, such as RS232 and TTL line processing. |
Application field | Bluetooth to serial port transparently transmit data. |
● Bluetooth module pindescription
The Bluetooth module is very small (20.37mm*38.84mm),The appearance of the Bluetooth module kit is shown in the figure:
As can be seen from the figure, there are 6 available Bluetooth module pin, and the detailed description of each Bluetooth module pin is shown in the table:
Bluetooth module pin name | Function Description |
---|---|
VCC | Power supply (3.3V~5.0v) |
GND | Land |
TXD | Module serial port sending pin (TTL level, not directly connected to RS232 level!), can be connected to the RXD of the microcontroller |
RXD | Module serial port receiving pin (TTL level, not directly connected to RS232 level!), can be connected to the TXD of the microcontroller |
SET | Used to enter the AT state; high level is active (suspended default is low level) |
STA | Pairing status output; output high level if pairing is successful, output low level if not paired |
● Bluetooth module testing
The high quality Bluetooth modulesupports two test methods:
Method 1: Use 1 development board to connect 1 Bluetooth module. Use the Android phone to communicate with the Bluetooth module.
Method 2: Use 2 development boards and connect 1 Bluetooth module kit to each. The Bluetooth serial port transparent transmission communication is carried out between the two development boards.
Users can choose the Bluetooth module testing method according to their own hardware environment. The steps for the two Bluetooth module testing methods are described below.
● Bluetooth communication with Android phone
1.Prepare the Bluetooth module testing environment
Install the "BTClient" APP on your Android phone.
The directory where the BTClient APP is located: "Supporting Software\HC-PDA-ANDROID.apk".
Find the Bluetooth module tutorial "1. Bluetooth test program (with LCD) and 2. Bluetooth test program (without LCD)" in the supporting materials. Both programs can be selected according to your own experimental platform. The programs with liquid crystals need to be connected to the development board with matching liquid crystals., and the program without liquid crystal outputs the running status information through the serial port. Use MDK to compile and download the program to the development board, reset the development board to let the program run.
2. The experimental phenomenon of the normal operation of the Bluetooth module
The LCD screen of the development board will display three lines of text "BlueTooth demo, Bluetooth module detected! Device name: Bluetooth_SLAVE", long press the KEY2 button of the development board (be careful not to press KEY1), a new Bluetooth module name will be randomly generated;
LCD display when the Bluetooth module working is normally
Open the BTClient APP of the mobile phone, open the Bluetooth device of the mobile phone, click the "Connect" button in the lower left corner of the interface, and the "Find Device..." window will pop up. After a while, a Bluetooth device named "Bluetooth_SLAVE" will appear. , this is our Bluetooth module name, click on the device, the APP will try to connect with Bluetooth, enter the pairing code "1234" to connect successfully. The operation of the APP is shown in the figure,
Operation of BTClient on the mobile phone
After the APP is connected to the Bluetooth module kit, the Bluetooth module kit will actively send words like "
After the APP is connected to the Bluetooth module kit, you can use the APP to send data to the development board through Bluetooth. Click the input box in the interface, enter a string, and then click "send" to send the data. After the development board receives the data, it will be displayed on the LCD as it is. (You can enter a carriage return, but the liquid crystal processing in the program only displays the first line of data.)In addition to sending ordinary strings, you can also send commands to the development board to control the LED lights on the development board. The program supporting the development board supports two commands: "AT+LED1=ON" and "AT+LED1=OFF", which are used to light up LED1 on the development board and turn off LED1 respectively. After the development board receives the command, it will display the received command on the LCD and control the LED light. If other commands are required, the user can modify the supporting STM32 program to achieve custom functions. The LCD display of the development board is shown in the figure:
LCD interface when communicating with mobile APP
3. During Bluetooth module not working normal, the LCD screen displays "No HC05 detected!" for troubleshooting, as shown in the figure. At this time, it means that the development board cannot detect the Bluetooth module. Please refer to the Bluetooth module pin connection table to re-check the connection between the Bluetooth module kit and the development board, and power on the development board to re-test.
LCD interface when communicating with mobile APP
● Bluetooth communication between two development boards
1.Prepare the Bluetooth module testing environment.
Connect the two development boards and Bluetooth modules respectively, and find the Bluetooth module tutorial "1. Bluetooth test program (with LCD) and 2. Bluetooth test program (without LCD)" in the supporting materials. For the selection of the experimental platform, the Bluetooth module arduino program with liquid crystal needs to be connected to the matching liquid crystal to the development board, and the program without liquid crystal outputs the running status information through the serial port. Use MDK to compile and download the Bluetooth module arduino program to two development boards, reset the development board to let the program run.
2. The experimental phenomenon of the normal operation of the Bluetooth module.
The LCD screen of the development board will display three lines of text "Bluetooth BlueTooth demo, Bluetooth module detected! Device name: Bluetooth_SLAVE", confirm that the LCDs of the two development boards show this state. As shown in the figure:
Now the Bluetooth modules of the two development boards are in SLAVE mode, and the Bluetooth connection cannot be initiated when the modules are in SLAVE mode.
Select one of the development boards, long press its KEY1 button, and then it will automatically perform the subsequent scanning, pairing, and connection processes. The development board will set its Bluetooth module to MASTER mode, and scan the surrounding Bluetooth devices. If it scans a device whose device name contains the string "Bluetooth", it will initiate a Bluetooth connection. After the connection is successful, the two Bluetooth modules send each other. data, and display the latest data received on the LCD screen. The LCD display of the development board is shown in the figure.
During actual operation, the content of "receive data" displayed on the LCD interface may be slightly different, and it does not affect the program status.
The interface of MASTER during Bluetooth communication between two development boards
3. Troubleshoot the LCD screen to display "No Bluetooth detected!" when it is not running normally, as shown in the figure. At this time, it means that the development board cannot detect the Bluetooth module. Please refer to the Bluetooth module pin connection table to re-check the connection between the Bluetooth module and the development board, and power on the development board to re-test.
LCD display when the Bluetooth module is not operating normally
● Bluetooth Module Operation Precautions and Frequently Asked Questions
1. The initialization process of the Bluetooth module (very important)
After the Bluetooth module is powered on, the INIT command must be executed. This command will initialize the Bluetooth SPP specification. Only after executing the INIT command, can scan, pair, connect, serial port transparent transmission and other operations be performed. After initialization, the INQ command must be called to initiate a query before it can be found by the remote Bluetooth device. After the INQ command is sent once, the query will always be executed. If the INQ command interferes with the serial port transparent transmission after the Bluetooth module kit is paired and connected, the INQ command can be used to end the INQ query, which will not affect the connection.
2. What is the difference between the master (MASTER) and the slave (SLAVE)?
The hardware of the core module is the same between the master and the slave, and the difference is only in the software. The Bluetooth module can switch the master-slave mode by using AT commands.
Bluetooth module only the host can actively initiate pairing and connection. After the connection, both the host and the slave can actively send data to each other, and the communication is full-duplex, that is, the sending and receiving can be carried out at the same time.
The slave and the host can be paired for use, and they can also be paired with ordinary Bluetooth adapters. One of the purposes of separating the host or slave is to pair with other products. For example, some GPS positioning systems themselves are equipped with slaves, then it should be use the host's Bluetooth module kit to pair with him.
The slave module is relative to the host module and the adapter, but if the host module is paired with the computer's adapter, it can also be considered a slave.
3. About the LED lights on the Bluetooth module
The LED on the Bluetooth module is the pairing status indicator.
When the Bluetooth module is just powered on, the module enters the AT state: the indicator light flashes once per second.
Pairable status: the indicator light flashes 2 times in 1 second.
Pairing success status: the indicator light flashes twice once every 1 time, and once every 2 seconds.
4. About the KEY pin on the Bluetooth module
The KEY pin on the Bluetooth module is used to indicate whether the input is transparent data or AT command.
KEY pin is high level: all strings sent to the Bluetooth module are processed as AT commands.
KEY pin is low level: the data sent to the Bluetooth module is sent to the remote Bluetooth device using the Bluetooth module communication protocol as it is. (The strings and pure byte data are the same, output as is, and the specific format is processed by the receiving end.)
● Bluetooth module schematic
● Bluetooth module Shipping List
1 Bluetooth module + 6 Dupont cables
We are Bluetooth module manufacturers, please click on WHATSAPP to contact us to inquiry more about the Bluetooth module types, the Bluetooth module price, etc.