While I wait for some parts to arrive I've been working on a way of getting keyboard state into a microprocessor. I'm planning to use the
ESP32-S2 WROOM which has 16 analog inputs, and WIFI. However because I have 30 keys on the keyboard I need to switch between 2 sets of inputs and read them independently. Sooooo, this PCB basically does that... inputs (on the left side) go into 4 chips (on the right) that in total have 32 inputs and 16 outputs and a way to select between the 2 sets. That all plumbs into the IO of the ESP32. Then in the source code, you'd select bank 1 of the inputs... read their values, then select back 2 of inputs and read their values. Then put all the values in a UDP packet and send it to the laptop via the WIFI.
My first attempt quickly ran into problems. But I was making the routing more difficult than it could be. So I rewrote the schematic to have less cross overs. But all the inputs will be out of order... The plan being to sort that out in software rather than hardware.
There is another way of doing it though. Instead of switching between 2 banks of 16 inputs. Just add a whole other 16 inputs ADC chip to the board. So you'd have 32 actual analog inputs and no switching. Something that I'll be looking into this week. I may print this board up and try it out anyway, but I have a fall back plan if it doesn't work.
The keyboard sensors themselves are (at this stage) going to be hall effect switches. And I've ordered
some of these mechanical keyboard switches. They are different to normal switches (ie on/off only) in that they are fully analog, and their output is a variable voltage across their 4mm range of movement. And there is a spring built in to return the switch to the "up" position. This should allow for me to look at the slope of the key's movement and calculate the velocity of the key hit. Well that's the theory.
I don't do PCB's professionally so this is a bit of a hack I would imagine. And it could probably be optimized somewhat haha. But it's really about "getting it done" rather than making it perfect.