2
\$\begingroup\$

This is my first real electronics project, so please do let me know if I’m doing something stupid here. :)

I’m wiring up an old set of organ pedals to a Teensy LC for use as a MIDI controller, so I’m planning for each of the 32 pedals to have an individual magnetic reed switch, and then to connect all 32 switches to a keyboard scan matrix (12 wires, either 6×6 or 8×4). Ideally I’d like to use something like this construction, where the switches are on a separate board beneath the pedals (edit: and the Teensy will probably be in an enclosure on top of the unit). In order not to have lots of loose wires running all over the place, I’m thinking that I should use a cable to connect the board with switches to the Teensy.

But...what kind of cable? The page I linked to mentioned a Centronics connector, but that seems like overkill if I only need 12 pins. For the moment, I’m leaning toward a DE-15 connector, since it’s the same as used for VGA, so I won’t have to make my own cable. Or maybe a DA-15, for which I could use IDCs and ribbon cable... but ribbon cable is unshielded, right? So would it be appropriate to use it outside of an enclosure?

Or am I going about this engineering process all wrong?

I think I’m looking for something that satisfies the following criteria:

  • At least 12 pins.
  • Connectors readily available.
  • Connectors rated for a reasonable number of mating cycles.
  • Cables readily available (e.g. VGA) or easy to make cheaply (e.g. ribbon/IDC).
  • Cables suitable for use outside an enclosure.

Any of these are up for debate. :)

\$\endgroup\$
  • 2
    \$\begingroup\$ Using IDC cables and connectors saved a lot of soldering headaches. Just beware that if you want to use more then one pedal at a time you need a matrix with a diode per switch as per [electronics.stackexchange.com/questions/420115/… \$\endgroup\$ – Oldfart Feb 12 '19 at 17:54
  • 1
    \$\begingroup\$ I assumed that the connector was because the Teensy is to be separate from the pedals. If not then just wire them up permanently perhaps. \$\endgroup\$ – Transistor Feb 12 '19 at 18:00
  • 2
    \$\begingroup\$ Ribbon cables are fine even when long, but you should not use very high scan frequencies. e.g. 1KHz should work. If you have spare strands ground them and put them between the driving and receiving groups. \$\endgroup\$ – Oldfart Feb 12 '19 at 18:10
  • 1
    \$\begingroup\$ Agreed with @Oldfart that you're fine with ribbon cables so long as your scan frequency is fairly low (which is fine, scanning fast would just waste power). \$\endgroup\$ – Nate S. Feb 12 '19 at 18:27
  • 1
    \$\begingroup\$ MIDI runs at 31.25 K baud ....... you could reduce the number of IO pins if you use a demux/mux combination ..... 74ls138 and 74HC151 \$\endgroup\$ – jsotola Feb 12 '19 at 19:11
2
\$\begingroup\$

Here is a rough diagram of a circuit that uses a mux and a demux to scan a key matrix. It uses 6 data lines

Couple of suitable ICs are 74ls138 and 74HC151.

The controller in the diagram could be replaced by a 5 bit counter.

The actual controller would then require only 3 data lines, reset, clock and data

schematic

simulate this circuit – Schematic created using CircuitLab

schematic

simulate this circuit

\$\endgroup\$
  • \$\begingroup\$ Thanks, this will be useful to study even if I don’t wind up doing it this way. \$\endgroup\$ – Marnen Laibow-Koser Feb 12 '19 at 20:19
  • 1
    \$\begingroup\$ A single-chip solution would be to use an I2C I/O expander chip, which would allow you to scan up to 64 keys with just four lines in the cable: power, ground, clock and data. \$\endgroup\$ – Dave Tweed Feb 12 '19 at 23:26
  • \$\begingroup\$ @DaveTweed I think I looked at that at one point, and figured (perhaps naïvely) that it would perform less well than directly wiring the scan matrix. Also, I²C seemed like a comparatively large amount of work to program for (though I’m sure some library code is available). I could be wrong on either or both of those assumptions, though; I know just enough to be dangerous here. :) \$\endgroup\$ – Marnen Laibow-Koser Feb 13 '19 at 5:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.