Hacker News new | comments | ask | show | jobs | submit login
Building a Keyboard (fsck.com)
90 points by flapjack on Dec 9, 2012 | hide | past | web | favorite | 14 comments



I love articles like these, this stuff isn't that hard and its way more fun than other ways to spend time (my opinion of course). Making a PCB for a keyboard is really really straight forward too. I bet we could do that on Upverter.

I really like the idea that you could use something like an iPad. (or better two iPads) rest your hands on the screen in what are your natural "home row" position. Then touch type text that appears on a screen in front of you while the iPads are busily figuring out how far your fingers are moving and 'tuning' where the other keys should be done. Once you've done like 50 words error free it beeps and send that off. Shapeways makes the cover, Albert PCB makes a circuit board, and you order key switches and diodes from a distributor. Boom a custom keyboard designed by you for you.


The PCB is the easy bit. Making the firmware which delivers your keypresses down a PS2/USB pipe is not. You have to consider things like n-key rollover and ghosting/blocking particularly when using matrix encoding/scanning which are a bastard to code.


The cool thing about the modern world is that incredibly talented people have already written decent opensource keyboard firmware. But I'll get to that in Part 2 of the writeup :)


Excellent. I look forward to reading about that :)


It's up :) Also at blog.fsck.com


Aren't those things only a problem because keyboards are being mass-produced? Companies are cutting costs by using less components which introduce these kind of problems. If you're building your own custom keyboard you're not going to care if it costs you a bit more, especially if it means you can avoid these problems from the start.


Yeah I know just enough about hardware to be dangerous but I think you can stick 6 16-bit GPIO expanders off of an I2C or SPI bus and address every switch individually. Makes no sense for mass production but for diy it's $10 in parts or something

http://octopart.com/mcp23s17-e%2Fso-microchip-470569


Scan rate is shit though if you have to use spi/i2c.


This is incorrect. While typically Linux has implemented the spidev poorly (its really just a stub to do the things you do occasionally like sideload firmware into a card) SPI itself it actually reasonably zippy for this application.

Typical "fast" SPI clock rates are 10Mhz on a 20Mhz MCU[1], and with a daisy chained set of SPI parallel I/O chips (they appear as 'one' device on the SPI bus) you can clock the state of all 105 key switches (or 120 if you're using 5 of the 24 bit ones) into an embedded processor like the AtMega328 at 10mS per sample. So that is 100 samples per second. Usable for this stuff but not ideal.

Since the n-key rollover patent [2] expired a number of companies have made chips that implement this for arbitrary sized matrices (given i/o pins) of which an exemplar is Atmel's AT43USB325E [3] which can handle up to 20 x 8 (that is 160 keys). The Atmel part is especially useful because it has a built in USB 'peripheral' port and the app notes for this part show how to easily make a USB keyboard out of a bunch of random key switches hooked to a diode matrix.

[1] http://www.atmel.com/Images/doc2585.pdf

[2] http://www.google.com/patents/US4517553

[3] http://datasheet.octopart.com/AT43USB325E-AC-Atmel-datasheet...


Even for a keyboard? Huh, good to know.


I've thought about doing something like that. Though I believe that what you want to be doing is using hand measurements and a slightly more standard design. I want to get a few of my own keyboard designs under my belt before I start making promises, though.


This is brilliant. A smart keyboard program. I'd buy it.


I've been keeping an eye on the ergodox, but was probably going to go with a kinesis. You've tempted me about the fun of building one myself instead.

Could you ballpark what the cost to build one would be?(ignoring tools like the soldering iron?)


Right. I'd meant to write up the pricing.

Keys - $0.80 x 78 Diodes - $2-$3 3D printed shells - $240 from Shapeways. Cheaper from a friend with a makerbot Keycaps - Cheapest when harvested from a board found at goodwill. Otherwise, $35 or so from WASD Teensy++ - $24

I'll leave the "priceless" joke to the peanut gallery.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: