
Needed a controller for my LinuxCNC CNC Quilter machine. Made a custom keyboard with only the keys I needed. Emulates a USB keyboard to take advantage of axis keyboard shortcuts.
Designed in Fusion360, Cut on a Glowforge Basic, Key Cap Labels cut on a Cricut Explore Air 2.
Case:
Cut from 3mm baltic birch ply. The key switches are tight enough that the tabs dig into the side of the wood to hold it in place. The bottom 3 layers are glued together with M3 nuts held captive. The cap screws come in from the top to hold everything together.




Electronics:
Super straight forward. Just uses Arduino Keypad Library to read button presses. No extra components required



Materials:
- Arduino Pro Micro Clone Atmega32U4
- Cherry MX Black Key switches
- X-keys Keycap Cherry MX Compatible
- M3 x 20mm Socket Head Screw
- MicroUSB Cable
As an Amazon Associate I earn from qualifying purchases.
Laser Cut Files & Key Cap Labels
Arduino Code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Keyboard.h" | |
#include <Keypad.h> | |
const int KEYDELAY = 100; | |
const int SEQDELAY = 500; | |
const byte ROWS = 2; | |
const byte COLS = 4; | |
// Define the Keymap | |
/* | |
Cycle Start | Resume | Touch Off | Pause | |
Up | Down | Left | Right | |
*/ | |
char keys[ROWS][COLS] = { | |
{'1','2','3','4'}, | |
{'5','6','7','8'} | |
}; | |
byte rowPins[ROWS] = { 10, 16 }; | |
byte colPins[COLS] = { 6, 7, 8, 9 }; | |
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); | |
void setup() { | |
keypad.addEventListener(keypadEvent); // Add an event listener for this keypad | |
} | |
void loop() { | |
char key = keypad.getKey(); | |
if(key) // Check for a valid key. | |
{ | |
switch (key) | |
{ | |
case '1': | |
// Cycle Start | |
Keyboard.begin(); | |
Keyboard.press('r'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
Keyboard.end(); | |
break; | |
case '2': | |
// Resume | |
Keyboard.begin(); | |
Keyboard.press('s'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
Keyboard.end(); | |
break; | |
case '3': | |
// Touch Off | |
Keyboard.begin(); | |
Keyboard.press('x'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(200); | |
Keyboard.press(KEY_END); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(SEQDELAY); | |
Keyboard.press('0'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(200); | |
Keyboard.press(KEY_RETURN); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(SEQDELAY); | |
Keyboard.press('y'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(200); | |
Keyboard.press(KEY_END); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(SEQDELAY); | |
Keyboard.press('0'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(200); | |
Keyboard.press(KEY_RETURN); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(SEQDELAY); | |
Keyboard.press('z'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(200); | |
Keyboard.press(KEY_END); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(SEQDELAY); | |
Keyboard.press('0'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(200); | |
Keyboard.press(KEY_RETURN); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
delay(SEQDELAY); | |
Keyboard.press('x'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
Keyboard.end(); | |
break; | |
case '4': | |
// Pause | |
Keyboard.begin(); | |
Keyboard.press('p'); | |
delay(KEYDELAY); | |
Keyboard.releaseAll(); | |
Keyboard.end(); | |
break; | |
} | |
} | |
} | |
// Taking care of some special events. | |
void keypadEvent(KeypadEvent key){ | |
switch (keypad.getState()){ | |
case PRESSED: | |
if (key == '5') { | |
Keyboard.begin(); | |
Keyboard.press(KEY_UP_ARROW); | |
} else if (key == '6') { | |
Keyboard.begin(); | |
Keyboard.press(KEY_DOWN_ARROW); | |
} else if (key == '7') { | |
Keyboard.begin(); | |
Keyboard.press(KEY_LEFT_ARROW); | |
} else if (key == '8') { | |
Keyboard.begin(); | |
Keyboard.press(KEY_RIGHT_ARROW); | |
} | |
break; | |
case RELEASED: | |
if (key == '5') { | |
Keyboard.releaseAll(); | |
Keyboard.end(); | |
} else if (key == '6') { | |
Keyboard.releaseAll(); | |
Keyboard.end(); | |
} else if (key == '7') { | |
Keyboard.releaseAll(); | |
Keyboard.end(); | |
} else if (key == '8') { | |
Keyboard.releaseAll(); | |
Keyboard.end(); | |
} | |
break; | |
case HOLD: | |
break; | |
} | |
} |