Mechanical Keyboard Application - Musical Keyboard

by Elecrow in Circuits > Raspberry Pi

318 Views, 1 Favorites, 0 Comments

Mechanical Keyboard Application - Musical Keyboard

2.png

This article shows how to use multiple mechanical keyboards to simulate piano keys by pico control, producing different tones.Since the mechanical keyboard we use only has 12 keys, we only set tones between C4 and G5.Even so, we can still play a simple song.

Materials:

Raspberry Pi Pico x 1

Mechanical keyboard x 1

trumpet x 1

Breadboard x 1

USB cable x 1

Dupont line x 12

Disassemble the Mechanical Keyboard

1.png

We need to first cut out the 12 keyboard keys from the acrylic fastener.

Prepare Dupont Wires

3.png

As shown in the figure above, we need to prepare 12 male to male Dupont wires and cut them in half to get 24 cut Dupont wires.Two Dupont wires are used for each keyboard key position.

Strip the Cable, Connect the Port

4.png
5.png
6.png

Use wire strippers to strip the insulating outer surface layer at the ends of two DuPont wires, and directly wind it around the two ports at the bottom of the keyboard key position.

If wire strippers are not available, use scissors to gently trim the outer layer of the insulator.

Welding

7.png
8.png
9.png

Using a soldering iron and tin wire, weld the Dupont wire and the keyboard key ports together completely.

Follow steps Step3 to Step4 for the other 11 keyboard keys.

Reassemble Onto Acrylic Fasteners

10.png
11.png

After we weld all the keyboard keys with Dupont wires, we need to reassemble them on the acrylic firmware that we took apart before.

Connect the Pico

13.png

Connect one of the Dupont lines of all keyboard keys to the negative column on the bread board, and connect the other Dupont line to the corresponding pin port of Raspberry PI pico in an orderly arrangement. (Connecting pins are 4-15)

In the same way, connect the horn to the breadboard.(Connecting pin is 2)

Download the Program

17.png
18.png
19.png

Open the Thonny software, set the interpreter to MicroPython, then save the program to the Raspberry PI Pico master and rename it "main.py".

Downloads

Program Running

After uploading the program successfully, you can control the sound by pressing the keyboard keys!