Last edited time
2024/05/23 21:43
Don’t be confused, this project is about making a full-fledged keyboard, not a keypad. The keypad detailed in this page is made for prototyping purposes only.


I’ll use a simple 4*4 push buttons keypad for developing purposes; the buttons matrix principle is the same that will be found in the fill-size keyboard.
There are 16 push buttons and 16 diodes. The diodes are needed to prevent the key ghosting problem, and masking problem.
Here is a quick PCB I made on KiCad and ordered on JLCPCB (they are not a sponsor of this project and I’m not affiliated with them at all).
The final PCB looks like this:
The source files of this board are available on Github. It’s a very basic, classic buttons matrix, and it was absolutely not needed to design one since there are already hundreds of available designs online. But once again, I’m doing all of this to have fun and make something truly custom, so I’ll try to make everything myself. The total price for 5 boards, taxes & shipping to France was 4.10$ (I’m amazed by how cheap this is).
My PCB has routing problems. I used a KiCad plugin that automates routing, and I checked an option that makes “curved” tracks. I did not check the result before manufacturing, and some tracks unfortunately connect to 3 pads, so I had to manually fix these mistakes. You’ll need to re-route this PCB in a proper way, or at least move the offending tracks a few millimeters away from the solder pads they touch.
package main import ( "machine" "time" ) var ( C1 machine.Pin = machine.GP15 C2 machine.Pin = machine.GP14 C3 machine.Pin = machine.GP13 C4 machine.Pin = machine.GP12 R1 machine.Pin = machine.GP11 R2 machine.Pin = machine.GP10 R3 machine.Pin = machine.GP9 R4 machine.Pin = machine.GP8 ) func main() { columns := [...]machine.Pin{C1, C2, C3, C4} rows := [...]machine.Pin{R1, R2, R3, R4} inputConfig := machine.PinConfig{Mode: machine.PinInputPulldown} for i := range rows { rows[i].Configure(inputConfig) } outputConfig := machine.PinConfig{Mode: machine.PinOutput} for i := range columns { columns[i].Configure(outputConfig) columns[i].High() } count := 0 for { println(count, " reading keypad state") for i := range rows { println("R", i+1, " ", rows[i].Get()) } time.Sleep(100 * time.Millisecond) count = count + 1 } }