HC-02 Bluetooth Module: Pin Configuration and Uses – GOSPO TIMES

The HC-02 Bluetooth module is a Bluetooth serial communication module that operates on the Bluetooth V2.0 protocol, designed for high stability and ultra-low power consumption. It is an industrial-grade module for Bluetooth data transmission.

Users are relieved from the burden of complex wireless communication configurations and transmission algorithms. Simply connecting to devices through the TTL serial port powers the HC-02 slave module, enabling seamless data transmission with mobile phones. Additionally, it can pair with HC-05 or HC-06 hosts (default pairing code: 1234) to replace traditional serial lines, streamlining wiring and offering remarkable flexibility.

For those seeking to control Arduino projects using an iPhone or iPad, the HC-02 4.0 BLE slave module with a 6-pin baseboard presents an excellent option. This module is fully compatible with iOS 7.0 or later and also supports Android 4.3 or later.

Important to note:

  • Compatibility: The module is not compatible with Android OS versions earlier than 4.3.
  • Modes: This module supports both Bluetooth 4.0 BLE mode and Bluetooth 2.0 mode.
onlinesoln

Features:

  • Model: HC-02
  • Module Size: 27 x 13mm
  • Operating Band: 2.4GHz
  • Air Rate: 2Mbps
  • Communication Interface: UART 3.3V TTL
  • Antenna Interface: Built-in PCB antenna
  • Working Voltage: 3.0V – 3.6V
  • Communication Current: 30mA
  • Baud Rate: 1200 – 115200bps
  • Receiver Sensitivity: -85dBm @ 2Mbps
  • Communication Level: 3.3V
  • Working Humidity: 10% – 90%
  • Transmitting Power: 6dBm (maximum)
  • Storage Temperature: -40°C to +85°C
  • Reference Distance: 10m
  • Working Temperature: -25°C to 75°C
  • Core Module: HC-08
  • Interface Leads: VCC, GND, TXD, RXD, LED status output pin
  • LED Indicator: Bluetooth connection status
    • Blinking: Bluetooth connectivity
    • Lit: Bluetooth connection open and port active
  • Backplane:
    • 3.3V LDO input voltage: 3.6V – 6V
    • Prohibits input voltage exceeding 7V
  • Interface Level: 3.3V
    • Directly connects to various SCM (51, AVR, PIC, ARM, MSP430, etc.)
    • 5V MCU can also be connected directly
  • Effective Distance: Open up to 10 meters, possibly more but quality of connection not guaranteed beyond 10 meters
  • Communication Format: Full-duplex serial port
    • Supports 8 data bits, 1 stop bit, no parity communication format (most commonly used)
    • Does not support other formats
  • Compact Design: 3.57cm x 1.52cm
    • Factory chip production ensures quality placement
    • Transparent heat shrink tubing for protection against dust and aesthetics
    • Anti-static design

Pin Configuration:

  1. Enable/Key: Toggles between Data Mode (set low) and AT command mode (set high)
  2. Vcc: Powers the module (+5V/+3.3V Supply voltage)
  3. Ground: Ground pin of module
  4. TX (Transmitter): Transmits Serial Data
  5. RX (Receiver): Receives Serial Data
  6. State: Connected to onboard LED for Bluetooth status feedback
  7. LED: Indicates Module Status
    • Blink once every 2 seconds: Module in Command Mode
    • Repeated Blinking: Waiting for connection in Data Mode
    • Blink twice every 1 second: Successful connection in Data Mode

Where to Use HC-02 Bluetooth Module:

The HC-02 module adds two-way (full-duplex) wireless functionality to projects, enabling communication between microcontrollers like Arduino or any Bluetooth-enabled device such as phones or laptops. Numerous Android applications facilitate this process, making it user-friendly, and it’s fully compatible with iPhones. Utilizing USART at 9600 baud rate, it’s easy to interface with microcontrollers supporting USART. Module configuration is possible through the command mode. If you need wireless data transfer between your computer, mobile phone, and microcontroller, the HC-02 is an ideal choice.

Note: This module is not designed for multimedia transfer such as photos or songs; for that purpose, consider the CSR8645 module.

How to Use the HC-02 Bluetooth Module:

The HC-02 operates in two modes: Data mode for sending/receiving data and AT Command mode for changing default settings. The mode can be switched using the key pin as described in the pin description. Pairing with microcontrollers is straightforward due to its Serial Port Protocol (SPP) operation. Simply power the module with +5V/+3.3V, connect the Rx pin to MCU’s Tx, and Tx pin to MCU’s Rx. Refer to the figure below for details: [insert figure if available].

onlinesoln

During power up the key pin can be grounded to enter into Command mode, if left free it will by default enter into the data mode. As soon as the module is powered you should be able to discover the Bluetooth device as “HC-02” then connect with it using the default password 1234 and start communicating with it.

Working principle Connect with MCU.

Connect with another Bluetooth module

HC-06 is the host, HC-02 is slave, the matching code is consistent (the default is 1234), the baud rate is the same, then power on can be automatically connected. After the first connection, the HC-06 host will automatically match the matching objects. If you want to connect to other modules, you must first remove the pairing memory of the HC-06 host. There is no matching memory from the slave.

Connect with Android phone

HC-02 can be connected to Android mobile via Bluetooth, and Android can use Android serial assistant software.

Connect with iPhone

HC-02 can be connected to iPhone 4S and later version iPhone . Communication test needs to download and install BLE serial assistant software.
Note:
Proprietary Service UUID: 49535343-FE7D-4AE5-8FA9-9FAFD205E455
TX UUID: 49535343-1 E4D-4BD9-BA61-23C647249616
RX UUID: 49535343-8841-43F4-A8D4-ECBE34729BB3

Connect with PC

HC-02 can connect to a computer via the HC-06-USB Bluetooth virtual serial port.
HC-02 can connect to the computer’s Bluetooth device to communicate.

Applications

1. Wireless communication between two microcontrollers

2. Communicate with Laptop, Desktops and mobile phones

3. Data Logging application

4. Consumer applications

5. Wireless Robots

6. Home Automation

AT Command

The way to the AT command mode: supply power to the module, it will enter to the AT mode if it
needn’t pair. The interval of command is about 1 second.
Default parameter: Baud rate:9600N81, ID: linvor, Password:1234

1. Test communication

Send: AT (please send it every second)
Back: OK

2. Reset the Bluetooth serial baud rate

Send: AT+BAUD1
Back: OK1200
Send: AT+BAUD2
Back: OK2400
……
1———1200
2———2400
3———4800
4———9600 (Default)
5———19200
6———38400
7———57600
8———115200
9———230400
A———460800
B———921600
C———1382400
PC can’t support the baud rate lager than 115200. The solution is: make the MCU have higher baud
rate (lager than 115200) through programming, and reset the baud rate to low level through the AT
command.
The baud rate reset by the AT command can be kept for the next time even though the power is cut
off.

3. Reset the Bluetooth name

Send: AT+NAMEname
Back: OKname

Example:

Send: AT+NAMEosoyoo
Back: OKname

At this time the Bluetooth name is changed to “osoyoo”.

4. Change the Bluetooth pairing password

Send: AT+PINxxxx

Back: OKsetPIN

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *