Designing a custom Topre board

attheicearcade

06 Oct 2015, 21:24

Edit: picture for thumbnail
Image

Original post:

Before I start this post, let me say I am not an electronics engineer. As such any information in this thread is potentially wrong. Also this is my first post here, sorry if I have missed something out.

Background

Since receiving a HHKB I have wanted to reverse engineer the matrix to make my own split hand Topre keyboard. With the help of Hasu's work I set about probing around my HHKB's PCB and particularly the function of the TP1684 chip.

TP1684
Image

Recently I have been able to breadboard a 2x2 matrix using test pad PCBs I had made using itead.cc. I have sensed key height successfully with rudimentary firmware running on a Teensy 3.1.

Breadboard setup
Image

This graph shows the ADC reading on each row over time (total time is probably 2 seconds, I can't remember).

Key depression: (blue and red are separate rows)
Image

There are some kinks still and it is prone to interference problems but it is a breadboard so this is to be expected. I am looking to implement an analog multiplexer like the HHKB since I have come across issues with offset of op amp output voltage. This could be calibrated out but since the original plan was to use several op amps it is much simpler to multiplex and just use one.

Keys will be able to be read at the same rate that the HHKB's keys are (3.6 kHz). For the HHKB this gives 60 Hz per key. The limitation for my circuit is really the RC decay time which can be tweaked to get desired performance. It is a trade off between measurement accuracy and speed.

Method

Matrix diagram
Image

Simulation results
Image

Each key on a Topre keyboard is essentially a variable capacitor. Capacitance can vary from basically 0 to around 6 pF (estimated). The keys are set up in a matrix with one side connected to a row and the other connected to a column. Initially the entire matrix sits at ground (this is not how the HHKB does it, the matrix is pulled up to 5V). We drive the columns individually to 3.3V and then watch the voltage of the row to look for capacitive coupling. It takes the form of an exponential decay voltage which can then be read through a buffer or amp.
The decay time of the row is primarily controlled by the resistor and capacitor linking it to ground. The capacitor serves to reduce the effect of pressing another key on the row at the same time as the one being sensed - without it, there is a large voltage drop which could cause missed key presses (see the small difference between row1 and row2 in the simulation). The resistor pulls the row to ground, and the combination of the two provides an RC time constant T = RC which limits the speed we can drive the columns because we need to wait 5T to ensure the row has reset.

Future work

I am currently waiting for the analog multiplexers to arrive and will update the thread with my findings. The firmware will eventually be open source, along with the Topre PCB pad design for people to use. For now I am working out issues and fine tuning.

I have an ultimate goal of making a split hand sculpted (Maltron like but adjustable) Topre keyboard with harvested Novatouch switches. This is difficult and may result in a cop out (such as making an ergodox style board).
I have done some work on designing a case capable of that but am yet to physically produce a prototype since it depends on the electrical design. Quotes from local workshops seem reasonable for the bent steel components.

Image

It is just a bunch of laser cut bent stainless steel with an aluminium base. I have designed the base to be simple enough to mill in one operation to cut costs. The difficulty with this design is that you can't have a PCB for a reasonable price. The switches would have individual PCBs similar to the test pads I created, with wires connecting them - a problem being that the wires would likely need to be coaxial. Of course a similar design would be easy with Cherry MX switches instead. That may be an option if I fail.
(This is an old render now but it gets the idea across. If there is interest I will update the thread with more. For now, the focus is on the electronics.)

If you have any interest, questions or suggestions please post them. Thanks for reading.
Last edited by attheicearcade on 20 Aug 2016, 14:37, edited 2 times in total.

User avatar
Muirium
µ

06 Oct 2015, 22:46

My eyebrows are raised, my hands are tented into a pyramid, and I'm muttering something over and over, under my breath.

Intriguing…

Keep us updated!!

User avatar
scottc

06 Oct 2015, 22:53

Fantastic work. I'm very excited for what might come next.

User avatar
002
Topre Enthusiast

06 Oct 2015, 22:59

Very cool :)
I'll be subscribing to this thread. Good luck!

joey

06 Oct 2015, 23:17

This is awesome, can't wait to see progress.

What are the chips on the breadboard?

User avatar
hasu

07 Oct 2015, 03:28

Great write up!
The simulated graph is interesting and useful to understand how it works. I have to learn about sim really :D
From the graph it seems to me that you can use comparators instead of ADC, right? And, is there something like documents or acticles you refered to when you was working on capacitive sensing? If any I'd like to read them and learn your method.


Incidentally I was also wokring on Topre capsense recently for one month or two. I can scan Realforce 16x8 matrix with Teensy++ and it works as a keyboard now. I use Atmel QMatrix as capacitive sensing mehtond, it is well documented in Atmel site and some patents. My plan is 60% Realforce.
https://github.com/tmk/capsense_qmatrix
http://imgur.com/a/f5ehq

User avatar
ramnes
ПБТ НАВСЕГДА

07 Oct 2015, 11:30

I had a similar idea some days ago, very glad to see this happening.

And you even successfully unlurked hasu. Good job!

User avatar
Hypersphere

07 Oct 2015, 15:13

Fascinating.

attheicearcade

07 Oct 2015, 15:23

Thanks for the support guys :)
joey wrote: What are the chips on the breadboard?
MCP603 op amps. I meant to get the 602 dual op amp but ordered the wrong ones.
hasu wrote: From the graph it seems to me that you can use comparators instead of ADC, right?
Yes I think there would be no issue using a comparator, since I suppose a differential op amp with full saturation is basically the same thing. Here I only use the amp to bring the peak up to around 3V for the ADC using a 3.3V internal reference voltage (actually the graph above shows it to be less than that). It also removes any negative bias which could potentially damage the teensy (although this level is probably not a problem) and provides an impedance buffer since the teensy's ADC is capable of reading impedances less than 10k ohm (the row is ~100k ohm). I think an advantage of doing it this way is that the hysteresis can be easily modified in software, presumably you need to change the comparator conditions?
hasu wrote: And, is there something like documents or acticles you refered to when you was working on capacitive sensing? If any I'd like to read them and learn your method.
The method is rudimentary in comparison to yours. It is just using some properties of RC circuits. The selected column is set high and each key on the column provides some coupling to each row. The input voltage (3.3V here) is divided among the available capacitors on each row according to the capacitance of each according to the following (empirical) equation

Code: Select all

Peak output voltage = Input voltage * (Capacitance of key we are sensing / Total row capacitance)
For example, row1 in the simulation has one key pressed so the peak output voltage is

Code: Select all

3.3V * (6 pF / (220 pF + 6 pF)) = 0.88V
In row2 we have two keys pressed,

Code: Select all

3.3V * (6 pF / (220 pF + 6 pF + 6 pF)) = 0.85V
In row3 we have one key half pressed,

Code: Select all

3.3V * (3 pF / (220 pF + 3 pF)) = 0.44V
It is more clear to see the need for the big row capacitor here. Of course the larger the capacitor the less interference there is from other keys, but the voltage will also drop accordingly. I think I could put a larger capacitor in there but it is a trade off against noise difficulties.

This signal then gets amplified and read directly on the ADC soon after the column was set high. Note that of course, "soon" must be exactly the same each time, but whether it is immediate or 8 us after doesn't matter except for the voltage drop.
hasu wrote: Incidentally I was also wokring on Topre capsense recently for one month or two. I can scan Realforce 16x8 matrix with Teensy++ and it works as a keyboard now. I use Atmel QMatrix as capacitive sensing mehtond, it is well documented in Atmel site and some patents. My plan is 60% Realforce.
https://github.com/tmk/capsense_qmatrix
http://imgur.com/a/f5ehq
This is an interesting project, and also much more realistic than mine! I will have to take a look through your firmware. At a glance of the QMatrix method, it seems you are "pumping" the measurement cap? Have you noticed improvements over a more simple method like the one I am using? The oscilloscope pictures seem to have quite a high level of noise, how do you escape this for preventing repeat presses when the switch is pressed in the centre of your hysteresis band? I know that if a signal becomes noisy and you are reading at a few kHz you get as many keypress signals, which is critical to be avoided (I had a problem when testing the HHKB where it was sending events for every key at 60 Hz, interesting things happen).

User avatar
Muirium
µ

07 Oct 2015, 15:57

I like reading this much detail. Of course, what you've got me thinking about is power saving… to make a Bluetooth Topre keyboard!

The best thing about making your own controller is you can optimise its activity. Something like a series of "sleep modes" each with more aggressively reduced polling rates, which the controller progresses through automatically whenever there are zero keys pressed.

Not so interesting for USB, I know, but wireless is where it's at!

attheicearcade

07 Oct 2015, 21:53

Muirium wrote: I like reading this much detail. Of course, what you've got me thinking about is power saving… to make a Bluetooth Topre keyboard!

The best thing about making your own controller is you can optimise its activity. Something like a series of "sleep modes" each with more aggressively reduced polling rates, which the controller progresses through automatically whenever there are zero keys pressed.

Not so interesting for USB, I know, but wireless is where it's at!
Yes a more fine control of power usage is possible. It is not my focus yet, but there is definitely potential.

Update

Today the CD74HC4051 multiplexers arrived. I have updated the breadboard and code and am achieving much cleaner readings on a test capacitor. Still have to do temperature analysis and long term stability study, it looks like there might be some drift.

Breadboard
Image

Reading 6pF capacitor on each point of the matrix (4 sets of results)
Image

I have had some trouble with the op amps I was using (MCP603) - they have a much slower slew rate than the spec sheet. For now I can work around this by waiting for 10 us after setting the column and before reading. I would like a faster amp though, may go with OPA350PA.

terrycherry

08 Oct 2015, 13:53

If you like to make that keyboardImage, I advice you should try this keyboard which you can handle like this height...
IMG_4889.jpg
IMG_4889.jpg (334.92 KiB) Viewed 73473 times

User avatar
Muirium
µ

08 Oct 2015, 14:17

Ergonomics isn't really just about tall keyboards. The curves are what matter. Vintage boards are far from ergonomic!

User avatar
vvp

08 Oct 2015, 20:58

Muirium wrote: Ergonomics isn't really just about tall keyboards. The curves are what matter.
+1
attheicearcade's proposal is nice. Although the curve of one column is fixed, the column stagger and height are changeable. That should get one far enough. The only thing I would change is the way it is mounted. I would modify it so that there is access to the bottom of the key-well for easier wiring and repair/troubleshooting.

User avatar
hasu

09 Oct 2015, 07:03

Thanks for the detailed explanation.
I think I can understand it now, to some extent :D Interesting method.
attheicearcade wrote: This is an interesting project, and also much more realistic than mine! I will have to take a look through your firmware. At a glance of the QMatrix method, it seems you are "pumping" the measurement cap? Have you noticed improvements over a more simple method like the one I am using? The oscilloscope pictures seem to have quite a high level of noise, how do you escape this for preventing repeat presses when the switch is pressed in the centre of your hysteresis band? I know that if a signal becomes noisy and you are reading at a few kHz you get as many keypress signals, which is critical to be avoided (I had a problem when testing the HHKB where it was sending events for every key at 60 Hz, interesting things happen).
Right, QMatrix integrates potential of switch capacitance into sample capacitor with "pumping" into the cap using pulses(normallly 16-64 cycles at 100k-250kHz). This pumping process takes time but it can reduce influence of noise, according to Atmel's doc. And it measures discharge time of the sample capacitor to know state of the switch in the end. I don't know how much advantage QMatrix has against other capsense methods, this is actually my first try on capsense things.

I uses Reaforce PCB in reverse way in terms of drive and sense lines. The PCB is originally designed with 16 sense lines(column) and 8 driver lines(row) but my controller drives "sense" lines and senses from "drive" lines due to limitation of Analog Input pins of Teensy++. I think this causes the much high noise in my oscillo pics. QMatrix has no problem and is stable enough with those noises, though. QMatrix method is not fast actually, both pulsing(pumping) and measure discharge time are slow compare to other capsense mothods. My implementatins takes around 12ms to scan Realforce 16x8 matrix, it is a bit faster than Topre.


looking forward seeing progress of your project, keep us updated!

attheicearcade

24 Nov 2015, 21:46

Thanks hasu, that helps my understanding. Very different method to what I have gone with, probably much more stable.

Back to the prototyping, I had some temperature tests just using a hairdryer to adjust the temperatures while watching the measured capacitance on a test cap. Results didn't move too much considering the large temperature change, I have lost the data I took though.

I had one column manufactured for the keyboard. There have been some issues with the piece slipping in the press because of the small size. Overall it has turned out quite well, of course expensive because it was a one off. I have ordered some more PCBs for fitting to it, they should be arriving shortly. Here is the column with some Novatouch housings inserted:

Image

Image

The holes still need tapping (M2). The bolts will go through the PCB, round the convenient bolt clearance cutouts in the housings and into the switch plate. Will update after PCBs arrive.

User avatar
hasu

27 Nov 2015, 05:43

Looks nice and firm.
How thick your plate and do you think switch housings can clip on that thickness? It looks a lot thicker than Realforce stock one (which is 1.0mm, I think).

attheicearcade

27 Nov 2015, 22:18

This is 1.5 mm. It is slightly too thick for the plastic clips, but I wasn't too worried since the bolts will hold the housings in. However I have come across an issue: the 0.5 mm removes all of the clearance from the bottom of the keycaps at the bottom of the actuation. Hence the plastic can hit the metal making an offensive noise. My next set will be in 1 mm thickness, I suspect they will be stiff enough.

Also the PCBs arrived:
Image

Plan is to use mini coaxial cables between rows and columns if bare wires give too much interference (I suspect they will)

User avatar
hbar

08 Dec 2015, 13:22

First off, congratulations, this looks amazing.

My performance on DT is quite disappointing these days for reasons outside my control, but in fact I've been planning my own custom Topre board for a few months now, even have some test electronics soldered, but haven't been able to test it yet. I'll post some details in a new thread once I'm ready for it.

One thing though: it appears that your way of sensing the key presses differs from what the real Topre electronics does, it's more like xwhatsit's method, which I believe is unsuitable for Topre. Are you aware of xwhatsit's work?

In any case, the curved stainless keyboard is amazing, it really looks like something made for a war journalist :).

How (with what software) did you design your PCB? I've looked at all programs I can reasonably access and haven't been able to build those two electrodes properly (and the cutout in the ground plane on the other side, not present in your design) using any of them.

Just a quick hint: I suspect that bare wires will in fact be better (and much less work) than coaxial cables for your matrix.

ħ

User avatar
hbar

08 Dec 2015, 13:49

OK, just for reference, I started my thread here: http://deskthority.net/workshop-f7/hbar ... 12288.html.

attheicearcade

09 Dec 2015, 16:15

Thanks, what makes you think that it is unsuitable for topre? I know that it is not as robust as topres method but I can't quite figure out what topres method actually is. I designed the keyboard to have a replaceable controller for this reason. I will keep an eye on your thread, it is exciting times for custom topre with a few projects on the go now. From what I have seen xwhatsit has experience in the capsense area but I have no idea about how his controllers work.

I used the free version of eagle to design those pads, I can provide the files if it will help you out.

User avatar
hbar

09 Dec 2015, 16:39

IMHO, the main problem with your design as well as xwhatsit's is the fact that there is variable voltage on the row lines, which causes interference between the keys. It's all well as long as only one key is pressed and the circuit is well-calibrated, but as soon as you press multiple keys, the actuation point for the keys starts shifting.

This isn't a problem for buckling-spring (as testified by the success of xwhatsit's hardware in that area) because the actuation point is already mechanically defined so the electronic threshold on the capacitance is mostly irrelevant, and the worst case would be a keyboard that's not quite NKRO even though it should be. For Topre, however, the actuation point is defined by the capacitance threshold, and a shift of that just because other keys are pressed would be undesirable.

I'm also puzzled about Topre's electronics, mainly because they use an electronically-controlled resistor as well as an analogue switch, both of which I think are unnecessary (provided my electronics simulations are correct, hardware tests will have to show that), but they certainly use pure current sensing on the row lines. The fact that there is no measureable voltage on the row lines on a real Topre board means that they must use some sort of transimpedance amplifier on each row. (That's what I'm also considering, but with a twist.)

I guess that Topre has the columns "active-low" for two reasons, one being that only this way they can get a positive pulse out of the transimpedance amplifier, the other is purely the practical issue of CMOS outputs usually having higher current capability and slew rate when driving logic L (sink) than logic H (source).

ħ

attheicearcade

09 Dec 2015, 17:37

Yes, I am aware of this issue. This is why there is a large (comparatively) cap on each row, minimising the shift. The shift is made low enough to be negligible when the key matrix is small enough such as in my designs.

The real Topre matrix is similar to mine but they run the columns at active low with rows pulled up like you said. Key presses can be seen on an oscilloscope on the row lines, the RC decay time points to there being extra resistance on the row like my design. I am not sure how they actually detect the press though. TP1684 remains a mystery to me.
I know the electronically controlled resistor controls activation height, so must be in some sort of comparator setup. What is the analog switch you mention?

I look forward to seeing your results and simulations!

attheicearcade

09 Dec 2015, 17:47

By the way: if you would like any of the test pads I show in one of the first pictures I have loads of them. Ordered 10 and received about 50. Will send you them for the cost of shipping if you have a use for them :)

attheicearcade

14 Dec 2015, 17:38

Update: built column

I have tapped the holes to M2, cutup some rubber domes and sourced M2x8mm pan head bolts. Assembled a single column:

Image

Image

Image

My fears about the caps hitting the housing with 1.5 mm plate have been extinguished, thanks to the rubber dome cushioning:

Image

Also here you can more clearly see the M2 bolts running from the PCB to the plate, the bolts tighten to become flush with the top of the plate as designed. I don't think I will slim down the plate thickness in future since there appears to be no need.

What I am unsure about is the close proximity of the keys. They are significantly closer together than on a standard non-curved keyboard. I don't know if they are too close. Ideally I would like to match the curve on Kinesis / Maltron boards, does anyone know the spacing at the tops of the keycaps? I had designed ~19 mm between centres but made a mistake with the keycap height (this is actually visible in the early render).

Future work

I would like to test the single column as a mini keyboard. Will be working on soldering the bits together and hopefully my next post will be some test results.

User avatar
hbar

15 Dec 2015, 13:22

Gosh, that looks good. BTW, have you considered DSA profile keycaps? They might be really nice on a curved board.

In any case, I haven't made too much progress yet, but I think I've narrowed it down to the haphazard connection between the capactive pads and the electronics, the amplifies itself appears to be OK. Will post results once I have some.

If I ever need those pads, I'll let you know, thanks for the offer.

User avatar
vvp

16 Dec 2015, 12:10

attheicearcade wrote: What I am unsure about is the close proximity of the keys. They are significantly closer together than on a standard non-curved keyboard. I don't know if they are too close. Ideally I would like to match the curve on Kinesis / Maltron boards, does anyone know the spacing at the tops of the keycaps? I had designed ~19 mm between centres but made a mistake with the keycap height (this is actually visible in the early render).
It is about 17.5 mm on Kinesis. My Katy keyboard has it about the same.
The distance is not the same for each pair but this seems to be the average.
I would not bother with it if you can fit common keycaps there (Oem DCS, SP DCS, SP DSA).

Binge

01 Feb 2016, 04:27

I joined DT just to say I support this project and I am looking forward to hacking my own with a little guidance. Let me know if you need any help :)

harlw

17 Mar 2016, 17:38

wow, wow, wow. Great work. Keep it up please!

pont0s

02 Jun 2016, 04:26

@attheicearcade are you still working on this project? If not, would you be willing to share the files? I love the design of the case.

Post Reply

Return to “Workshop”