ESP32-C6 HC-05 Bluetooth LED Control: Wiring, Code and Simulator

To build this ESP32-C6 HC-05 Bluetooth LED Control project you need an ESP32-C6 DevKitC-1 and a Bluetooth HC-05. UART1 on IO4/IO5 talks to an HC-05: send 1 or 0 from the Radio tab’s phone terminal to switch the RGB LED. Make the 4 connections in the wiring table, upload the MicroPython code, and open the Radio tab, pair with the HC-05 (PIN 1234) and send 1, then 0.

Open this circuit in the free ESP32-C6 DevKitC-1 simulator

Parts list

QtyPartWhat it does
1ESP32-C6 DevKitC-1the microcontroller board
1Bluetooth HC-05Bluetooth serial module: VCC 5 V, GND, TXD → the board’s RX pin, RXD ← the board’s TX pin (through a 1k/2k divider on a 5 V board). Starts at 9600 baud; hold EN high at power-up for AT commands at 38400. Pair it from the Radio tab’s phone terminal, or with a master HC-05 in another circuit (open it in a second tab).

Wiring

#FromTo
1ESP32-C6 DevKitC-1 5VBluetooth HC-05 VCC
2ESP32-C6 DevKitC-1 GNDBluetooth HC-05 GND
3ESP32-C6 DevKitC-1 IO5Bluetooth HC-05 TXD
4ESP32-C6 DevKitC-1 IO4Bluetooth HC-05 RXD

Step by step

  1. Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the ESP32-C6 DevKitC-1. No install or account is needed.
  2. Add the parts. Add a Bluetooth HC-05 from the parts palette.
  3. Wire 1. Connect ESP32-C6 DevKitC-1 5V to Bluetooth HC-05 VCC.
  4. Wire 2. Connect ESP32-C6 DevKitC-1 GND to Bluetooth HC-05 GND.
  5. Wire 3. Connect ESP32-C6 DevKitC-1 IO5 to Bluetooth HC-05 TXD.
  6. Wire 4. Connect ESP32-C6 DevKitC-1 IO4 to Bluetooth HC-05 RXD.
  7. Paste the MicroPython code. Paste the MicroPython code below into the code editor.
  8. Run it. Press Run. Open the Radio tab, pair with the HC-05 (PIN 1234) and send 1, then 0.

MicroPython code

# ESP32-C6: Bluetooth LED control with an HC-05 on UART1.
# Pair from the Radio tab's phone terminal (PIN 1234), then send 1 or 0:
# the on-board RGB LED turns green or off, and the reply goes back to the phone.
# Wiring: HC-05 VCC 5V, GND, TXD -> IO5 (RX), RXD <- IO4 (TX); the C6 is 3.3 V, no divider.
from machine import UART, Pin
import neopixel, time

uart = UART(1, baudrate=9600, tx=4, rx=5)
rgb = neopixel.NeoPixel(Pin(8), 1)
print("ESP32-C6 waiting for a phone to connect...")

while True:
    if uart.any():
        for c in uart.read().decode():
            print("Phone sent:", c)
            if c == "1":
                rgb[0] = (0, 40, 0)
                rgb.write()
                uart.write("LED is ON\r\n")
            elif c == "0":
                rgb[0] = (0, 0, 0)
                rgb.write()
                uart.write("LED is OFF\r\n")
    time.sleep_ms(10)

What to try

Open the Radio tab, pair with the HC-05 (PIN 1234) and send 1, then 0.

Frequently asked questions

How do I wire the HC-05 Bluetooth LED Control project on an ESP32-C6 DevKitC-1?

Make 4 connections: ESP32-C6 DevKitC-1 5V to Bluetooth HC-05 VCC; ESP32-C6 DevKitC-1 GND to Bluetooth HC-05 GND; ESP32-C6 DevKitC-1 IO5 to Bluetooth HC-05 TXD; ESP32-C6 DevKitC-1 IO4 to Bluetooth HC-05 RXD.

What parts do I need for this ESP32-C6 project?

An ESP32-C6 DevKitC-1 and a Bluetooth HC-05.

Can I simulate this ESP32-C6 project online for free?

Yes. The BitForBytes Embedded Lab runs this exact circuit and MicroPython code in your browser for free, with no install and no hardware. The ESP32-C6 is emulated instruction by instruction on its RISC-V core, running its own ROM and the official MicroPython firmware.

What does the code do?

UART1 on IO4/IO5 talks to an HC-05: send 1 or 0 from the Radio tab’s phone terminal to switch the RGB LED.

More ESP32-C6 DevKitC-1 projects