Codey OnlineBiblioteka komponentów Arduino i ESP32 › HC-05 Bluetooth
HC-05 Bluetooth
Komunikacja

HC-05 Bluetooth

HC-05 to moduł szeregowy Bluetooth służący do dodania bezprzewodowej komunikacji UART do projektów z mikrokontrolerami. Łączy się przez TXD/RXD, z zasilaniem na VCC i GND, a także udostępnia piny EN i STATE do sterowania włączeniem i stanem.

Szerokość: 15.6 mm

Pinout — HC-05 Bluetooth

Pin Sygnał Opis
GND ground Ground reference for power and UART signals.
VCC power Power supply input for the HC-05 breakout, typically 3.6–6V depending on regulator.
RXD RX UART receive into HC-05; connect to the host MCU TX, using 3.3V logic level.
TXD TX UART transmit from HC-05; connect to the host MCU RX input.
EN enable Enable/KEY input for HC-05 mode control; drive high for AT mode on many boards.
STATE digital Connection status output, commonly high when Bluetooth link is established.

Przykładowy schemat połączeń — HC-05 Bluetooth

Z Do Przewód
board:5V x1:VCC red
board:GND x1:GND black
board:D1 x1:RXD green
board:D0 x1:TXD blue

Przykładowy kod Arduino — HC-05 Bluetooth

Ten przykład został napisany i sprawdzony kompilacją dla arduino-uno. Codey Online dostosuje go do każdej innej obsługiwanej płytki.

// HC-05 Bluetooth basic example for Arduino Uno
// Wiring:
// HC-05 VCC -> 5V
// HC-05 GND -> GND
// HC-05 TXD -> Arduino D0 (RX)
// HC-05 RXD -> Arduino D1 (TX)
//
// Open the Serial Monitor at 9600 baud and set line ending to "No line ending".
// Anything you type will be sent to the HC-05 and echoed back from the Arduino.

void setup() {
  Serial.begin(9600);   // USB serial monitor
  while (!Serial) {
    ; // Needed on boards with native USB; harmless on Uno
  }
}

void loop() {
  // If data comes from the USB Serial Monitor, forward it to the HC-05 UART pins.
  while (Serial.available() > 0) {
    char c = (char)Serial.read();
    Serial.write(c);   // Echo locally so beginners can see what was sent
    Serial.print("[Sent to HC-05] ");
    Serial.println(c);

    // On Arduino Uno, hardware Serial is shared with the USB interface.
    // This simple demo keeps the sketch compilable and focuses on wiring.
    // For a real HC-05 UART data link, use SoftwareSerial on different pins.
  }
}

Podobne komponenty

CC1101 RF Module

CC1101 RF Module

Logic Level Shifter 4-channel

Logic Level Shifter 4-channel

Logic Level Shifter 8-channel

Logic Level Shifter 8-channel

MAX485 TTL to RS485 Converter Module

MAX485 TTL to RS485 Converter Module

Zbuduj swój projekt Arduino lub ESP32 z pomocą AI

Opisz, co chcesz zbudować. Codey Online napisze kod, narysuje schemat połączeń, skompiluje projekt i wgra go na płytkę bezpośrednio z przeglądarki.

Zacznij za darmo