Raspberry Pi Pico HC-05 Bluetooth LED Control: Wiring, Code and Simulator
To build this Raspberry Pi Pico HC-05 Bluetooth LED Control project you need a Raspberry Pi Pico and a Bluetooth HC-05. machine.UART(0) on GP0/GP1 talks to an HC-05: send 1 or 0 from the Radio tab’s phone terminal to switch the on-board LED. Make the 4 connections in the wiring table, upload the MicroPython code, and connect the logic analyzer to GP0 and GP1 to see each start bit, data bit and stop bit at 9600 baud.
Open this circuit in the free Raspberry Pi Pico simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Raspberry Pi Pico | the microcontroller board |
| 1 | Bluetooth HC-05 | Bluetooth 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
| # | From | To |
|---|---|---|
| 1 | Raspberry Pi Pico VBUS | Bluetooth HC-05 VCC |
| 2 | Raspberry Pi Pico GND | Bluetooth HC-05 GND |
| 3 | Raspberry Pi Pico GP1 | Bluetooth HC-05 TXD |
| 4 | Raspberry Pi Pico GP0 | Bluetooth HC-05 RXD |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Raspberry Pi Pico. No install or account is needed.
- Add the parts. Add a Bluetooth HC-05 from the parts palette.
- Wire 1. Connect Raspberry Pi Pico VBUS to Bluetooth HC-05 VCC.
- Wire 2. Connect Raspberry Pi Pico GND to Bluetooth HC-05 GND.
- Wire 3. Connect Raspberry Pi Pico GP1 to Bluetooth HC-05 TXD.
- Wire 4. Connect Raspberry Pi Pico GP0 to Bluetooth HC-05 RXD.
- Paste the MicroPython code. Paste the MicroPython code below into the code editor.
- Run it. Press Run. Connect the logic analyzer to GP0 and GP1 to see each start bit, data bit and stop bit at 9600 baud.
MicroPython code
# Bluetooth LED control on a Raspberry Pi Pico with an HC-05 (MicroPython).
# Pair from the Radio tab's phone terminal (PIN 1234), then send 1 or 0.
# Wiring: HC-05 VCC to VBUS (5 V), GND, TXD -> GP1 (UART0 RX), RXD <- GP0 (UART0 TX).
# The Pico is 3.3 V, so no divider is needed on RXD.
from machine import UART, Pin
import utime
uart = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))
led = Pin(25, Pin.OUT)
print("Pico waiting for a phone to connect...")
while True:
if uart.any():
data = uart.read()
for c in data.decode():
print("Phone sent:", c)
if c == "1":
led.on()
uart.write("LED is ON\r\n")
elif c == "0":
led.off()
uart.write("LED is OFF\r\n")
utime.sleep_ms(10)
What to try
Connect the logic analyzer to GP0 and GP1 to see each start bit, data bit and stop bit at 9600 baud.
Frequently asked questions
How do I wire the HC-05 Bluetooth LED Control project on a Raspberry Pi Pico?
Make 4 connections: Raspberry Pi Pico VBUS to Bluetooth HC-05 VCC; Raspberry Pi Pico GND to Bluetooth HC-05 GND; Raspberry Pi Pico GP1 to Bluetooth HC-05 TXD; Raspberry Pi Pico GP0 to Bluetooth HC-05 RXD.
What parts do I need for this Raspberry Pi Pico project?
A Raspberry Pi Pico and a Bluetooth HC-05.
Can I simulate this Raspberry Pi Pico 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 RP2040 is emulated and runs the official firmware.
What does the code do?
machine.UART(0) on GP0/GP1 talks to an HC-05: send 1 or 0 from the Radio tab’s phone terminal to switch the on-board LED.
More Raspberry Pi Pico projects
- Raspberry Pi Pico LED Blink: Wiring, Code and Simulator
- Raspberry Pi Pico Push Button: Wiring, Code and Simulator
- Raspberry Pi Pico ADC + PWM LED Dimmer: Wiring, Code and Simulator
- Raspberry Pi Pico NeoPixel Ring: Wiring, Code and Simulator
- Raspberry Pi Pico DHT22 Sensor: Wiring, Code and Simulator
- Raspberry Pi Pico I2C LCD: Wiring, Code and Simulator