Compare commits
2 Commits
v0.3.0
..
e2e2246c5a
| Author | SHA1 | Date | |
|---|---|---|---|
|
e2e2246c5a
|
|||
|
16c743cb22
|
@@ -1,8 +1,8 @@
|
|||||||
# Pico BLE HID
|
# Pico BLE HID
|
||||||
|
|
||||||
This project uses a Raspberry Pi Pico W as a Bluetooth Low Energy adapter for
|
This project uses a Raspberry Pi Pico W or Pico 2 W as a Bluetooth Low Energy
|
||||||
a wired USB HID input peripheral, allowing it to connect to a host device
|
adapter for a wired USB HID input peripheral, allowing it to connect to a host
|
||||||
over BLE using HID over GATT Profile.
|
device over BLE using HID over GATT Profile.
|
||||||
|
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
@@ -12,7 +12,7 @@ over BLE using HID over GATT Profile.
|
|||||||
### Hardware
|
### Hardware
|
||||||
|
|
||||||
You will need the following hardware to make the device:
|
You will need the following hardware to make the device:
|
||||||
- Raspberry Pi Pico W
|
- Raspberry Pi Pico W or Raspberry Pi Pico 2 W
|
||||||
- USB extension cable
|
- USB extension cable
|
||||||
- (Optional) Momentary push button
|
- (Optional) Momentary push button
|
||||||
|
|
||||||
@@ -20,19 +20,19 @@ You will need the following hardware to make the device:
|
|||||||
|
|
||||||
|
|
||||||
You will need to cut the USB extension in half and connect the wires from the
|
You will need to cut the USB extension in half and connect the wires from the
|
||||||
female end to the Raspberry Pi Pico W. The default configuration is to attach
|
female end to the Raspberry Pi Pico (2) W. The default configuration is to
|
||||||
the USB's green wire to pin 1/GP0 and USB's white wire to pin 2/GP1. You will
|
attach the USB's green wire to pin 1/GP0 and USB's white wire to pin 2/GP1. You
|
||||||
also need to connect the red to 5V VBUS/VSYS (since you'll be powering from the
|
will also need to connect the red to 5V VBUS/VSYS (since you'll be powering
|
||||||
USB connection, VBUS should be fine) and the black to any ground pin. Pin 38
|
from the USB connection, VBUS should be fine) and the black to any ground pin.
|
||||||
is the closest and most convenient, or the ground test point TP1 on the back
|
Pin 38 is the closest and most convenient, or the ground test point TP1 on the
|
||||||
will also work. While you can connect the Raspberry Pi Pico to the host device
|
back will also work. While you can connect the Raspberry Pi Pico (2) W to the
|
||||||
using the micro USB port and a micro USB cable, since you have already
|
host device using the micro USB port and a micro USB cable, since you have
|
||||||
sacrificed half of the USB extension cable, you might as well use the male half
|
already sacrificed half of the USB extension cable, you might as well use the
|
||||||
to create a standard USB-A connection. If you wish to do so, then simply
|
male half to create a standard USB-A connection. If you wish to do so, then
|
||||||
connect the red and black wires of the male connector end to VBUS (5V) and GND,
|
simply connect the red and black wires of the male connector end to VBUS (5V)
|
||||||
respectively. For the data wires, you can solder them to the two test points
|
and GND, respectively. For the data wires, you can solder them to the two test
|
||||||
TP2 and TP3 on the back of the Raspberry Pi Pico. The white cable goes to TP2
|
points TP2 and TP3 on the back of the Raspberry Pi Pico (2) W. The white cable
|
||||||
and the green cable to TP3.
|
goes to TP2 and the green cable to TP3.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -43,29 +43,29 @@ relief is a good idea.
|
|||||||
|
|
||||||
### Software
|
### Software
|
||||||
|
|
||||||
Download the ble_hid.uf2 file from the latest
|
Download the ble_hid-pico_w.uf2 (for Pico W) or ble_hid-pico2_w.uf2 (for Pico 2
|
||||||
[release](https://git.kkozai.com/kenji/pico_ble_hid/releases) and flash
|
W) file from the latest
|
||||||
onto the Raspberry Pi Pico W by holding down the BOOTSEL button while plugging
|
[release](https://git.kkozai.com/kenji/pico_ble_hid/releases) and flash onto
|
||||||
|
the Raspberry Pi Pico (2) W by holding down the BOOTSEL button while plugging
|
||||||
into your computer so that it appears as a USB drive, then transfer the
|
into your computer so that it appears as a USB drive, then transfer the
|
||||||
firmware file onto the Pico W. After unmounting, the firmware install is
|
firmware file onto the Pico (2) W. After unmounting, the firmware install is
|
||||||
complete.
|
complete.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Connect the Raspberry Pi Pico W into any USB power source (a good, small power
|
Connect the Raspberry Pi Pico (2) W into any USB power source (a good, small
|
||||||
bank will work), then plug in the desired peripheral into the female USB
|
power bank will work), then plug in the desired peripheral into the female USB
|
||||||
socket. After about a second, the onboard LED will light up, indicating it is
|
socket. After about a second, the onboard LED will light up, indicating it is
|
||||||
ready to be paired over Bluetooth LE.
|
ready to be paired over Bluetooth LE.
|
||||||
|
|
||||||
From the host machine, go to your Bluetooth settings and pair with the
|
From the host machine, go to your Bluetooth settings and pair with the
|
||||||
"Pico BLE HID" device. The LED should turn off when pairing begins, and it will
|
"Pico BLE HID" device. The LED should turn off when pairing begins, and it will
|
||||||
turn back on when pairing is complete and the Raspberry Pi Pico W is
|
turn back on when pairing is complete and the Raspberry Pi Pico (2) W is ready
|
||||||
ready to receive inputs. This will take a few seconds, so be patient.
|
to receive inputs. This will take a few seconds, so be patient. Once the light
|
||||||
Once the light is back on, your device should work over the Bluetooth
|
is back on, your device should work over the Bluetooth connection. When
|
||||||
connection. When connecting a power-hungry device such as a gaming keyboard
|
connecting a power-hungry device such as a gaming keyboard with many LEDs, the
|
||||||
with many LEDs, the sudden power draw when plugging in can cause issues, so it
|
sudden power draw when plugging in can cause issues, so it is recommended to
|
||||||
is recommended to turn off the LEDs before connecting to the Raspberry Pi Pico
|
turn off the LEDs before connecting to the Raspberry Pi Pico (2) W.
|
||||||
W.
|
|
||||||
|
|
||||||
If you connected a push button to GP5, then pressing the button will switch
|
If you connected a push button to GP5, then pressing the button will switch
|
||||||
between Bluetooth connection mode and USB passthrough mode. In USB passthrough
|
between Bluetooth connection mode and USB passthrough mode. In USB passthrough
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
|
|||||||
|
|
||||||
if ( device_state == DEVICE_ACTIVE ) {
|
if ( device_state == DEVICE_ACTIVE ) {
|
||||||
uint8_t desc_initial[TUD_CONFIG_DESC_LEN+TUD_CDC_DESC_LEN+1] = {
|
uint8_t desc_initial[TUD_CONFIG_DESC_LEN+TUD_CDC_DESC_LEN+1] = {
|
||||||
TUD_CONFIG_DESCRIPTOR(1, 4+num_mounted, 0, TUD_CONFIG_DESC_LEN+TUD_CDC_DESC_LEN+num_mounted*TUD_HID_DESC_LEN, 0x00, 100),
|
TUD_CONFIG_DESCRIPTOR(1, 2+num_mounted, 0, TUD_CONFIG_DESC_LEN+TUD_CDC_DESC_LEN+num_mounted*TUD_HID_DESC_LEN, 0x00, 100),
|
||||||
TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, EPNUM_CDC_NOTIF, 8, EPNUM_CDC_OUT, EPNUM_CDC_IN, 64),
|
TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, EPNUM_CDC_NOTIF, 8, EPNUM_CDC_OUT, EPNUM_CDC_IN, 64),
|
||||||
};
|
};
|
||||||
memcpy(desc_configuration, desc_initial, TUD_CONFIG_DESC_LEN+TUD_CDC_DESC_LEN);
|
memcpy(desc_configuration, desc_initial, TUD_CONFIG_DESC_LEN+TUD_CDC_DESC_LEN);
|
||||||
|
|||||||
Reference in New Issue
Block a user