CommonSense: matrix LCR meter with a HID interface

HuBandiT

07 Jul 2016, 22:41

DMA wrote:
HuBandiT wrote:
Reverse your scanning direction - does the issue flip sides too?
Huh?
If I understand you correctly, when strobing columns crosstalk only significant between rows(on 122-key) 0-1, 2-3, 4-5, 6-7. Similar both ways.
Yes, thank you for checking; wanted to make sure you are not banging your head against the HW due to a potential SW bug.

User avatar
DMA

08 Jul 2016, 08:14

Because you're tired soldering and you was The Networking Guy.
568-1.jpg
568-1.jpg (110.05 KiB) Viewed 6673 times
Oh wait, I need that for two keyboards!
Spoiler:
568-reg.jpg
568-reg.jpg (121.8 KiB) Viewed 6673 times

User avatar
lot_lizard

08 Jul 2016, 14:07

Haha... That might be the picture of the year. Too funny. Clever though... Why not

User avatar
DMA

08 Jul 2016, 16:31

lot_lizard wrote: Haha... That might be the picture of the year. Too funny. Clever though... Why not
It's called "568th of March" in my instagram :)

but yeah, all those experiments with "let's try drive those instead of those" led me to a modular solution. That and lots of stuff laying around from the previous office move.

Vizir

19 Jul 2016, 03:46

tagging! very interesting!

__red__

19 Jul 2016, 12:42

workshop-f7/alternate-ways-of-sensing-t ... 12533.html

My scope pictures.

I used the exact same board too... when the dev board is cheaper than the IC then the dev-board becomes your pcb ;-)

You are miles ahead of where I got - keep on keeping on!

User avatar
DMA

19 Jul 2016, 17:01

__red__ wrote: workshop-f7/alternate-ways-of-sensing-t ... 12533.html

My scope pictures.

I used the exact same board too... when the dev board is cheaper than the IC then the dev-board becomes your pcb ;-)

You are miles ahead of where I got - keep on keeping on!
I actually stopped right there at the last post with picture.
Looks like it's a dead end.
TIAs seem to be a better answer.
I remember that if you don't cut the trace to that square aluminum chip, there's essentially no signal at the trace. So their original amplifier/comparator has a pretty low input resistance.

That probably helps with the ? key being overshadowed with right shift.

I'm thinking about it on and off - looks like I'll need to compensate for hardware deficiencies with software deficiences - thtat is "scan very fast, determine max. change in the matrix and assume that it's that key was pressed".

Because it would be harder to do with TIAs on standard software components (I've tried to recreate scanning ADC from more basic components and failed already).

User avatar
DMA

05 Nov 2016, 00:17

I'm typing this post on an F122 still attached to the scope, using a working version of the controller.
It has no foam, shoddy ground and a pretty long tail of wires made from cat5e twisted pair.
On the scope you can see signal levels going up and down depending on how hard you press the button - because barrels are literally floating, hanging from the keycaps which are propped up by the spring.

So far it works and even quite stable, cranking about 2500 matrix scans per second.
Every click is exactly one character appearing on the screen.

Layout is a bitch though. lot_lizard, where are you with your miracle steel plates?

Controller is tmk-based now but I can actually make it xwhatsit-interface-compatible for giggles. I like the fact that you can edit layout on the fly.

Here's some related p0rn:
cs-sensor.png
cs-sensor.png (61.89 KiB) Viewed 6496 times

User avatar
Ratfink

05 Nov 2016, 00:31

Great to hear news on this project! I'm impressed to hear that it's working so reliably even in such unfavorable circumstances. Keep up the good work.

Also, beam spring controller when? 8-)

User avatar
DMA

05 Nov 2016, 03:50

Ratfink wrote: Also, beam spring controller when? 8-)
Should be a trivial change - but I don't have any beamsprings around and probably won't ever - so can't test that hypothesis.
Is there any real need in that though?

User avatar
Techno Trousers
100,000,000 actuations

05 Nov 2016, 04:44

DMA wrote: Layout is a bitch though. lot_lizard, where are you with your miracle steel plates?
lot_lizard is on the verge of starting up his round 1 group buy. But if you can make this is
In the same split, "no solder" plug-in form factor as the revised xwhatsit for that project, I'd definitely be interested in trying it out once I get my MFs.

User avatar
Ratfink

05 Nov 2016, 14:47

DMA wrote:
Ratfink wrote: Also, beam spring controller when? 8-)
Should be a trivial change - but I don't have any beamsprings around and probably won't ever - so can't test that hypothesis.
Is there any real need in that though?
Every month or so I have to open my Displaywriter and re-seat the Xwhatsit controller because one of the rows is reading a wildly different capacitance from the others for some reason. If this controller is as forgiving as it sounds like, it might not even sneeze when that happens. Simply put, I'm very interested in trying it, although I can't say whether or not there's a general need.

User avatar
DMA

05 Nov 2016, 20:04

Ratfink just solder it to the board. Will solve the problem for good.

But the controller that wouldn't even sneeze when that happens exists for two years already. It's called DPH controller.
https://github.com/kiibohd/controller/b ... can_loop.c

So, while it was interesting to tinker with all those things - it was useless, everything was built and even tested already.

User avatar
wcass

05 Nov 2016, 20:06

If you want to make a direct replacement for the MF ... the controller is laid out like this:
Controller.jpg
Controller.jpg (117.84 KiB) Viewed 6455 times
It uses a 19 pin and an 11 pin right-angle Triomate FFC connectors as PCB edge connectors so that the controller sits underneath the back plate. Four wires lead off to pick-your-type USB connector placed elsewhere. The top of the matrix PCB will look like this:
controller connector.jpg
controller connector.jpg (37.91 KiB) Viewed 6455 times

User avatar
DMA

07 Nov 2016, 07:16

wcass wrote: If you want to make a direct replacement for the MF ... the controller is laid out like this:
Controller.jpg
It uses a 19 pin and an 11 pin right-angle Triomate FFC connectors as PCB edge connectors so that the controller sits underneath the back plate.
I have no intention making hardware. Teensy (or any other MCU with ADC) would work just fine. Hell, even arduino probably will. So no point. Lower parts count (like 4 resistors and 4 caps IIRC) won't offset the chip price and sourcing hassles, and special compiler toolchain needs practically make this project dead from the start.

As for the nano-xwhatsit you're making - wouldn't using those connectors lead to problem Ratfink experiences once a month? Good old tin will take out huge amount of variability from the connection - and variability is one thing xwhatsit's sensing schematics doesn't tolerate well (though it can be improved on a per-column level using only firmware changes - this will save ratfink from monthly keyboard assembly-disassembly drill).

User avatar
tentator

13 Nov 2016, 22:39

I'm not sure I understood DMA: are you saying the project is over, there's no better (more reliable and faster) way to do capsensing than with a xwhatsit? Also not sure what you mean when you say it could be done with just a teensy? I mean it would be my secret dream if I could just hook up a teensy with tmk and control a model f and just some couple of resistors and caps.. just sayin'..

tent

User avatar
DMA

14 Nov 2016, 02:33

tent I meant that any MCU with ADC can be made into capsense controller with almost no external parts. So no point in continuing on a hardware which no one except me is willing to use around these parts.

I actually wanted to buy a cheap*, less-esoteric ARM-based MCU with decent** toolchain support to verify this assumption.
*) Teensy is expensive, think about those $5 STM32 boards.
**) so that you don't have to be tied to Windows as your dev environment (because PSoC Creator cannot into mac or linux because dotnet)

What I found after glancing teh Internets is that this requires _thinking_. And I hate doing that, so.. I'd rather let someone else do it :)
I have a working controller for myself, after all.
And for anyone else who can solder and compile, for that matter. It costs $10 and can be assembled in 1 evening (mostly waiting for 600M of PSoC creator to download).
But I have no keyboard to put it into - because turns out I'm allergic to layouts that don't have Esc key or inverse-T arrows on them.
This kind of destroys any motivation to continue at this point. I made it, it works, yay, can't do anything practical with it, period.

And since group buy for the BS keyboard which will have decent layout will only close in a month and then it will take some time to actually produce them and ship.. that motivation is not likely to reappear soon.

Things that require thinking would be:
* need for external resistors on drive lines for impedance matching (means need for PCB!) - because both STM32 and Kinetis don't support pullup _and_ pulldown mode on the same pin.
* figuring out how to discharge ADC sampling capacitor between readings - my current implementation relies on runtime pin drive mode change, not sure it will work there. Looks like [NXP AN4590] Kinetis can do that stuff w/o too much handholding by grounding an analog input and strategically using ADC mux though.
* definitely something else - there's always something else.

Teensy 3.1, being kinetis-based, actually looks capable enough.
Firmware-wise.. tmk requires you to have _all_ your settings baked into firmware, while with xwhatsit you have a good chunk of configuration settings exposed to PC companion software.
And capacitive sensing will require calibration data - which will, most probably, drift over time. Reflashing every time you need to recalibrate the matrix will make your world full of pain.

User avatar
tentator

14 Nov 2016, 08:10

Well then my suggestion for a cheap teensy compatible would be the pro micro that you can get for something like 1.23dollars each (shipped!) Not sure how many i/o would you need? Anyway they should be supporting pull ups/downs. And compared to stm32 you can get tmk compiled on them right away. Tmk to me as of today seems the most advanced firmware available supporting many things including tap keys etc and there are also web based layout editors. Anyway if you want I can support you in coding and testing around since I'm also planning to go the Model MF way and will get even sooner a FEXT to play with that I want to squeeze into my unicomp and plentiful pro micro on which soldering some matched resistor wouldn't be an issue at all. You have an f122 right?

Let me know.

Tent

User avatar
DMA

14 Nov 2016, 15:31

atmega32u4 won't cut it.
Teensy 3.1 is a different beast.

But no, simultaneous pullup and pulldown modes are not supported on any of them - though adding 8 resistors doesn't seem to be a huge problem.

I do have an F122 and XT.

As for "web-based layout editors" - well, they still require you to reflash after you edit :)

Update: connected the XT - works on the same set of thresholds.

User avatar
tentator

14 Nov 2016, 17:33

Why would a normal teensy/atm32u4 cut it? Isn't xwhatsit also using that one? The teensy 3.1 has just more MIPS or something else?
And I agree adding the resistors should not be a problem but how many i/o ? You bring this thing about resistors because The target would be to not really need a specific pcb designed but reuse something as is correct?
I suppose also that the xwhatsit will need to reflash after any layout change or so right?

User avatar
DMA

14 Nov 2016, 17:44

xwhatsit is using external comparators. This thing uses integrated ADC, so there's no external hardware. (In fact, out of curiosity I counted the BoM yesterday - it's the chip, 3 resistors, 1 10uF, 10 1uF and 4 0.1uF capacitors. If external reset pin is needed (can't see why) - that's +1 resistor and 1 0.1uF.)
ADC needs to be a good one - 2Msps gives about 4k matrix scans per second, so it's not desirable to go below 500ksps
atm32u4 ADC can only provide 15ksps. So, about 30 scans per second optimistically. Which is a bit low, you'll strat to haev mxide keyperses.

xwhatsit has configuration software which seem to allow realtime editing of layout. At least the communication protocols has capabilities for that - never owned one, so can't even start the utility.

User avatar
tentator

14 Nov 2016, 18:00

Ok I see.. so it appears I should rather hope for a successful port of tmk on xwhatsit then!? Or Just Be Happy With It Of Course ;)

User avatar
DMA

14 Nov 2016, 18:55

That last one is the best way, I found over the years.

User avatar
DMA

14 Dec 2016, 01:21

OK. I've managed to get a SEMI-working version on teensy 3.2.
Here it is. It's grafted on kiibohd, because kiibohd is so much conductive to debug (thanks HaaTa, the console is just plain astonishing).
SEMI - because finding enough ADC pins on Teensy (or K20 in general) is a _very_ frustrating experience.
Expecially if you don't want to fuck with MUXSEL, which will require you to write 2 registers on a channel switch - ADCxCFG2 and ADCxSC1 - which are not even nearly contiguous, so 2 sequencer arrays per ADC, no DMA transfers etc.

Also the documentation is abysmal - syntax errors in code examples, c'mon NXP (well, most likely Freescale, but still), WTF?

Some pictures (not a single picture there, just text dumps):
Spoiler:
Initial state: (ADC0 on the left, ADC1 on the right, half of the columns is "VREFL" to discharge ADC's sampling capacitor and should (but not always does!) read zero. But look at the 3rd column from the right! Oops.

Code: Select all

0 267 1 219 1 252 1 234 1 248 1 197 1 125 1 93 | 0  1 216 1 203 1 128 1 143 1 136 1 108 96 96 1
1 162 1 183 1 222 1 208 1 253 1 177 1 134 1 96 | 95 1 240 1 213 1 124 1 145 1 134 1 117 91 91 1
1 189 1 191 1 249 1 233 1 244 1 193 1 129 1 98 | 93 1 241 1 204 1 127 1 147 1 136 1 113 93 93 1
1 169 1 172 1 221 1 215 1 257 1 185 1 128 1 97 | 95 1 225 1 206 1 123 1 147 1 134 1 113 92 92 1
1 186 1 178 1 222 1 214 1 250 1 194 1 126 1 98 | 95 1 228 1 184 1 123 1 146 1 135 1 113 93 93 1
1 175 1 178 1 233 1 220 1 243 1 169 1 128 1 95 | 87 1 234 1 200 1 130 1 145 1 133 1 113 93 93 1
1 169 1 172 1 215 1 205 1 252 1 174 1 129 1 99 | 97 1 230 1 201 1 127 1 146 1 135 1 114 93 93 1
1 169 1 183 1 210 1 213 1 259 1 243 1 128 1 95 | 93 1 235 1 175 1 125 1 145 1 134 1 112 92 92 1
---From here, all dumps are "diff to previous state"---

It kind of stable - but not quite. Find the Waldo!

Code: Select all

0 15 0  0 0  3 0  2 0  -4 0 -7 1  3 0  0 |  1 0  3 0  2 0 -4 0  0 0 -2 0  0  1  1 0
0 18 0  2 0  5 0  9 0 281 0  8 0  1 0 -3 | -4 0  4 0 -7 0 -6 0  4 0  0 0  1 -2 -2 0
0 15 0 -3 0 -2 0  3 0 -14 0  2 0  0 0 -7 |  2 0  2 0  2 0 -3 0  3 0  2 0  0 -1 -1 0
0 -6 0 -1 0  3 0  3 0  -6 0 11 0  2 0  0 |  4 0  1 0 16 0  5 0  2 0  0 0  0  2  2 0
0 -5 0  2 0  0 0  0 0  -2 0 -1 0 -4 0 -1 | -3 0 -1 0 -3 0 -3 0 -3 0  1 0  1  1  1 0
0 -5 0 -1 0 -1 0 -1 0 -18 0  2 0  3 0  3 |  2 0 -1 0  8 0 -5 0  0 0  2 0 -2 -5 -5 0
0 -5 0  3 0  1 0  2 0  -2 0  3 0  0 0  3 |  0 0 -2 0  4 0 -2 0  0 0  0 0  0  1  1 0
0 -6 1  0 0  1 0  7 0   3 0  6 0  3 0  0 | -2 0  3 0  2 0 -1 0 -5 0 -1 0  0  1  1 -1

Code: Select all

0 16 0  1 0  6 0  8 0   16 0   8 0 4 0  1 | -4  0  0 0  6 0 -1 0 -1  0  0 0  4  0  0 0
0 11 0 -6 0 -3 0 -3 0 -276 0 -12 0 4 0  1 | -3  0 -7 0  3 0  3 0  3  0 -1 0  1 -2 -2 0
0 25 0  4 0  5 0  4 0   18 0   3 0 2 0 -1 | -6  0  6 0 -1 0  0 0  2  0  1 0  1  0  0 0
0 20 0  1 0  4 0 -7 0    8 0   2 0 1 0  2 | -2 -2  2 0 -3 0  7 0  7 -1 -2 0  2 -5 -5 0
0 21 0  1 0 -2 0  6 0   12 0  -4 0 3 0  0 | -2  0  2 0  0 0 -1 0  7  0  1 0  2 -5 -5 0
0 20 0  0 0  1 0  5 0   12 0  13 0 5 0  3 |  1  0  4 0 13 0 -7 0 -4  0 -3 0  1 -2 -2 0
0 20 0  7 0  5 0  2 0   13 0   6 0 0 0  0 | -3  0  0 0 11 0  1 0 -2  0 -1 0  2 -6 -6 0
0 24 0 -2 0 -4 0 -5 0    9 0  12 0 2 0 -1 |  1  0  3 0 -3 0 -6 0  3  0 -3 0 -3 -1 -1 0
Several keys pressed in different rows (near \ and shift, 1 row between):
Press

Code: Select all

0  7 0   0 0 -2  0 -2 0 -14 0 -18 0 -10 0 -3 |  0 0  -9 0 -18  0  -5 0  3 0 -2 0 -2 -3 -3 0
0 10 0   3 0  5 -2  3 0 -22 0 -19 0 -11 0 -5 |  0 0  -7 0  -9 -1  -1 0 -1 0 -2 0  0  1  1 0
0 14 0 -10 0 -4  0 -5 0 -18 0 -18 0  -8 0 -4 |  0 0 -10 0  -5  0  -4 0  0 0 -4 0  2  0  0 0
0 17 0   8 0  5  0 -3 0  -3 0 228 0  -9 0 -4 |  0 0  -4 0  -7  0  -8 0 -3 0 -2 0  0 -4 -4 0
0 16 0   4 0  8  0  8 0 258 1 -10 0  -9 0 -3 | -3 0   3 0  -5  0 -12 0  5 0  0 0 -1 -2 -2 0
0 10 0  -5 0 -6  0 -6 0 -35 0 -11 0 -11 0 -3 | -4 0  -9 0  -2  0   0 0  2 0 -3 0  1 -4 -4 0
0 11 0  -1 0 -5  0 -1 0 253 0  -1 0  -9 0 -2 | -2 0   3 0 -16  0   2 1  5 0  0 0  1 -1 -1 0
0 13 0  -1 0 -2  0  0 0 -31 0 -23 0  -5 0 -2 | -2 0  -5 0  -9  0 -15 0  0 0 -2 0  1  0  0 0
Depress

Code: Select all

0   8 0  -3 0  4 0  6 0   14 0    8 0 11 0  1 |  2 0  1 0  -7  0 -3 0  4 0  0 0  2 -2 -2 0
0  -7 0   1 0  6 0  3 0   18 0   10 0 10 0  3 | -5 0  4 0   4  0 -4 0 -3 0 -1 0  0 -1 -1 0
0  -9 0  -3 0  2 0 -4 0   11 0   -5 0  9 0  1 | -2 0  1 0   2  0  2 0  2 0  1 0  2  1  1 0
0 -11 0  -4 0 -7 0  4 0  -15 0 -253 0 10 0  3 |  0 0  1 0   0  0  6 0  0 0  1 0  0  2  2 0
0 -10 0 -17 0 -8 0 -8 0 -264 0   -5 0  6 0 -3 |  3 0  0 0  -3  0 -1 0  2 0  3 0  1  3  3 0
0  -8 0   2 0  0 0  4 0   32 0    3 0  8 0  2 | -2 0  4 0 -10 -1  2 0  9 0  0 0 -2 -3 -3 0
0 -13 0  -6 0  1 0 -7 0 -265 0  -19 0  8 0  2 |  1 0 -1 0   3  0  2 0 -4 0  2 0 -1 -4 -4 0
0 -12 0   5 0  7 0  2 0   24 0   10 0  5 0  4 | -1 0  3 0  -1  0 -2 0  3 0  1 0 -1  1  1 0
So.. it even works somehow. And even gets ~1.05kHz scanrate if not disturbed - but.
BUT.
Barely enough analog pins (20 total in K20 - and that would be _really_ stretching it, ganging pins together, using MUXSEL..), HORRIBLE ADCs (Just look at that noise spike!), essentially 8 bit (because lowest 4 bits in 12-bit mode are chemically pure shit, an 5th is so-so), SNR of only 2x..
In short, kinetis as a platform sucks.

OK, I've proven что не зассал and it's possible to implement this on kinetis if you take enough sea sickness pills.

But, since I've lost all interest - lack of commercial potential, "real life" - pick any, really - if anyone wants to pick up that flag, feel free to. Forking on github is real easy nowadays.
It's all actually pretty simple, no rocket science. You just need to remember to
a) not drive the strobe too hard so it doesn't ring as hell.
Slew control is your friend here. If it still rings - throw a resistor in series with the strobe trace. 1K should be more than enough. IBM for some reason used 10K ones, but I don't see much point in that.

and

b) interleave the ADC readings with reading from the ground, so that ADC sampling capacitor has a chance to discharge. If you don't - the charge from the pressed button will spill over the next buttons you scan (sample cap will charge the sense lines because it has higher voltage) and screw up your measurements.

I may return to this if I find an income source which doesn't eat all of my time.
Wouldn't count on that though, if I were you.

Thank you, and good luck.

PS: (too bad you can't lock your own topics)
PPS: Sorry, lot_lizard. I promised you to bring this to a workable stage. Can't keep all the promises, it seems.
Last edited by DMA on 05 Apr 2017, 08:35, edited 1 time in total.

User avatar
lot_lizard

14 Dec 2016, 02:02

I couldn't be more happy that you made it as far as did... I personally learned a LOT along your journey (honestly). What you were trying is nasty hard, and have tremendous respect for your work here. I hope everyone else does. If not, they are either ignorant or... well... ignorant.

Keep us all in the loop on what your future holds in life. Many of us here want to make sure we keep up with you on your new journey. You're a nerd's nerd (wicked compliment).

User avatar
Techno Trousers
100,000,000 actuations

14 Dec 2016, 02:06

I willfully place myself in the ignorant camp when it comes to EE, but even I can recognize that you have done some really cool stuff here! Best of luck with all your current troubles, and stay strong. I've found that some of the best times on my life have followed very closely after the toughest times.

HuBandiT

14 Dec 2016, 05:32

With DMA putting his efforts on pause, I reiterate my offer that if anyone can lend me a capacitive board, I'd like to have a go at tackling the issue.

User avatar
lot_lizard

14 Dec 2016, 15:35

HuBandiT wrote: With DMA putting his efforts on pause, I reiterate my offer that if anyone can lend me a capacitive board, I'd like to have a go at tackling the issue.
PM me your address... I'll send you over a F122 PCB when all this MF stuff ships to Europe.

User avatar
Muirium
µ

14 Dec 2016, 18:42

I'll try to bring my (custom Model F) XTant kit back over to Europe with me when I fly home this time. I had meant to loan it to Dima for custom controller experiments but it never worked out. (He wanted a pickup instead of shipping, and I was in another continent, as usual.) I'm all in on Lizard's Model MF now, so those components are looking for a new home and a good use anyway.

Xwhatsit's controller is a marvel, but not a perfect one. The single threshold value for every key in the keyboard is its Achilles Heel. So I'm still keen on fresh controllers. The MF and XTant are modular and so future controller upgrades are relevant to both. I have a vested interest in helping controller development! Especially if it works for Beamspring, too, as I've found those boards to be pretty flaky over time compared to my Kishsaver.

From what I've heard, the XTant is a bit of a wild child as far as Fs go. So it could be a particularly worthy adversary for a controller designer!

HuBandiT

15 Dec 2016, 05:22

Thank you guys. lot_lizard, I PMed you.

In the meantime I stumbled upon and bought this guy: http://www.ebay.com/itm/122240715090?_t ... EBIDX%3AIT

Hopefully it is relevant enough for our purposes?

Let's see whether I managed to order it properly and whether it actually ends up arriving (I'm not an ebayer).

Post Reply

Return to “Workshop”