One Solution, Many Problems

You might think you’re lucky when one of your problems has multiple solutions, and you get to pick and choose, but you’re even luckier when one solution has many problems! This week I stumbled on an old solution in a new place. The project was a fantastic old MIDI guitar build, the Tryndelka by [Aleksandr Goltsov]. And the old solution? Switch matrix diodes.

You see, [Aleksandr] is making an electric guitar where the strings are pulled up to a certain voltage and then make contact with metal frets. Each fret is cut into six pieces, so that the strings can be read out individually, and the microcontroller scans each string in succession to test if it’s pressed down or not. Done, right? Wrong! The problem comes when two or more strings are pressed at once — the electrical path from the string you want will travel through the closed switch on a string that you’re not scanning. The solution is a ton of diodes.

I learned this problem the hard way in wiring up a MAME cabinet, at about 3 A.M. the night before we were going to bring it to Shmoocon. We finally got the whole USB/button code working, so we played some celebratory rounds of Street Fighter. We eventually noticed that hitting one button, or even moving the joystick in a particular direction, would block some of the other buttons from working, or change their function entirely. Quick Internet search later, and we were hand soldering 64 diodes until dawn. Good times!

But the fact that switch matrices need diodes, and exactly why, is forevermore burned in my brain. It’s fun to see it pop up in all sorts of contexts, from DIY keyboards to MIDI guitars, to Charliplexing. (It’s the “D” in LED!) It’s one of the classics — a solution to many problems.

7 thoughts on “One Solution, Many Problems

    1. Diode logic doesn’t have an inverter, so it’s not universal. The trick around that is to invert the logic itself, with the consequence that you cannot know the logic function of a diode circuit by looking at it.

    1. As much work as they’re doing, the same would be accomplished simply by lowering the voltage of the microcontroller itself, so the 1x/2x diode forward drop would fall in line with the logic levels.

      1. As much as I love dirty edge-of-the-voltage-threshold-in-digital hacks…. oh wait, that’s not all that much. :)

        I got bitten by this with a Logic Noise build workshop once. Can’t remember the parts anymore but one manufacturer’s Schmitt trigger thresholds were different than another’s and it caused all sorts of havoc. CD40106 vs ? Or maybe I mixed up CMOS and TTL thresholds. All fun and games unless you’re using them for their analog voltage levels.

        In the keyboard application, they’re trying to do a matrix with fewer input pins, like Charlieplexing? Has anyone turned to resistors and using the ADCs? At least reading out analog voltages as analog voltages, you stand a chance of it working in summer _and_ winter, with some tweaks to firmware constants.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.