MIDI Controller - Analog multiplexer or IO Expander

Hi all,

I'm working on a MIDI controller that will use 96 force sensitive resistors to detect how hard a key is pressed. I made a post here about it a while back, and someone suggested that I use analog multiplexers. After some research, it seems analog multiplexers can have crosstalk and some other issues.

Someone had mentioned IO Expanders as a "better" version of multiplexers. I believe certain IO expander chips can also do interrupts, which seems beneficial when you have 96 keys..

My questions are: Which one of these chips would you recommend for my situation, given that I need to be able to detect multiple keys being pressed at once?

Would I need to set up some kind of matrix like a traditional button array uses, or would I be able to read all the sensors fast enough to know their current state?

I/O expanders are generally digital chips.

You have two options - analog multiplexers or multiple input ADC chips which of course, are based on built-in analog multiplexers.

Of course analog multiplexers can have crosstalk and some other issues. But - so what? What does that possibly have to do with your application?

{Hint: crosstalk relates to high impedances. Force sensitive resistors should be very low impedance.}

Paul__B: I/O expanders are generally digital chips.

You have two options - analog multiplexers or multiple input ADC chips which of course, are based on built-in analog multiplexers.

Of course analog multiplexers can have crosstalk and some other issues. But - so what? What does that possibly have to do with your application?

{Hint: crosstalk relates to high impedances. Force sensitive resistors should be very low impedance.}

Ah okay, was wondering about that.. was trying to find examples of an analog io expander and was getting mixed info. So analog multiplexers it is.

I'm a little concerned with the speed that I'll be able to sample all these sensors given that the Arduino, or I guess ATMEGA chip, has a roughly 110us ADC conversion rate. With 96 sensors, for 1 sample of all the sensors it would take roughly 10ms which would give me 100 samples per second - Which I'm completely fine with, but if I use any processor intensive code I believe it will take that sample rate down noticeably.. I guess I could offload the rest of my code to another atmega chip, that seems kinda hackish though. Is there a faster way to do this, or is this not as much of a problem as I think?

Sorry for any dumb questions, I just started messing with Arduino and electronics.

EDIT: Just found some info on changing the ADC prescalar to get a higher sampling rate.. the tradeoff is you lose some resolution, but I have some hope that it will be fine as long as I only take what I need.. will only know when the multiplexers get here. :]

Force sensitive resistors should be very low impedance.

But the are not. If they are not being pressed they are a very high input impedance, several meg. On pressing them they drop to 50K or so, so still quite high. You can put a pull up resistor to stop this but that reduces the dynamic range.

There are lots of diffrent analogue multiplexers look at the data sheets for cross talk figures. This tends to be more of an issue for high frequency signals rather than the almost DC you will be using.

Grumpy_Mike: There are lots of different analogue multiplexers look at the data sheets for cross talk figures. This tends to be more of an issue for high frequency signals rather than the almost DC you will be using.

Yeah, like he said! :D

Suffice to say, it is quite a trivial concern.

If the ADC conversion time is 110 µs, and I have not looked into this - that does not matter. Microcontrollers are all about "smart" code. During that 110 µs, you simply do something else - plenty of time!

You break up your tasks into "chunks" that will take less than 110 µs, and the main "loop" interleaves pieces of the ADC reading task with pieces of your other code, however "processor intensive" that may be.

You will see other reference here to "state machines" to do this, which is but one formal way of performing this interleaving. It is a matter of thinking in terms other than that the code must finish a given task before it moves on.. Once you can think in this fashion, "the world is your oyster". Or at least, the microprocessor is. :D