Wireless Bluetooth Keyboard, Using Raspberry Pi Pico W

by sprc9034 in Circuits > Raspberry Pi

2173 Views, 7 Favorites, 0 Comments

Wireless Bluetooth Keyboard, Using Raspberry Pi Pico W

Raspberry-Pi-Pico-W-Bluetooth-LE.jpg
Raspberry-Pi-Pico-W-Bluetooth-LE.jpg

In this article, I am going to show you'll how to build a wireless mechanical keyboard using the "RASPBERRY PI PICO W"


Before going forward I would like to specially thank ,

  1. Earle Philhower ( arduino-pico project: https://github.com/earlephilhower/arduino-pico)
  2. Datulab tech ( keyboard code : https://github.com/datulab/arduino-keyboard)
  3. blh 64 ( for helping me solve the shift key issue : https://forum.arduino.cc/t/bluetooth-keyboard-using-arduino-pico/1184605?u=sprc9034 )


Supplies

diode.jpeg
Untitled.jpeg

In order to build the keyboard, we will be requiring the following supplies :

1) Raspberry Pi Pico W

2) Mechanical Switches (cherry mx / outemu / gateron)

3) wires

4) keycaps of your choice

5) Soldering iron

6) 1N4148 diodes

3D Printing

IMG20230720130044.jpg
IMG20230720131507.jpg

Firstly we need to, 3d print the plate on which we are going to install our mechanical switches, I had to print the plate in 2 halves as the full length plate was exceeding my 3d printers bed size.

(This is not a split keyboard)

I wont be 3d printing the case in this tutorial as I think that is pretty easy to do, If you want any guidance in that regard you can refer Joe Scotto's video : https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwitvYif1KiCAxXfHRAIHaHADqUQwqsBegQICRAG&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7azQkSu0m_U&usg=AOvVaw0irxtmC2VG1O6JAzeFQCH8&opi=89978449

Downloads

Wiring the Matrix & Pi Pico W

howkeymatricesworks_1277655319.gif
IMG20231104004805.jpg

In this step we are going to wire the matrix for the keyboard, we will wire this in a ROW2CLOUMN configuration, in the keyboard that I have built above, it has a 5 rows and 14 columns. Matrix Wiring has best been explained at : https://www.dairequinlan.com/2020/12/the-keyboard-part-2-the-matrix/


After this we need to connect each row and column to the pins of the pi pico w.

in my case i have connected the rows to pins {0,1,2,3,4} & columns to pins {6,7,8,9,10,11,12,16,17,18,19,20,21,22}


You can set the rows and columns to as many as you like & then edit it in the code in the next step.

Interfacing Pi Pico W With Arduino IDE

111917251-3c57f400-8a3c-11eb-8120-810a8328ab3f.png
111917223-12063680-8a3c-11eb-8884-4f32b8f0feb1.png

In order to program the "PI PICO W" we need it to connect to the Arduino IDE, which we can simply do by launching the Arduino IDE then : file -> preferences -> additions boards manger URL

then paste : https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

this URL in the box & click OK.


after this go to Tools -> Boards manager

then type pico in the search box , then click on install to install the board.


For any additional info please visit arduino-pico page : https://github.com/earlephilhower/arduino-pico

Programming the Pi Pico W

Screenshot from 2023-11-04 01-31-10.png
IMG_20231104_014138.jpg

Now we will be writing the code, in order for the the pi pico W to work as a bluetooth keyboard,

we are using the using using row column detection method.

Before uploading the code to the pico, first go to : tools -> boards -> Raspberry Pi Rp2040 boards -> Raspberry Pi Pico W

Then go to : tools -> IP/Bluetooth Stack -> IPv4 + IPv6 + bluetooth

Then select the port to which the pico is connected.

Then select the upload method to UF2.

(please refer above image to check for all the settings in tools)

I have attached the code file below:


Note : When connecting the board for the first time, it will show up as UF2 board in ports (select it). After uploading once it will then show as ( Raspberry Pi PIco W on port)


Downloads

Connecting to the Keyboard

IMG20231104004826.jpg

Now once you have uploaded the code to the keyboard, disconnect and reconnect the pico from the computer, then open your Bluetooth settings and you should see there "PicoW BLE Keyboard", connect to it and voila you have a working keyboard.

I am planning to add a rotary encoder and an oled display to my design, after doing that I will update this instructable.

If you want to see this keyboard in action you can watch it at : https://photos.app.goo.gl/wXDbdicmm68AAP4r7