KS0355 keyestudio HC-08 Bluetooth Module

From Keyestudio Wiki
Jump to navigation Jump to search
Keyestudio UNO R3 Board


Overview

Keyestudio HC-08 Bluetooth module is a new digital transmission module, based on the Bluetooth Specification V4.0 BLE Bluetooth protocol. Its wireless working frequency band is 2.4GHz ISM, and the modulation method is GFSK. The module's default transmit power is 4dBm. Receive sensitivity -93dBm. The module is compatible with both Android and Apple systems. In an open environment, it can communicate with iphone4s, to achieve ultra-long-distance communication of 80 meters. It also comes with an LED status indicator. When using, you can directly see the connection state of Bluetooth. The module uses the CC2540F256 chip from TI, configured with 256K bytes of space, supporting the AT command. For need, the users can change the role (master or slave mode), baud rate of serial port, device name and other parameters, very flexible use.


Technical Details

  • Working voltage: DC 5V
  • Working frequency band: 2.4G
  • Air speed: 1Mbps
  • Communication interface: UART3.3VTTL level
  • Antenna interface: built-in PCB antenna
  • Sleep current: 0.4μA
  • RSSI support: not supported
  • Receive sensitivity: -93dBm@1Mbps
  • Communication level: 3.3V
  • Bluetooth version: V4.0
  • Modulation method: GFSK
  • Transmit power: 4dBm (default)
  • Reference distance: 80m
  • Working temperature: -25℃ to +75℃
  • Working humidity: 10% to 90%
  • Storage temperature: -40℃ to +85℃
  • Working current (excluding LED)
  • Host not connected / connected: 21mA / 9mA
  • Slave MODE0, not connected / connected: 8.5mA/9mA
  • Slave MODE1, not connected / connected: 6μA ~ 2.6mA / 1.6mA
  • Slave MODE2, not connected / connected: 0.4μA/1.6mA


AT Command Settings

Before setting the AT command, for hardware, you need a USB to serial module (such as FT232 module) and several DuPont lines. For software, need a serial port assistant software, and install well the driver for the USB to serial module. First, connect the Bluetooth module to FT232 module using DuPont line. The connection method is as follows.

HC-08 Bluetooth Module FT232 module
5V VCC(5V)
GND GND
TX RX
RX TX

Connected well, then connect the FT232 module (drive installation completed) to the computer using a USB cable. First right-click the computer, for properties ->Device Manager to find the corresponding COM port. Then open the serial port assistant software, set the COM port, and the baud rate (initial default 9600). After the connection is successful, you can start to set the AT command according to the instructions.

AT Command Instructions

1)Testing Instruction

Command Response Instruction
AT OK Test

2)Check the basic parameters

Command Response Instruction
AT+RX Name:HC-08-- >>>> user-defined name for Bluetooth

Role:Slave-->>>> module’s role(master/slave)
Baud:9600,NONE-->>>> serial baud rate, check bit.
Addr:xx,xx,xx,xx,xx,xx-->>>> Bluetooth Address
PIN :000000-->>>> Bluetooth password(invalid)

Inquire the basic parameters of module

3)Factory Data Reset Instruction

Command Response Instruction
AT+DEFAULT OK Factory Data Reset

Note: The slave address that the host has recorded will not be cleared! To clear, use the AT+CLEAR instruction to clear in the unconnected state.
The module will restart automatically, and a new operation can be performed after restarting for 200ms!

4)Module Restart Instruction

Command Response Instruction
AT+RESET OK restart the module

Note: The module will restart automatically, and a new operation can be performed after restarting for 200ms!

5)Check the software version

Command Response Instruction
AT+VERSION HC-08V3.1, 2017-07-07 view the software version and release date


6)Modify the module’s role

Command Response Instruction
AT+ROLE=x Master/Slave Set the Master/ Slave

Note: By Slave default, the module will automatically restart after setting.
A new operation can be performed after restarting for 200ms.

Send: AT+ROLE=M Return: Master ( to restart)
Send: AT+ROLE=? Return: Master (without restart)

7)Inquire and Modify the Bluetooth Name

Command Response Instruction
AT+NAME=xxx OKsetNAME Set the Bluetooth name

Note: Query to fill in the“?”, and set the Bluetooth name.
(Limited to 12 characters, support visual ASCII code and partial escape characters. The module supports Chinese character input, and Android device must be converted to "UTF8 encoding" to display properly. Send more than 12 characters, only recognize the first 12 characters. )
This command does not filter any characters. If you need Chinese characters, you can transcode them according to your own device format.

Send: AT+NAME=? Return: OK+NAME=HC-08
Send: AT+NAME=keyestudioReturn: OKsetNAME
Send: AT+NAME=? Return: OK+NAME=keyestudio


8)Inquire and Modify the Bluetooth Address

Command Response Instruction
AT+ADDR=xxxxxxxxxxxx OKsetADDR Modify the module's MAC address

(do not recommend to modify the module's MAC address to avoid conflicts)
Note: The address must be a 12-bit 0~F number or uppercase Character, that is a hexadecimal character. Query to fill in the "?”

Send: AT+ADDR=? Return: xxxxxxxxxxxx(current Bluetooth address of module)
Send: AT+ADDR=AABBCCDDEEFF Return: OKsetADDR
Send: AT+ADDR=? Return: AA,BB,CC,DD,EE,F


9)Inquire and Modify the RF Power

Command Response Instruction
AT+RFPM=x 4dBm(0 dBm /-6 dBm / -23dBm) Query/set the RF power of the module

Note: the parameter x is as shown in the table below. And query and settings are represented by a code name.

Send: AT+RFPM=? Return: 4dBm (query RF Power is 4dBm) Send: AT+RFPM=2 Return: OK (set the RF Power as -6dBm) Send: AT+RFPM=? Return: -6dBm (query RF Power is -6dBm) x is the code name of RF power, shown as the table below:

parameterx RF power transmitting power
? view the current RF power
0 4dBm(factory default)
1 0dBm
2 -6dBm
3 -23dBm


10)Inquire and Modify the Serial Baud Rate

Command Response Instruction
AT+BAUD=xx(or AT+BAUD=xx,y) OK9600 Serial port settings

Note: as shown in the following table, the parameters xx and y respectively represent the Baud rate and check bit.

Send: AT+BAUD=? Return: 9600,NONE Send: AT+BAUD=19200,E Return: OK19200,EVEN (set the parameter of serial port as: baud rate 19200, even-parity check)

xx represents the serial baud rate, y represents the check bit. As the table shown below:

parameter serial baud rate xx parameter check bit y
? view the current baud rate
1200 1200bps N NONE
2400 2400bps E EVEN
4800 4800bps O ODD
9600 9600bps(factory default)
19200 19200bps
38400 38400bps
57600 57600bps(factory default)
115200 115200bps

When the host and slave transmit communication, please do not exceed 500 bytes for each data package below 9600bps baud rate. For the maximum number of bytes per packet above 19200bps baud rate, please refer to the following table. There is a certain time interval among the data packets. The following table is the reference value for the time interval for various communication baud rates: