Skip to the content
2 layers94 × 92 mmKeypad, the printed circuit board in 3D

The hardware and software for a simple 3x4 Keypad

Size
94 × 92 mm
Copper layers
2
Thickness
1.6 mm
Parts
39
Nets
32
Pads
125
Tracks, vias
197, 190
Pours
5
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
19 Aug 2023
Updated
12 Sep 2023

Overview

Keypad is an open-source printed circuit board by StefanLilje, from the StefanLilje/Keypad repository on GitHub, published under the MIT licence. It is a 2-layer board of 94 × 92 mm with 39 parts on 32 nets, routed with 197 tracks and 190 vias.

It is built around the MX1A-E1NW. Its parts include 14 diodes, 13 switches, 2 resistors and 1 IC. It belongs with the keyboards and input boards and the SAM D and SAM boards of this library.

Main components

1

README

README.md

Keypad

The Hardware and software for a simple 3x4 Keypad featuring a USB-C Interface

image

Sources
text
https://wiki.seeedstudio.com/Seeeduino-XIAO/#resourses
https://grabcad.com/library/5x5mm-smd-tactile-button-1
https://grabcad.com/library/kailh-polia-switch-cherry-mx-compatible-1

How to use

Setup

  • Install the newest version of arduino IDE
  • In arduino IDE, under preferences add this board URL
text
https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
  • Install the newest version of the Seeed SAMD Boards package from the boards manager
  • Install the newest version of the Keyboard library from the library manager
  • Clone or download Keypad into your Arduino project folder

Changing keyboard layout

c
Keyboard.begin(KeyboardLayout_de_DE);

The keyboard layout can be changed in Keypad.ino by substituting KeyboardLayout_de_DE with any of the following layouts supported by the arduino keyboard library:

text
KeyboardLayout_de_DE
KeyboardLayout_en_US
KeyboardLayout_es_ES
KeyboardLayout_fr_FR
KeyboardLayout_it_IT
KeyboardLayout_sv_SE
KeyboardLayout_da_DK

Editing macros

Open Keypad.ino with the arduino IDE. Functions of the keypad can be configured by editing the code inside the switch statement inside loop(). Two examples are already filled in.

c
switch (keys[j][i]) {
    //special macros
    case 1:
        numpadAscii(i, j, 231);
        break;
    case 10:
        textMacro(i, j, "max.mustermann@generic-mailservice.com");
        break;

    //all other keys: press key according to keyMap
    default:
        singleKeypress(i, j);
        break;
}

To configure a specific key, look up its number in the keys variable:

c
const int keys[3][4] = {
  { 1, 2, 3, 4 },
  { 5, 6, 7, 8 },
  { 9, 10, 11, 12 }
};

Then, add a special case to the switch statement (in this example key number 2 was chosen):

c
case 2:

    ...

    break;

Predefined macros

Several common macros are already implemented:

act as single key:

c
case 2:
    singleKeypress(i, j, keycode);
    break;

where keycode is a either an integer corrosponding to a key or one of the following special keys:

list of special keys
text
KEY_LEFT_CTRL
KEY_LEFT_SHIFT
KEY_LEFT_ALT
KEY_LEFT_GUI
KEY_RIGHT_CTRL
KEY_RIGHT_SHIFT
KEY_RIGHT_ALT
KEY_RIGHT_GUI

KEY_UP_ARROW
KEY_DOWN_ARROW
KEY_LEFT_ARROW
KEY_RIGHT_ARROW
KEY_BACKSPACE
KEY_TAB
KEY_RETURN
KEY_MENU
KEY_ESC
KEY_INSERT
KEY_DELETE
KEY_PAGE_UP
KEY_PAGE_DOWN
KEY_HOME
KEY_END

Type text macro:

c
case 2:
    textMacro(i, j, "your-text-here");
    break;

Ascii character macro (where 231 is an example):

c
case 2:
    numpadAscii(i, j, 231);
    break;

Custom code for macro

activate while key is held

c
case 2:
    if (keysPressed[i][j]) {

    ...
    
    }
    break;

activate on rising edge (keypress)

c
case 2:
    if (keysPressed[i][j] && !lastKeysPressed[i][j]) {

    ...
    
    }
    break;

Flashing

After changes have been made to Keypad.ino the program has to be uploaded to the microcontroller.

In Arduino IDE:

  • select Seeduino XIAO as your board
  • select the correct Port
  • upload the sketch

Parts

39
QtyValueFootprintReferences
121N4148Diode_SMD:D_MiniMELFD1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12
12MX1A-E1NWmiscellaneous:Cherry-MX1A-E1NW-0SW1, SW2, SW3, SW4, SW5, SW6, SW7, SW8, SW9, SW10, SW11, SW12
4MountingHole_PadMountingHole:MountingHole_2.7mm_M2.5_PadH1, H2, H3, H4
2220RResistor_SMD:R_1206_3216MetricR1, R2
2LEDLED_SMD:LED_0603_1608MetricD13, D14
13V3TestPoint:TestPoint_Pad_D1.0mmTP3
15VTestPoint:TestPoint_Pad_D1.0mmTP1
1D10TestPoint:TestPoint_Pad_D1.0mmTP4
1D9TestPoint:TestPoint_Pad_D1.0mmTP5
1GNDTestPoint:TestPoint_Pad_D1.0mmTP2
1RESETmiscellaneous:5x5mm SMD ButtonSW13
1SeeeduinoXIAOmiscellaneous:Seeeduino XIAOU1

Similar boards

  • 2 layers254 × 85.1 mmFightKey, the printed circuit board in 3D

    FightKey

    blueOkiris/FightKey

    A keyboard-based fight stick

    31 parts10
  • 4 layers100 × 38 mmKnob v02-rounded, the printed circuit board in 3D

    Knob v02-rounded

    felop/HapticKnob

    Haptic knob inspired by @scottbez1, designed to model different indent shapes

    60 partsMIT
  • 2 layers352 × 60 mmMCPBasedStopTabPanel, the printed circuit board in 3D

    MCPBasedStopTabPanel

    sdjespersen/epworth-organ

    MIDI encoder/decoder + associated designs

    61 partsBSD-3-Clause
  • 4 layers42 × 40 mmClick counter Q2, the printed circuit board in 3D

    Click counter Q2

    dudgeon/count-fidget

    A lightweight, rechargeable two-key fidget that counts clicks, resets with a second key, and remembers its count while asleep or unpowered. Designed for a home-printed enclosure and professionally assembled electronics.

    62 parts
  • 2 layers24.4 × 24.4 mmOSO SWAT B1, the printed circuit board in 3D

    OSO SWAT B1

    joeycastillo/Sensor-Watch

    A board replacement for the classic Casio F-91W wristwatch

    39 parts2.1k
  • 2 layers33 × 26 mmVL53L1x pwm, the printed circuit board in 3D

    VL53L1x pwm

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    39 parts915
  • 2 layers43.4 × 18.8 mmUsb sniffer lite, the printed circuit board in 3D

    Usb sniffer lite

    ataradov/usb-sniffer-lite

    A simple USB sniffer based on Raspberry Pi RP2040

    39 parts706BSD-3-Clause

Questions

How big is the Keypad PCB?

It measures 94 × 92 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Keypad use?

39 parts, built around the MX1A-E1NW. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Keypad KiCad files?

From the StefanLilje/Keypad repository on GitHub, at the commit this page was made from: the board is Hardware/Keypad.kicad_pcb and its schematic Hardware/Keypad.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Keypad design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).