Close

Debugging the keyboard

A project log for Stylish!

A most stylish wearable music synthesizer! A real stylus based monophonic music synthesizer built into a giant trucker belt buckle!

t-b-trzepaczT. B. Trzepacz 10/02/2018 at 05:490 Comments

Trying to make a synthesizer as a piece of swag means a really tight price point that is not well served by having to have a ton of switches for a keyboard, never mind that making a playable keyboard is harder than just putting some switches on a board.  Trust me, I've tried!

To solve this conundrum, I determined to use a stylus attached to ground to select traces on a bare circuit board to complete the circuit, acting as a psuedo-switch. This solution was pioneered by the 1967 Stylophone and it's successors, and has been popular in a number of maker projects. This solution requires a large number of pins on the CPU, or else some sort of implementation with shift registers, or multiplexers, or maybe even a resistor network. But we are going for cheap, so we are trying to avoid any components if at all possible.

This really seemed like a no-braiiner; find some free pins on the CPU, attach them to bare PCB, attach a stylus to ground and you are done!

My prototype stylus
A stylus made from some thick copper wire, some flexible stranded wire, and some heat shrink tube.

Well, that wasn't quite it. Although most of the pins worked as advertised, there were still three keys not working. Touching some of them would cause the system to lose USB connection to my PC!

Well, it turned out that two of the pins were actually being shared by the USB port! . Time to cut traces and remap! But I only had one pin free at this point. So I wired one key to the free pin, and the other to one of the pins used by the 4 buttons at the top. Obviously, that is going to be a problem, but I'll solve that later.

The other pin turned out to be attached to some debugging function that I wasn't using. You won't believe how long it took me to find that! So I dug into the STM32duino source and the datasheets and found a way to turn this off. Yay! The A# key now works!

But there was still a problem with the key that I had remapped to the one free pin. What did it turn out to be? A typo in the code.

So, finally, all of the keys were working! 

Next up, time to get everything running together!

Discussions