Build it step by step
0 of 7 doneWire the module
VCC to VBUS, GND to GND, TXD to GP1, RXD to GP0.
Wire the LEDs
Each LED through 330 ohms to GP10, GP11 and GP12, other end to GND.
Run the program
The module's light blinks fast, waiting to pair.
Pair the phone
Choose HC-06 and enter the code 1234.
Open the terminal app
Connect to HC-06.
Send 1
LED 1 switches and a message comes back.
Send 9 and 0
All on and all off.
How do you build a pico Bluetooth LED panel?
A Pico reads text commands from an HC-06 Bluetooth module on a UART and switches three LEDs, controlled from a phone's serial terminal app. You need Raspberry Pi Pico H, HC-06 Bluetooth module, LED 5 mm red × 3, Resistor 330 Ω × 3 and Breadboard 830 Tie Points. It takes 7 steps and about 120 minutes.
- Level
- Beginner
- Time
- About 120 min
- Parts
- 5
Parts list
- Development BoardsBuy
- WirelessBuy
- SemiconductorsBuyLED 5 mm red × 3
- PassivesBuyResistor 330 Ω × 3
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| HC-06 VCC | Pico VBUS pin 40 | 5 V from USB (the module has its own regulator) |
| HC-06 GND | Pico GND pin 38 | Common ground |
| HC-06 TXD | Pico GP1 pin 2 (UART0 RX) | Data from the phone to the Pico |
| HC-06 RXD | Pico GP0 pin 1 (UART0 TX) | Data from the Pico to the phone |
| LED 1 | 330 ohm to Pico GP10 pin 14, LED to GND | Switched by command 1 |
| LED 2 | 330 ohm to Pico GP11 pin 15, LED to GND | Switched by command 2 |
| LED 3 | 330 ohm to Pico GP12 pin 16, LED to GND | Switched by command 3 |
Code
The HC-06 is a classic Bluetooth module that acts as a wireless serial cable. Whatever your phone sends to it comes out of its TXD pin as ordinary serial data, and whatever you put into its RXD pin is sent to the phone. The Pico's UART reads that data one character at a time, and the program switches an LED for each command. Cross the wires, so the module's TX goes to the Pico's RX and the module's RX goes to the Pico's TX. The module's data pins work at 3.3 V, which matches the Pico, and it can run from the 5 V pin because the breakout carries a regulator. Pair the phone with the module (the name is usually HC-06 and the code usually 1234) and open a serial Bluetooth terminal app. Android phones can use classic Bluetooth serial this way; iPhones cannot, so try an Android phone or a computer. Change the pairing code if you plan to leave it switched on in a shared place.
from machine import Pin, UART
import time
uart = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1)) # HC-06 starts at 9600 baud
leds = [Pin(10, Pin.OUT), Pin(11, Pin.OUT), Pin(12, Pin.OUT)]
def say(text):
uart.write(text + "\r\n")
say("Pico LED panel ready. Send 1, 2 or 3 to toggle, 9 for all on, 0 for all off.")
while True:
if uart.any():
ch = uart.read(1)
if ch is None:
continue
c = ch.decode("utf-8", "ignore")
if c in "123":
led = leds[int(c) - 1]
led.toggle()
say("LED " + c + (" on" if led.value() else " off"))
elif c == "9":
for led in leds:
led.value(1)
say("All on")
elif c == "0":
for led in leds:
led.value(0)
say("All off")
time.sleep_ms(10)Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Send 1 | LED 1 toggles and the phone shows LED 1 on |
| Send 1 again | LED 1 off |
| Send 2 and 3 | The other LEDs toggle |
| Send 9 | All three on |
| Send 0 | All three off |
| Move away | Stops working at about 10 metres |
If it does not work
Module does not show up on the phone
Check it has power and the light is blinking, and pair from the phone Bluetooth settings.
No reply on the phone
Check TXD and RXD are crossed, module TX to Pico RX.
Strange characters
Check the baud rate, 9600 for the module as delivered.
iPhone cannot connect
iPhones do not support classic Bluetooth serial, use an Android phone.
LED does not light
Check the LED direction, the long leg goes to the resistor.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the pico Bluetooth LED panel?
Raspberry Pi Pico H, HC-06 Bluetooth module, LED 5 mm red × 3, Resistor 330 Ω × 3 and Breadboard 830 Tie Points.
How long does the pico Bluetooth LED panel take to build?
About 120 minutes for a beginner maker, in 7 steps.
How do I know the pico Bluetooth LED panel works?
Send 1: LED 1 toggles and the phone shows LED 1 on. Send 1 again: LED 1 off. Send 2 and 3: The other LEDs toggle.
Module does not show up on the phone: what should I check?
Check it has power and the light is blinking, and pair from the phone Bluetooth settings.
No reply on the phone: what should I check?
Check TXD and RXD are crossed, module TX to Pico RX.
Strange characters: what should I check?
Check the baud rate, 9600 for the module as delivered.
iPhone cannot connect: what should I check?
iPhones do not support classic Bluetooth serial, use an Android phone.
