DEV Community

Shilleh
Shilleh

Posted on • Originally published at shillehtek.com

Raspberry Pi Pico 2W BLE: Wireless Macropad

Raspberry Pi Pico 2W wireless BLE macropad build with mechanical switches

Project Overview

Raspberry Pi Pico 2W BLE macropad: In this build, you will wire mechanical switches to a Raspberry Pi Pico 2W and use CircuitPython BLE HID to send wireless keyboard shortcuts and text snippets to your computer without a USB cable.

The Raspberry Pi Pico 2W has the RP2350 chip (dual-core ARM Cortex-M33), 4 MB Flash, BLE 5 + WiFi, and runs CircuitPython, MicroPython, and Arduino-C. Combine that with the Pico's native USB and you can build a wireless BLE macropad that pairs with Mac, Windows, or Linux and sends programmable hotkeys, application shortcuts, or full text snippets without a cable.

This guide walks through wiring 6 mechanical switches to a Pico 2W, flashing the CircuitPython BLE-HID firmware, mapping keys, and pairing the macropad to your computer. Total build under 30 minutes.

  • Time: Under 30 minutes
  • Skill level: Beginner
  • What you will build: A 6-key wireless BLE macropad that acts like a Bluetooth keyboard and triggers shortcuts on your host computer

Parts List

From ShillehTek

External

  • 6 mechanical key switches (Cherry MX or Kailh BOX) + keycaps
  • A small project enclosure (3D printed or off-the-shelf)
  • USB-C cable for initial flashing

Note: The Pico 2W is required for BLE. The Pico 2 can run the same key-scanning logic but will behave as a USB HID device, not a Bluetooth keyboard.

Step-by-Step Guide

Step 1 - Choose Pico 2W vs Pico 2

Goal: Pick the right board for wireless BLE vs USB-only use.

What to do: Use a Pico 2W if you want Bluetooth LE. The Pico 2 has USB HID but must stay tethered. The Pico 2W adds BLE 5 so you can pair once and type without a cable.

Raspberry Pi Pico 2W board used as the BLE macropad controller
Pico 2W is recommended for BLE pairing and wireless shortcuts.

Expected result: You have a Pico 2W selected for a wireless BLE macropad (or a Pico 2 selected if you only need USB HID).

Step 2 - Wire the 6 switches to GPIO and ground

Goal: Connect each switch so the Pico can detect presses reliably.

What to do: For 6 switches you do not need a matrix. Wire one side of each switch to its own GPIO pin and wire the other side of every switch to a shared ground.

For 6 switches you don't need a matrix, just 6 GPIO + ground:

Pico 2W       Switch
GP2      ->   Switch 1 (other side to GND)
GP3      ->   Switch 2
GP4      ->   Switch 3
GP5      ->   Switch 4
GP6      ->   Switch 5
GP7      ->   Switch 6
GND      ->   Common ground for all switches
Enter fullscreen mode Exit fullscreen mode

The GPIO pins are configured as INPUT_PULLUP, so pressing a switch pulls the line LOW.

Expected result: Each button press will read as a clean LOW signal on its assigned GPIO pin.

Step 3 - Flash CircuitPython and install libraries

Goal: Get CircuitPython running and add the BLE + HID libraries needed for a Bluetooth keyboard.

What to do:

  1. Hold BOOTSEL on the Pico 2W and plug in USB-C.
  2. A flash drive named RPI-RP2 appears.
  3. Download adafruit-circuitpython-raspberry_pi_pico2_w-en_US-9.x.uf2 from the CircuitPython downloads page.
  4. Drag the .uf2 onto the RPI-RP2 drive. The board reboots into CIRCUITPY.
  5. Copy the adafruit_hid and adafruit_ble libraries to CIRCUITPY/lib.

Installing CircuitPython UF2 on Raspberry Pi Pico 2W by drag-and-drop
Drag-and-drop UF2 install to get CircuitPython running.

Expected result: The Pico shows up as a CIRCUITPY drive and you have the BLE and HID libraries in place.

Step 4 - Add the main firmware (code.py)

Goal: Advertise as a BLE keyboard and map each GPIO button to a hotkey action.

What to do: Create or edit code.py on the CIRCUITPY drive and paste in the code below. It sets up BLE HID, reads the six input pins with pull-ups, and sends the configured key combinations on button press.

Code:

import time
import board, digitalio
from adafruit_ble import BLERadio
from adafruit_ble.advertising import Advertisement
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.standard.hid import HIDService
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

hid = HIDService()
adv = ProvideServicesAdvertisement(hid)
adv.appearance = 961  # generic keyboard
ble = BLERadio()
if not ble.connected:
    ble.start_advertising(adv)
kbd = Keyboard(hid.devices)

# wire each GPIO to a switch
PINS = [board.GP2, board.GP3, board.GP4, board.GP5, board.GP6, board.GP7]
KEYS = [
    [Keycode.CONTROL, Keycode.C],       # copy
    [Keycode.CONTROL, Keycode.V],       # paste
    [Keycode.CONTROL, Keycode.Z],       # undo
    [Keycode.WINDOWS, Keycode.TAB],     # task switcher
    [Keycode.F5],                       # refresh
    [Keycode.MUTE],                     # mute audio
]
buttons = []
for p in PINS:
    b = digitalio.DigitalInOut(p)
    b.direction = digitalio.Direction.INPUT
    b.pull = digitalio.Pull.UP
    buttons.append(b)

last = [True] * 6
while True:
    for i, b in enumerate(buttons):
        if not b.value and last[i]:  # falling edge: pressed
            kbd.press(*KEYS[i])
            kbd.release_all()
            time.sleep(0.03)
        last[i] = b.value
    time.sleep(0.005)
Enter fullscreen mode Exit fullscreen mode

Expected result: The Pico 2W advertises over BLE and pressing a switch sends the mapped keystrokes.

Step 5 - Pair the macropad over Bluetooth

Goal: Connect the Pico 2W to your computer as a Bluetooth keyboard.

What to do: On your computer, open Bluetooth settings and click "Pair" next to "CIRCUITPY". Once paired, it shows up as a keyboard. Press a key and the shortcut fires on the host. If you disconnect and return later, it reconnects automatically.

Pairing the Raspberry Pi Pico 2W BLE HID keyboard in macOS Bluetooth settings
Pair once, then use it like a wireless keyboard.

Expected result: Your computer treats the macropad as a BLE keyboard and receives the programmed hotkeys.

Step 6 - Power it from a LiPo battery (wireless operation)

Goal: Run the macropad without being connected to USB.

What to do: Solder the LiPo to the TP4056. Wire TP4056 OUT+ to the Pico's VSYS pin and OUT- to GND. The Pico 2W's onboard buck-boost handles 1.8 to 5.5 V at VSYS, so you do not need a separate regulator. Plug a USB-C cable into the TP4056 to charge while you work.

Expected result: The macropad runs from battery power and can be charged via USB-C through the TP4056.

Step 7 - Expand keys and add modes (optional enhancements)

Goal: Extend the basic 6-key build without changing the core concept.

What to do: Add a 2-position toggle switch as a "mode" input. The same 6 keys can produce different shortcuts depending on the mode, giving 12 effective keys. For 64+ keys, switch to a key matrix with column/row scanning.

Expected result: You have a clear path to more shortcuts using modes or a larger key matrix design.

Conclusion

You built a Raspberry Pi Pico 2W BLE macropad that behaves like a real wireless keyboard and triggers hotkeys from six mechanical switches. With CircuitPython BLE HID, you can remap shortcuts in software and use it across Mac, Windows, or Linux without a USB tether.

Attribution: This guide was inspired by Wireless Bluetooth Keyboard, Using Raspberry Pi Pico W on Instructables. Images credited to the original author.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.

Top comments (0)