I can warmly recommend using a
Teensy for this. A Teensy LC would be just about perfect (and cost only USD $13), but they're unavailable due to the chipageddon going on (except
TinyTronics says they have them in stock for 20€ incl. VAT). A Teensy 4.0 is a good alternative. I recommend getting them from reputable sellers (and not e.g. eBay), because the bootloader chip (NXP MKL02) contains a custom, preprogrammed proprietary bootloader, and the Chinese Teensy clones do not. (You can, however, make your own Teensy compatible boards yourself, and buy the chip from
PJRC; you just musn't include "teensy" in the name of your gadget, for trademark protection reasons.)
Aside from the bootloader chip, basically all of the Teensy-related sources are available on the net, at Paul Stoffregen's
github repositories. (I do believe the only thing not open source, aside from the proprietary bootloader chip, is the GUI loader utility. The command-line one, as well as the protocol used to program Teensies, is however
open source, licensed under GPL 3+.)
Essentially, you use the
Arduino environment with the Teensyduino add-on to program the Teensy boards. (There is an active discussion board at
https://forum.pjrc.com/ regarding all Teensy boards and programming them. They are commonly used for HID devices like keyboards and flight simulator cockpits.)
Thing is, the Teensyduino add-on provides easy support for many USB types; for example, Serial + Keyboard + Mouse + Joystick, or Flight Sim Controls + Joystick, or even Raw HID. You just need to select the Teensy board in the Arduino IDE, the USB type, and the keyboard layout if the USB type includes a keyboard, and very little Arduino code to get it working.
See the Joystick example page for example.
Keyboard, Mouse, Joystick, Touch Screen, Raw HID, and Flight Sim Controls are all native USB HID interfaces, and do not require any drivers from the target operating system. You just plug in the Teensy, and it will work. (Some OSes have idiosyncracies, and I've heard Mac OS has issues with the Touch Screen, and Windows is a bit particular on the number of axes etc. on Joystics, but AIUI they are rare and can be worked around.)
You can get something working literally within minutes.
There are even Teensy-optimized libraries for debouncing buttons, reading encoders, and so on. They are permissively licensed, so there is no obligation to open source your own code.
Years ago, I designed a couple of cheap and simple carrier board for Teensy LC, one with
SMD resistors and diodes (four 10k resistors and sixteen dual common-cathode Schottky diodes in SOT-23, like BAS70-05), and the other with
all through-hole components (four 10k resistors and thirty-two Schottky diodes). Both support up to 32 buttons –– using two wires per button, wires soldered to the board –– and 9 potentiometers (I suggest 10k linear), three wires per potentiometer. The carrier itself is in Public Domain, and you can manufacture a few at JLCPCB or PCBWay for a couple of USD plus shipping. IIRC, this was to help someone with their arcade cabinet.
I've also designed a 4+4+2-button digital
Gamepad using a Pro Micro clone (back when ATmega32u4-based Pro Micro clones were cheap and plentiful at eBay) with option for a 128×32 I2C OLED display for choosing the button-to-keypress mapping at run time (using the two smaller buttons) –– it can generate both joystick and keyboard events. The idea is that there is one board smaller than 100×100mm that forms a bottom and a top plate. Top plate has no circuitry on it, and even the bottom plate is just tracks only, no components. The two buttons are 6x6mm tactiles with tall buttons, and the eight are standard 12×12mm tactiles with round hats. I never did manufacture this one, though.
I do recommend trying out stuff on breadboards (or rather, using wires, perhaps ribbon cable, soldered to the board) first, then using EasyEDA or KiCAD to design simple carrier board with suitable shape and/or fastening holes, manufacturing it at e.g. JLCPCB or PCBWay (cheap!), and maybe 3D-printing a shell or fascia for the HID device. I personally end up playing with modeling clays and air-curing clays to get the right "feel" for my sausage-fingered hands...