Amkey capacitive keyboard controller

xwhatsit

08 Sep 2014, 03:52

Xavierblak got in touch with me a few weeks ago after acquiring a triplet of rather interesting keyboards. Fast forward to today, and here is one sitting on my desk.
IMG_1373.JPG
IMG_1373.JPG (191.77 KiB) Viewed 11643 times
His thread has lots of information and far nicer photos than my iPotato managed to produce; check it out. In short, it's a linear, capacitive, foil-and-foam keyboard unit out of a B52 Stratofortress. The keys are engraved and filled sphericals; not as much depth and weight as the beautiful Honeywell and IBM sphericals, but still nice keys. Any shortcomings are made up by the terrific legends; “WPN DELIV”, “RDR JAM”. Oddly enough there's an “MSN” keycap too...

The key-feel is quite nice, much nicer than I expected. Much smoother than the horrible Cherry MX linears I've tried (how is that company one of the only remaining mechanical keyswitch manufacturers remaining? Race to the bottom? I digress...). Nice “clop” on bottoming out.

The “pad card” is quite interesting. The bottom side is simply a hashed ground fill (pretty!), with some hookups for the columns, no direct part played in the capacitive sensing:
IMG_1376.JPG
IMG_1376.JPG (488.25 KiB) Viewed 11643 times
The top side of the pad card is where the interesting stuff happens:
IMG_1384.JPG
IMG_1384.JPG (358.55 KiB) Viewed 11643 times
The funny bits (looking a bit like Chinese characters) inbetween the key pads is simply more ground fill. The capacitive part is formed by the over-under pairing of the two rectangular pads. The pads with vias connected to them are columns; the other side are rows.

This is quite a different system from what IBM used; they used capacitive coupling through no less than three capacitors formed by pads and the flyplate. The system Amkey used here I can see is more prone to stray capacitance (probably why they used a hashed ground fill rather than a solid ground plane, to mitigate some of that), but is resistant to electrical inteference without having to use the massive heavy bottom plates fitted to the Beamsprings and Model Fs.

There are two connectors; one 32-position pin header across the top (columns), and one 16-position pin header down the left-hand-side (rows). That sounds like a rather fearsome amount of rows and columns until you starting buzzing it out and realise both connectors have interleaved ground pins. Every even-numbered pin is ground. This is more noise shielding (the keyboard is quite open in construction, you can see why it might be necessary).

Let's take a look at the controller (don't you love that curvy hand-routing; one day Kicad, one day...):
IMG_1378.JPG
IMG_1378.JPG (501.45 KiB) Viewed 11643 times
Here we start to get an idea of how they're doing the sensing. The big AMD chip is some sort of micro; the chip at the bottom with the label an EEPROM. At the top right there is an 74154 to break out the 16 connections for the columns, so the micro only needs to drive four lines. The interesting stuff is over on the left, by the 16-pin row connector.

Here we have an MC14051 analogue multiplexer, to break down the 8 row sense lines into a single output. This is fed to the MC1357. What's that you ask?! Why, it's an FM amplifier! Something you would normally find inside an FM radio or a TV. Why is it here? Well, bearing in mind RF/radio is not exactly my area of expertise, the MC1357 is a certain type of FM chip. It's got a quadrature detector in it. This gives us a clue. Quadrature detectors are designed to carefully follow oscillating signals and pick out when they start deviating from a certain frequency. They are tuned to a certain frequency (the knob on your radio!), and then feed the signal through a capacitor which shifts the phase and allows the detector to measure how far the signal deviates from the centre frequency. Sound useful? In this implementation, the capacitors within the keyboard are used as part of the circuit, varying the centre frequency and with the use of a little comparator (8-pin LM393 at the top left) to scale the signal back to TTL we can read the pressed keys.

It's an inventive use of a part designed for something completely different, but would be highly effective and reliable. On the negative side, you could see you'd need to hit each column with a few square wave cycles before you'd be able to read the result, so it's not quite as fast as the IBM dV/dT method that I pinched for my controllers.



So! After I finish shipping Batch 2 of the ibm-capsense-usb controllers, I will have one left—a Model F USB controller. This conveniently has 16 columns and 8 rows. Then we will see if I can apply the IBM dV/dT sensing method to these capacitive boards. If it works, I may be able to get by with a simple adaptor board that adapts a Model F USB controller to the Amkey connections. I'm hoping I don't have to go to a more involved sensing method like the original Amkey circuit, which looks rather fiddly and slow and would be a bit of a departure; the Amkey circuit does look more tolerant of individual deviations between keys, which IBM was always careful to avoid. That said, with the SPI DAC I'm using in the modern ibm-capsense-usb controllers, I could change the setpoint many times per scan and still have an acceptable scanrate. Experiments must be performed :D

andrewjoy

08 Sep 2014, 09:57

Ooo hand traced PCB, old school !.

Always love a teardown from an electronics perspective. Don't like them caps on there side tho or that one resistor at the top raised off the board. Beeper for a key beep too cool.

Remember the rule "Don't turn it on , take it apart!" Dave Jones

xwhatsit

08 Sep 2014, 11:26

I wouldn't even know how to turn it on! What power rails B52 Stratofortresses put out over that bus I don't know...

As a Kiwi I can barely stand his (extreme, even for an Australian!) accent for more than three seconds but that Dave dude is pretty awesome :lol:

andrewjoy

08 Sep 2014, 11:31

I love his accent does not bother me, one of my favorite channels to watch, along with mikes electrical stuff.

EDIT


Is aircraft stuff usually not usually 400htz 115v (AC ofc), so this must plug into something that steps that down and does the AC to DC? So possibly just 5v for the logic , but then again most analog stuff needs strange voltages.

xwhatsit

08 Sep 2014, 13:00

I lived in Australia for quite a few years and after shifting between the two countries now can barely tell the accents apart. Dave's accent on the other hand... it's actually pretty hilarious. His videos are at least as worthwhile for comedic value as the educational aspect :D

I haven't traced the controller too far yet, but looking at most of the stuff on there I'd imagine there'd be a mix of 12V and 5V. Maybe just 5V. I don't think the EEPROM is quite crusty and old enough to need a negative rail as well (some of them did). The most recent date code on a chip I can find is 1988 I think. The whole board has got that classic 80s–90s low-production hand-build feel about it.

Before I left work today, I ran a signal generator through one of the columns, outputting a square wave. About the only recent use I've had for a signal generator... maybe since I was doing the first steps on the Beamspring controllers? Anyway, on the rows I saw a nice big fat juicy 300mV peak-to-peak swing from a 5V square wave into a column, which is very healthy. That was with the key pressed; take your finger off and it drops back to just a few tens of millivolts. Bodes very well for hooking up to a Model F USB controller :)

User avatar
Muirium
µ

08 Sep 2014, 14:32

Superb find! Sounds like they are indeed using superheterodyne electronics to read the matrix, which is a nice wee trick.

A B52 is a hulking beast, but even so I'd guess the designers of this board had weight reduction in mind when they avoided the heavy metal casing IBM's approach required. This system seems quite smart for going plastic. Although I wonder if it's any good against an electromagnetic pulse! These were nuclear bombers, among other duties…

Of course, they'd need to make a TKL or smaller for a fighter, and maybe shorten down those spherical caps!

andrewjoy

08 Sep 2014, 14:57

It would be so cool if one of the red caps said "fire!" and had a little mushroom cloud on it :D

xwhatsit

08 Sep 2014, 22:36

You can tell I'm not from the golden age of electronics tinkerers (hey, I'm a computer scientist anyway! :lol:) as superhet only rang a vague bell just now. I think I remember reading about it as a kid in one of those Dick Smith Fun Way Intro Electronics books (a staple of Australasian primary school kids—I never understood very much, my C64 and BASIC were far more interesting!). Used to be all hackers were radio nerds at some point.

...one of the keycaps says “BOMB SCORE”, which is almost good enough! I'm not looking forward to the invetible request for the “AIR FLDS” key to bring up a browser with Google Maps pointing out all the nearby aero clubs.

xwhatsit

09 Sep 2014, 09:42

Well... some pretty good news. Tonight (after missing the post office for Batch 2 of the capsense controllers :( ), I had a play with the keyboard.

I needed to break out all the pins to wires; the method I used to do that was era-approriate for the keyboard: wire-wrap. I realised I had a bunch of long pin headers and some wire-wrap wire, so I made a wire-wrapping tool out of an old ballpoint pen and got to work. Here's the hideous results:
IMG_1390.JPG
IMG_1390.JPG (220.3 KiB) Viewed 11485 times
I then started hooking these up to the Model F USB controller. It got a bit hairy when I realised I had the controller backwards but that was fixed with a long ribbon cable:
IMG_1392.JPG
IMG_1392.JPG (279.68 KiB) Viewed 11485 times
IMG_1393.JPG
IMG_1393.JPG (203.53 KiB) Viewed 11485 times
Does it work? Kind of! I have a bunch of faulty connections (I tried just blobbing solder in there on the controller without stripping the wire; it often works with that thin Kynar insulation as it just burns off, but not 100% in this case), but nevertheless I was able to set a manual threshold voltage on the controller and press keys and get responses :D It's missing some columns and one or two rows, but nevertheless I can damn near use the thing.

Interestingly, changing the threshold voltage actually changes the “activation point” of the linear keys. I will have to be careful with my so-called debounce filter (there's nothing really bouncing here of course), as without the mechanical hysteresis of the IBM beam/buckling spring there's the potential to get some rapid toggling of state if the key is held half-down.

It's a bit over-sensitive and fiddly at the moment, but that fact that it's working at all in that state (with wires tangled everywhere, no proper grounding etc.) is excellent news. I'll have a bit more of a play with it to see if I can't get all the keys working (might have to tweak some constants inside the keyboard scanning logic), and then it will be a matter of deciding whether I can get by with a simple Model F USB -> Amkey adaptor, or whether I want to design a full controller. I'm leaning towards the second in terms of tidiness and cost at this stage.

xwhatsit

10 Sep 2014, 03:09

Well, I'm typing this post on the damned thing now. No weird key repeats, no glitches or ghosting, no scan issues at all! The only problem is proving to be me not knowing where to put my hands; I've mapped the whole thing up a row so I can use the bottom-most row as a many-keyed spacebar. The lack of a backspace in the usual place is also proving a bit mind-boggling for some reason. I imagine if you're into Maltrons and matrix boards and other weird things this will all feel perfectly natural but it's freaking me out :lol:

I simply fixed the dodgy connections I'd made yesterday, found a voltage threshold where all the keys worked properly (140 seems good), and set about mapping all the keys. There's no calibration nodes in the matrix, so setting a fixed voltage threshold override will be necessary, but there haven't been any nasty suprises! The hardest problem has been figuring out what scancode to map to each key... there's certainly no shortage of them! I've doubled up on a bunch of scancodes; for example, the three keys at the right of the main block on the third row are all Enter (including WPN DELIV... satisfaction every line ending).

I've got the whole setup propped up on books at the moment (there's obviously all my hairy prototype wiring hanging loose in there at the moment), excuse messy desk:
IMG_1397.JPG
IMG_1397.JPG (280.48 KiB) Viewed 11442 times
Underneath there's this mess:
IMG_1398.JPG
IMG_1398.JPG (411.68 KiB) Viewed 11442 times
Seeing how well it works is making me think again about maybe doing a simple adaptor. But then again a whole new controller would be the same size of PCB (due to the right-angle orientation of the connectors), and a single board would be so much tidier.

Getting stuck into designing the PCB(s) might have to wait a couple of days, but hopefully I'll be able to get stuck in soon.

Thanks xavierblak! Never thought to try one of these controllers with a non-Beam/Buckling spring keyboard. I'm surprised how straightforward it has adapted to a very different sensing scenario (linear, no mechanical hysteresis, top-side two-capacitor pad card etc.). What other crusty capacitive boards are out there waiting to be revived?!

xwhatsit

10 Sep 2014, 06:03

Start with the basics...
Attachments
amkey.png
amkey.png (33.58 KiB) Viewed 11426 times

xwhatsit

12 Sep 2014, 12:15

I think I've finished the controller... it's essentially the same circuit as the Model F USB, just with different pinouts to the keyboard itself etc.

top:
amkey_top.png
amkey_top.png (101.4 KiB) Viewed 11343 times
bottom:
amkey_bottom.png
amkey_bottom.png (207.37 KiB) Viewed 11343 times
I've placed all the components (apart from the 90° right-angle pin header/expansion header) on the bottom, unlike the original controller. All of the components are pretty low-profile so it won't really increase the thickness very much. It was just much more simple to lay it out this way, meaning much less crossing over of some of the delicate stuff near the columns/rows connectors to the keyboard.

It's a relatively large board compared to the other ones, just because the row/columns headers are placed physically quite far apart. You pay by the bounding rectangle at OSH Park, so it comes out as a relatively pricy board. I may get it fabbed at another fab I use sometimes for larger stuff. They also seem to have a faster turnaround time, and I don't have to stick with the skody old purple. The quality isn't quite as good as OSHPark (especially silkscreen and solder mask resolution/alignment), but it's perfectly acceptable for something with a relatively low-spec board like this. I wouldn't necessarily these guys for an 0.5mm BGA though...

andrewjoy

12 Sep 2014, 12:50

Your talent to churn out capsence keyboard controllers is an impressive skill :D

next job make me a PCB for a ghetto 62 key F :D

quantalume

12 Sep 2014, 18:58

How well has the foam held up on those switches? It looks like they used a key detection method similar to what I was going to use before you came along and did all my work for me. ;)

User avatar
chzel

12 Sep 2014, 19:18

hey xwhatsit perhaps it would be possible to fit two boards in the same (or slightly larger) rectangle? in a sort of nested configuration (rotated 180o)?

xwhatsit

13 Sep 2014, 03:01

andrewjoy—I'm excited about wcass's experiment! Not being much of a mouse user I'm perfectly happy with all manner of aircraft carrier keyboards, but it does open up a bunch of options...

quantalume—It all looks intact to me, but I didn't look too closely when I had it apart. I've never come across foil and foam before (I understand there's purely “ohmic” variants as well?), but hadn't heard kind things previously. The foam is incredibly lightweight and is mostly air. It doesn't look like it'd last forever, that's for sure. The sense method is really fascinating; you could get some really precise analogue feedback (although they just digitise it with a comparator in this case); slow for a keyboard unless repeated for each row, but maybe an excellent fit for a touchscreen or similar?

chzel—do you mean duplicate the board and manufacture it as one board with OSHPark? They're actually not that keen on you trying to game them with tricks like that, they say one board per submission. The other trick is separating the boards, because they don't do V-scoring etc. And then I'd end up with six of the blasted things :lol: It's not a big deal; this other PCB manufacturer doesn't do too bad a job and I've been keen to try their white soldermask with black silkscreen anyway :)

User avatar
Muirium
µ

13 Sep 2014, 13:18

This is a great proof of concept for that little capsense custom switch thought experiment of mine. Knew it'd work no bother! I love a good linear just as much as I love a capsense clicky switch like beam spring and Model F. Something tells me we could make a dream with an inventive (non-mass production optimised) design. Next up, I'm going to want to see you make some sense pad PCBs as well as the controller!

Here's a daft idea that could be genius for all I know: reckon you could differentiate speed from these linear readings and auto CAPITALISE heavy keystrokes?

User avatar
chzel

13 Sep 2014, 14:19

xwhatsit wrote: chzel—do you mean duplicate the board and manufacture it as one board with OSHPark? They're actually not that keen on you trying to game them with tricks like that, they say one board per submission. The other trick is separating the boards, because they don't do V-scoring etc. And then I'd end up with six of the blasted things :lol: It's not a big deal; this other PCB manufacturer doesn't do too bad a job and I've been keen to try their white soldermask with black silkscreen anyway :)
That's exactly what I meant! I didn't know OSHPark's policy on this, but you can try SeeedStudio, I have used them before and they are nice quality and fair price.
They accept panelisation and multiple designs per board, but in its basic service don't do v-score. They do route external and internal shapes though!
Separation is a bit of a problem, but with enough clearance between boards even a dremel cut-off wheel works fine!
Unless you go with the premium!
http://www.seeedstudio.com/service/

xwhatsit

14 Sep 2014, 03:08

The fab I was planning on using for this is PCBWay. I've only used them once before, quite recently, for a reasonably large PCB (about 330x50mm); the price was insanely cheap, about a quarter to a third of what OSHPark would have cost, but then shipping on top. On my suggestion wcass used them for his XTant, and seems reasonably happy with the quality, and very happy with the price.

PCBWay is another Chinese fab with relatively low quality like Seeedstudio et al, but seems much better for larger sized boards as they don't enforce that silly 5x5, 10x10, 15x15cm order size stuff like those guys do (maybe their panelisation script is too simplistic to handle non-standardised board sizes?), where you often end up paying more than you need and end up with way too many boards. The larger sized stuff is almost as expensive as OSH Park sometimes. PCBWay's turnaround time is also pretty decent, at least from the one board I've ordered from them so far. You even get a nice step-by-step indication of what stage the board is at (drilling, plating, photo-masking, exposure, etching etc.). I'm still not 100% sure yet, as like I say I've only done the one design with them, but they look like a decent option for a lower quality but fast turnaround/very cheap alternative to OSH Park, for me at least.

For super fast turnaround but reasonably expensive boards I get them done locally, with PCB Zone. The quality is terrific but unfortunately usually end up about double the cost of OSHPark though. Great for commercial stuff though!
Last edited by xwhatsit on 14 Sep 2014, 03:26, edited 1 time in total.

quantalume

14 Sep 2014, 03:24

Have you ever tried PCBCART? They've been around for awhile, and their prices are pretty good for large boards. Never tried them myself, so I have no idea about the quality.

xwhatsit

14 Sep 2014, 03:30

No I haven't come across them before. So many fabs gearing up for prototype stuff these days! The other one I'm keen on trying is http://dirtypcbs.com , mostly because of the plain honesty and attitude :lol:

xwhatsit

28 Sep 2014, 07:48

Sorry for lack of updates; the PCB fab has been dragging their feet a bit (I had a pile of new shiny white solder-mask Model-F-USB and Beamspring-USB PCBs on the same order). However they were shipped on Friday. Normally stuff shipped from China takes an age, but they're using DHL so should get to me reasonably quickly, hopefully this week. Looking forward to putting the first controller together! When bringing up a new board there's always a bit of the nervousness of pulling your freshly-souped film out of the developing tank... is it going to be completely clear or black or are you going to have beatiful negs?

andrewjoy

28 Sep 2014, 12:00

White PCB! how did you know that's my favorite !

xwhatsit

03 Oct 2014, 12:58

Yay! Shiny white goodness arrived this afternoon!
IMG_1420.JPG
IMG_1420.JPG (263.74 KiB) Viewed 11108 times
Sadly I made a balls-up; hopefully my only mistake:
IMG_1422.JPG
IMG_1422.JPG (187.34 KiB) Viewed 11108 times
That shouldn't really be an issue; having 48 pins holding the thing on is more than solid enough.

I won't have a chance to put this together this weekend (almost had to fly overseas for work), but I'll be tackling it ASAP in order to put my mind at rest :)

xwhatsit

07 Oct 2014, 03:33

Manage to get onto this today (yesterday and the weekend were a write-off; there was a major substation fire which knocked electricity out to half of the city from Saturday to late last night—not my house, but my reflow oven is somewhere else :) ).

Good news, it works :D

Bad news is now I have to scratch my head and figure out what to map where—a bit of a headache!

The other two controllers for xavierblak will have to wait a few days while parts I ordered arrive. I didn't manage to time the arrival of these very well with the arrival of the PCBs, sorry (I also ran out of 2x3 right-angle header pins, so no expansion port on this first controller just yet). On the plus side xavierblak won't have to put up with horrible colour-clash green header pins. I think the white/black/silver colourscheme will look quite nice...
IMG_1426.JPG
IMG_1426.JPG (577.62 KiB) Viewed 11074 times
IMG_1429.JPG
IMG_1429.JPG (509.05 KiB) Viewed 11074 times
Oh this is my keyboard-feet solution:
IMG_1430.JPG
IMG_1430.JPG (336.53 KiB) Viewed 11074 times
A bit slidey but I ran out of more rubber feet. More of them arriving in a few days as well.

User avatar
Muirium
µ

07 Oct 2014, 03:46

A keyboard full of macros!

It reminds me of a (much nicer and vintage) Tipro with that great wall of keys. I wouldn't know what to put where exactly either.

andrewjoy

07 Oct 2014, 10:21

Thats a beast of a numberpad you have there, i would use the keys arround it for macros for math functions. also put one tab key there, i have that on my 122 you would not think how useful a tab key is on a number-pad, its only a shame i cannot split the enter key and the 0 on my 122 for even more number-pad goodness .

xwhatsit

10 Oct 2014, 00:27

So my cow-orker (who madly decided “this is the keyboard I'm going to use today”) took the thing and started mapping usable keys onto it, an exercise which has proved reasonably frustrating, mostly because of the lack of a spacebar.

However we got to wondering how many keys it had; not being very good at counting we came up with various answers until we finally settled on 129 keys.

129 keys?! My controller can only support a maximum of 128 (16 columns and 8 rows), and of course the keyboard itself can only support up to 128, as it has just that—16 columns and 8 rows. After mapping every key on the keyboard to something we discovered the unfortunate fact that the Tab key on the top-left of the keyboard and the Tab key on the numpad are in fact internally connected together on the keyboard itself, so are inextricably linked together as the same key.

This would be a problem on a smaller keyboard, but is probably not as much of a big deal on this behemoth, which has keys to spare. Still, somewhat unfortunate! Amkey must have designed their keyboard and then realised they had one key too many, so just found two similar keys and wired them together.

User avatar
Muirium
µ

10 Oct 2014, 02:08

Sometimes you've just got to cheat. I have a compact custom keyboard design that's limited to the pins on the little wireless controller I'm using, keeping me just below a 60%. Some symmetric mods must be tied to square that circle! Or whatever the Greeks were on about.

andrewjoy

10 Oct 2014, 10:50

Yeh you do have to cheap sometimes, at least they had the awesome vision to put a tab key on the numberpad i mean why does 0 numEnter and + have to be 2u keys you could have way more useful stuff ! Like tab or space or a () key or anything that's useful when doing number entry

i think ( when i get a controller hint hint :P) that i will do something like that for my beamspring the PF block will be the numbers and then the right hand block of keys will be math functions .

Post Reply

Return to “Workshop”