176 Analog inputs!

No joke.

I am building an 88-key keyboard that I need to incorporate analogRead for each key- twice. First the key is hit a certain velocity (analogRead number 1), and then a sensor on the key can slide for each key (analogRead number 2). It's kinda like a seaboard.

My question is... is there any way to practically do this (so the arduino cycles through the loop quickly) without compromising performance or buying 12 arduinos? I've been reading up on multiplexing and charlieplexing (that one I don't understand as well), and I've also been looking at matrices (11x8 matrices, of course). I would love to use matrices, but are they able to utilize analog signals, or only digital ones? I've only seen them used to read digital, not analog, so if there is a way to make that work that would obviously be my first choice. Multiplexing on the other hand seems like you can only read one at a time, and I don't know if multiplexers would be fast enough to go through 176 analog inputs, since you would have to cycle through with digital outputs and get a physical response in the multiplexer and what not.

Of course any other suggestions would be greatly appreciated, because I would really rather not have to buy 12+ megas for this project. Thanks!


What are the 88 sensors for velocity? And why does the key down detection need to be analog?

each key (there are 88 keys in a musical keyboard) needs to detect velocity, and detect the pressure that remains on them for the time they are pressed down (I'm using FSR's to utilize aftertouch in MIDI).

Point one: Reading velocity is a tall order. You can't achieve that without significantly more horsepower and the ability to do LOTS of A/D conversions.

Point two: You don't want to sample in analog for a key depressed event, that should be digital. Once the key down has occurred, then you can start reading the FSR.

Ultimately, I doubt you can do this with an AVR class machine, you'd be far better served with an ARM device, a Teensy 3.5/6 comes to mind. What I don't know is if you can back down the A/D resolution, I'm sure 6-7 bits resolution is probably enough for the FSR's, if this allows for a speed up in conversion speed, which is what you need.

I'd suggest you check out the forum over at prjc.com. There's a lot more activity releating to midi and audio in general as the Teensy is the defacto standard for audio projects.

The following instrument has 200 note pads. It is controlled using a Due. The software is open source on github.


While it may use a Due with open source software, the hardware appears to be a closed design.

The internal ADC of the Due is not used, touch sensing is external over SPI with an ADS7883 ADC which has a 3 MSPS data conversion rate. The keyboard appears to be a pure analog resistive touchscreen type of device, not individual sensors. The Z axis data is 7 bits internally.

A lot can be gleaned from that code base, it appears to be well written and commented. I did a brief search for the hardware, to see if anybody has opened one and photographed the internals but I found nothing.

I did a brief search for the hardware, to see if anybody has opened one and photographed the internals but I found nothing.

The firmware programmer/designer/musician (1 person) gave a talk at a conference about the project. The talk includes a few photos of the inside. He talked about the software design in some detail.


If you really want to do everything with ADC, you need a very fast sampling rate for every key or you'll miss the peak velocity of the attack. I'd think that analog circuitry will be required to hold that peak value of every key, which then is inspected for keys pressed at a moderate sample rate. Both the attack and persistence can share the same load cell (strain gauge), with and without peak hold circuitry. Also strain gauges require sensitive amplifiers, so that you'll have to spend much money for such keys usable with microcontrollers.

Multiple keys pressed at the same time require much higher ADC sampling rates, or you risk to add audible delays to the keystrokes.