[sdiy] Keyboards good for scrap / repurposing?

rsdio at audiobanshee.com rsdio at audiobanshee.com
Wed Feb 21 11:41:48 CET 2018

I strongly recommend against wiring multiple buttons to a single ADC input using resistors. That’s really only something to do if you have absolutely no other choice (*). It’s certainly not a good first design option. The problem is that ADC involves a relatively long delay; and it’s analog, so those buttons won’t always be producing the same values every time due to noise, temperature and resistor tolerances. You’ll end up spending too much time testing your software thresholds to make sure that they correctly detect each button alone and in combination. Then, if you have a voltage droop, the thresholds will be all wrong.

In contrast, for the cost of diodes instead of resistors, you can connect those additional buttons to digital inputs that will not suffer from unpredictable analog thresholds. Not only that, but reading the buttons will be instantaneous, rather than having to wait for an A/D conversion. Trust me, you don’t want to introduce analog complexity where it isn’t needed. The code to read a digital input is much simpler and doesn’t require embedded thresholds.

Your 37- or 43-key keyboard will have at least 3 to 5 spare switch positions, and assuming that’s not enough it’s a simple matter to add Rows to allow any number of buttons in addition to the keys. If you start with 7 Rows for a 37-key or 8 Rows for a 43-key, then you’ll have enough spares for 19 or 21 buttons, respectively. Using a ‘138 decoder, you might as well plan on 8 Columns anyway. That’s 11 GPIO pins to read 64 separate digital buttons.


* Note that the “multiple buttons on a single ADC channel via power-of-two resistor networks” is great for automotive or other situations where you might need to run a single wire a long distance and still carry multiple signals. But in your case you can wire everything within the same PCB or two in the same box.

p.s. If those 37-key or 43-key keyboards are wired for Velocity switches, then you’ll need 10 or 11 Rows, respectively. Still, that’s no more than 14 GPIO pins for 88 separate digital switches. In other words, pick a CPU that isn’t constrained on GPIO. The last design I completed uses an ARM with 90 GPIO pins, and I still haven’t used them all.

On Feb 20, 2018, at 6:15 AM, sleepy_dog at gmx.de wrote:
> ADC mux, yes, the adc has on-board mux also, so I used 4 channels x 8x mux IC -> 32 pots.
> So far using only 26 of that.
> So I just remember the MIDI keyboard "trick" mentioned earlier, of scanning buttons with the key scan mux already present. So far only 1 push encoder gets scanned button wise, no mux, so I think for extra buttons planned,  I'll be using that trick to scan the buttons via the pot mux that's conveniently in place :) A few roughly doubling resistance values in series each connected to a button, I guess I should easily get 4 (R) x 4 (lines) = 16 buttons covered with that.
> - Steve

More information about the Synth-diy mailing list