Live data from Hacker News

My First Keyboard Build

davecooper.org

51–60 of 82 posts

Re: My First Keyboard Build

#51
post #37

With a diode matrix, is it possible to distinguish multiple simultaneous key presses? And if not, how do you handle modifier keys? Looking at your photo, it would seem that they're wired into the matrix in the same fashion as the rest of the keys.

[deleted]

Re: My First Keyboard Build

#52
post #37

With a diode matrix, is it possible to distinguish multiple simultaneous key presses? And if not, how do you handle modifier keys? Looking at your photo, it would seem that they're wired into the matrix in the same fashion as the rest of the keys.

Yes, you can detect an arbitrary number of simultaneous keypresses. The only limitation is that you can only scan one of the dimensions in parallel.

Re: My First Keyboard Build

#53

Current keyboard designs bug me, to put it mildly. Put a mux on each group of switches, have the microcontroller rapidly scan the muxes to determine which switches are down. And now all of a sudden you have a keyboard that you can actually press down as many keys as you need and it still works. Except it won't. Because USB keyboards don't support arbitrary numbers of keys being pressed at once.

Elaborating on this, in case anyone wants to know more details (I'd edit the original, but for some reason HN decides you can't edit comments after an annoyingly short time limit.) Say you have N free pins on your controller, and you want to read K keys. Find the smallest integer number of columns such that log2(k/c) + k/c Tie each row via diodes to 1 key in each column. Then tie each row to a pin on the controller.…

You may be surprised to find that you can get microprocessors with over a hundred general purpose I/O pins if you're willing to solder them all down (the STM32Fx series in the QFP208 comes to mind) that would let you wire every key of a 104 or 107 key keyboard to a pin for monitoring. And you could read them all at close to a megahertz so you could get an effective state of all the keys at a given point in time. (the chip can run at 168Mhz and you're looking at basically 14 I/O ports.)

Re: My First Keyboard Build

#54

Earlier quoted context omitted.

Elaborating on this, in case anyone wants to know more details (I'd edit the original, but for some reason HN decides you can't edit comments after an annoyingly short time limit.) Say you have N free pins on your controller, and you want to read K keys. Find the smallest integer number of columns such that log2(k/c) + k/c Tie each row via diodes to 1 key in each column. Then tie each row to a pin on the controller.…

You may be surprised to find that you can get microprocessors with over a hundred general purpose I/O pins if you're willing to solder them all down (the STM32Fx series in the QFP208 comes to mind) that would let you wire every key of a 104 or 107 key keyboard to a pin for monitoring. And you could read them all at close to a megahertz so you could get an effective state of all the keys at a given point in time. (the…

Welp. I keep forgetting how absurd microprocessors are now. Still... That's got to be a fun soldering job. And those are 1.8v / 3v chips, whereas if you're using USB you've got 5v input.

Does it support interrupts on the pins? Or just polling?

Also, can you give me a specific example of a specific part? Searching "STM32Fx QFP208 package" gets me... a link to your comment. Great to know that HN gets crawled, but still...

Re: My First Keyboard Build

#55
I think that it'd be feasible to "teach" the firmware assignment of pins to rows/columns by pressing the keys in sequence upon first startup. You could probably even get away with pressing every key in any order in the "teaching" step if you installed some precisely chosen diodes in reverse.

Re: My First Keyboard Build

#56
post #38

If you're interested in soldering together a keyboard, but not having to design everything from scratch, it's worth checking out the Ergodox: http://ergodox.org/ . I built one a month ago, and I'm enjoying it a lot. It's a two-piece keyboard with straight key columns, and six buttons for each thumb. You can order the parts on massdrop, when they start another order: https://www.massdrop.com/buy/ergodox?s=ergodox It's…

I also recently built an ergodox and it is definitely worth checking out. As far as assembly, I didn't bother with a magnifying glass or anything. Just my phone to act as a good bright light source and everything went smoothly.

I would recommend extra care with the diodes as I lost a few opening the packaging and had to get extras to finish the build.

Re: My First Keyboard Build

#57
post #22

Excellent build quality, but I was surprised by these two statements on things you need: A decent soldering iron. You will thank yourself later. Also note: you will burn yourself many times throughout the build. Might as well do it with a fancy iron! LEADED SOLDER – I started the build without leaded solder and oh dear… If you have a "decent soldering iron", then lead-free solder shouldn't be a problem. Also, if you…

Thanks for the tips! I found it very difficult to do the soldering due to an extremely unsteady hand and not a whole lot of experience. I 100% agree with everything you're saying though - I just ran with what I thought worked.

It looks, in the photos, like you were trying to solder together two diode leads in mid-air.

The trick to soldering when you have unsteady hands is to set things up so if you press harder the two things being soldered make better contact, instead of being pushed apart. That way you can rest the tip of the iron on the workpiece.

Soldering leads together in the air can be a right pain, because you can't press on hard without them moving apart. You can usually find tricks to avoid it though - like putting an old PCB and some packing material below the joint, so you have something to push against, and twisting the leads together so they can't move apart as easily.

Re: My First Keyboard Build

#58

Earlier quoted context omitted.

You may be surprised to find that you can get microprocessors with over a hundred general purpose I/O pins if you're willing to solder them all down (the STM32Fx series in the QFP208 comes to mind) that would let you wire every key of a 104 or 107 key keyboard to a pin for monitoring. And you could read them all at close to a megahertz so you could get an effective state of all the keys at a given point in time. (the…

Welp. I keep forgetting how absurd microprocessors are now. Still... That's got to be a fun soldering job. And those are 1.8v / 3v chips, whereas if you're using USB you've got 5v input. Does it support interrupts on the pins? Or just polling? Also, can you give me a specific example of a specific part? Searching "STM32Fx QFP208 package" gets me... a link to your comment. Great to know that HN gets crawled, but still…

http://www.st.com/web/en/catalog/mmc/FM141/SC1169?sc=stm32 has the list. http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN1806... is one chip you could use, though frankly using that much processor for a keyboard firmware is hilariously overkill. (Not that there's any reason not to for a hobby project, really...)

Re: My First Keyboard Build

#59

Excellent build quality, but I was surprised by these two statements on things you need: A decent soldering iron. You will thank yourself later. Also note: you will burn yourself many times throughout the build. Might as well do it with a fancy iron! LEADED SOLDER – I started the build without leaded solder and oh dear… If you have a "decent soldering iron", then lead-free solder shouldn't be a problem. Also, if you…

Let me add: another important part of soldering is understanding flux. Most spools of solder are not just lead/tin/etc, they include some chemicals that eat away the oxide layer on metals so that the solder can better adhere. When you solder to a PC board you get a pool of goop around the solder pad; this is the flux.

When soldering in the air, it is harder for the flux to go where it needs to go. When soldering wires/leads to each other, it helps to apply flux beforehand, say with a flux pen.

Re: My First Keyboard Build

#60
post #58

Earlier quoted context omitted.

Welp. I keep forgetting how absurd microprocessors are now. Still... That's got to be a fun soldering job. And those are 1.8v / 3v chips, whereas if you're using USB you've got 5v input. Does it support interrupts on the pins? Or just polling? Also, can you give me a specific example of a specific part? Searching "STM32Fx QFP208 package" gets me... a link to your comment. Great to know that HN gets crawled, but still…

http://www.st.com/web/en/catalog/mmc/FM141/SC1169?sc=stm32 has the list. http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN1806... is one chip you could use, though frankly using that much processor for a keyboard firmware is hilariously overkill. (Not that there's any reason not to for a hobby project, really...)

I'm still astounded that you can pick up a chip like that for Huh. Something to consider. Thanks for the links!
Post reply on HN