Previous Entry Share Next Entry
Concertina plans update.
blaisepascal
Back in January, I ordered a new MIDI synth shield, which finally got here a couple of weeks ago. I've got it hooked up and making noise (see YouTube video at http://www.youtube.com/watch?v=PlzhV8VG06Q&feature=plcp).

So what's left, in terms of electronics, is making a board to interface with the keypad.

Here's the tricksy part: I have 48 buttons I need to read, and a limited number of I/O pins to do it with. The Arduino has 14 digital I/O pins and 6 analog I/O pins. Pins D0 and D1 are used for serial communication, and the MIDI synth shield also uses pins D2 and D4 for power down and reset signalling. That leaves 10 digital pins to read 48 buttons. I would also like to be able to read a few extra buttons for command and control purposes.

The chart at http://www.openmusiclabs.com/learning/digital/input-matrix-scanning/ says that with 10 pins, I can do 25 switches with no additional chips, 56 switches with a 3to8 demux (the techinque I started to use last year when I thought I had more pins available), or 64 switches with a parallel shift register. 56 is would give me the 48 buttons, plus 8 to spare for command and control.

What's intriguing, however, is that the 6 analog pins A0-A5 can also be used as digital I/O pins as well, meaning if I wanted to I could have 16 pins to play with. The same chart says that with 16 I/O lines I can do 64 switches without any additional chips. If I save one analog input for future use (such as a force sensor for dynamics), I can still 56 buttons.

At this point, I'm looking at an array, 8x8 of connectors on the board, each column connected via a ribbon-cable to a column of 6 or 7 switches (pins 1-7 will have a diode soldered in-line and wired to one side of the switch as the row line, pin 8 will be wired to all the switches as a common column line). On the board, all pins 1, ... pins 7 will be on a single row trace, and each pin 8 will be a separate column trace. The question is: do I want to use a 3to8 demux for column selection, or use 8 I/O lines for column selection?

  • 1
Or with analog you can use resistors to map out the pins and then have the voltage ranges represent the buttons. This is how many cars steering wheel controls work to reduce wire count through the hub of the steering wheel.

Que you going "But they could have a module in there and all the sensors and buttons in the car that sends out an address and a value!" But they don't yet, so sad panda car hacker right now over here.

So is there a way to set it up so that lets say 12 a on one analogue port? With a voltage divider circuit that the button combinations produce unique sets?


Cue me complaining about the spelling of "cue", more like it.

Different problems have different engineering solutions. In this case, one problem I have to deal with is chords: I want to be able to handle pressing multiple buttons simultaneously (so a player can play chords). While it is possible to have a voltage-divider network that will give unique values for various button presses, it's not an easy problem -- and may be trickier with standard resistor values and tolerances.

Many car steering wheel controls are exclusive: left OR right OR off, intermittent OR low speed OR high speed OR off, running lights OR head lights OR off, P or R or ... or L. It's easy to design a voltage divider network that'll select one-of-several. You could even do it with a potentiometer and physical detents on the switch (it wouldn't surprise me if the intermittent wiper switch worked like that). It's the many-of-several which gets tricky.

The 12-button-on-one-analog port won't work simply because the ADC ports have 10-bit resolution. I couldn't map all 4096 button combinations onto to the 1024 different analog values I have to work with. Since I have 6 analog ports, I could go 8 buttons on each port, but even so that would only give 4 values per combination (a tight margin). It could be done, but is it worth it?

As it is, I've realized that I might be able to do this even without another board, just a semi-complicated wiring harness.


Your close. But it's less inputs as you said. Was worth suggesting with tight tolerance resistors.

Ducati and BMW use bus systems to reduce wire count and harness complexity.

Secondly, new laptop and tiny keyboard as compared to my old one so typo central.

48 buttons is a perfect fit for a 6x8 array, which could be strobed with 14 digital pins. That leaves two analog pins for other uses. I don't see the need for a demux.

Physically, it's more of a 6x4x2 array (4 columns of 6 buttons for each hand, although on one hand there's a column of 7 and an adjacent column of 5). I was planning on treating it as if the rows were contiguous across both hands.

Before I realized that the analog pins could be used digitally the demux was necessary to save 5 pins. I now see that by using them, I can do it with just a wiring harness and not another board.

By going with a 7x8 array I give myself an additional 8 buttons for effects like transposing, patch changing, etc. I'd still have a free analog pin.

  • 1
?

Log in

No account? Create an account