Author Topic: PCB-only capacitive keyboard?  (Read 8698 times)

0 Members and 4 Guests are viewing this topic.

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
PCB-only capacitive keyboard?
« on: October 27, 2022, 03:51:32 pm »
I am toying with the idea of designing a cheap-and-cheerful keyboard made of just a PCB with capacitive sensor areas (hidden under a layer of soldermask and silkscreen) and readout electronics. Full QWERTY keyboard, either regular size or a bit smaller.

Due to the lack of tactile feedback, I would not consider this for productive use on a computer. But it might be a nice solution for e.g. single-board functional models of vintage computers, an Enigma model, or a small "travel terminal" when combined with an onboard LCD.

Has this been done before? I could not find any open source projects, only a few commercial demos which apparently did not go anywhere.

Also, do you think there is any chance to read this via matrix scanning, or would every key need its own input on a suitable amplifier/thresholding chip? I am leaning towards the latter, assuming that the readout electronics would need to sense small changes vs. a baseline they determine after power-up -- that would conflict with a multiplexed/scanned input.

Finally, any particular recommendations for readout ICs? Should work well and reasonably fast, and remain affordable when you need about 50 inputs in total...
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3991
  • Country: nl
Re: PCB-only capacitive keyboard?
« Reply #1 on: October 27, 2022, 04:04:18 pm »
Capacitive touch screens use a scanning matrix, so why not a keyboard like what you have in mind. But don't ask me for schematics because I don't have any, and it is out of my league. 8)

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4700
  • Country: gb
Re: PCB-only capacitive keyboard?
« Reply #2 on: October 27, 2022, 04:16:19 pm »
Here are details of how a 16 channel touch PCB keyboard, is done.  Along with the (apparently) low cost IC which does the work.  Since the complete module, can be had for £5.99, and maybe less.

https://www.tontek.com.tw/uploads/product/106/TTP229-LSF_V1.0_EN.pdf

From

https://www.instructables.com/Touch-Keypad/
 
The following users thanked this post: ebastler, mskeete, pcprogrammer

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
Re: PCB-only capacitive keyboard?
« Reply #3 on: October 27, 2022, 05:54:36 pm »
Thank you both!

The TTP229 looks good. Not for matrixed connections, but they are cheap enough, and three of them should be enough for a basic "vintage" keyboard. (And four for a more complete layout.)

I struggle with the datasheet a bit. Could not figure out whether the TTP29 sends make and break codes, or has some other way to indicate how long each key is held? That would be good for proper shift and control keys. Probably worth just buying some and giving this a try.

The chip does not seem to be available from the big distributors, but I found a 10-pack on AliExpress for 8.80€. I would feel more comfortable if I had found more than one vendor offering them though... (Yes, it does not help that I am in Germany. I believe AliExpress only shows me vendors who have already found a way to deal with the new European packaging recycling requirements, which Germany apparently enforces as one of the first countries in Europe. Grmpf...)

Is anybody aware of a more "mainstream" touch detector IC?

Edit: I had searched for the TTP229-LSF. Turns out that there is also a -BSF version which is much more common on AliExpress. It is also listed (but out of stock) at LCSC. I have not figured out the difference between the -LSF and -BSF types yet, but that makes me feel a bit better about availability already.
« Last Edit: October 27, 2022, 06:03:14 pm by ebastler »
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4700
  • Country: gb
Re: PCB-only capacitive keyboard?
« Reply #4 on: October 27, 2022, 06:02:26 pm »
Is anybody aware of a more "mainstream" touch detector IC?

Feel free to fill in the parameters that you want, but there seem to be quite a variety.

https://www.digikey.com/en/products/filter/interface/sensor-capacitive-touch/560
 
The following users thanked this post: ebastler

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
Re: PCB-only capacitive keyboard?
« Reply #5 on: October 27, 2022, 06:17:40 pm »
Thank you again! The search gets narrowed down quickly if I filter for active parts and chips meant to read buttons (rather than proximity or sliders), and 16 or more of them per chip. Six hits, three in stock:

IS31SE5117 is similar to the TTP229 you found earlier, 16 inputs to be wired to one capacitive pad each: https://www.lumissil.com/assets/pdf/core/IS31SE5117_DS.pdf

IQS525 and IQS550 are impressive but also a bit intimidating. Meant for touchscreen or touchpad control with 3584 x 2304 max resolution. They interpolate finger position on a relatively coarse grid of electrodes. Multi-touch, up to 5 fingers. You could potentially map a keyboard layout to it, but would have to do more work in software. But then it's only one chip for a full keyboard, available via large distributors, and affordable at 2.50 to 3.20€. I have more reading to do in that datasheet...
https://www.azoteq.com/images/stories/pdf/iqs5xx-b000_trackpad_datasheet.pdf
 
The following users thanked this post: MK14

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3991
  • Country: nl
Re: PCB-only capacitive keyboard?
« Reply #6 on: October 27, 2022, 06:35:49 pm »
Just an idea, don't know if it can work, but how about using a microcontroller with a multi channel ADC in it.

Output for instance 100KHz bursts on the scan row lines with the aid of DMA. (Lets say 8 scan lines) and then use simple low pass filters on the scan columns and read these with the ADC. (For instance 1MSa/s conversion like STM32 devices can do)

With 200us bursts you still have a good scan rate and might be able to detect key presses. You are then also free to do with prolonged key presses what you like, because it is all software.

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4700
  • Country: gb
Re: PCB-only capacitive keyboard?
« Reply #7 on: October 27, 2022, 06:40:31 pm »
Just an idea, don't know if it can work, but how about using a microcontroller with a multi channel ADC in it.

A number of them (MCUs), have got built in CAPsense inputs.  (Names vary, I think, CAPsense was just a similar example).
But I didn't mention it, because, it is so hard to get specific MCUs, in stock these days, and the prices are so high (relatively speaking).

(From memory), some can have quite a few, such as 47 individual CAPsense pins.

EDIT Example/Information:
https://www.infineon.com/dgdl/Infineon-AN85951_PSoC_4_and_PSoC_6_MCU_CapSense_Design_Guide-ApplicationNotes-v27_00-EN.pdf?fileId=8ac78c8c7cdc391c017d0723535d4661

https://www.electronicdesign.com/technologies/dev-tools/article/21800818/smart-capacitivesensing-design-with-8bit-mcus
« Last Edit: October 27, 2022, 06:47:57 pm by MK14 »
 
The following users thanked this post: pcprogrammer

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3991
  • Country: nl
Re: PCB-only capacitive keyboard?
« Reply #8 on: October 27, 2022, 06:44:17 pm »
Yes you are right. I forgot about those. But indeed hard to get MCU's. Hopefully the end of the tunnel is nearby. A friend of mine said that the numbers of available STM32 boards on Aliexpress are rising and the prices are going down again. Have not looked myself.

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
Re: PCB-only capacitive keyboard?
« Reply #9 on: October 27, 2022, 06:50:34 pm »
Right -- I had come across capacitive inputs as a peripheral item on MCUs, but forgotten about them too. That's another promising approach, since whatever I want to build around the keyboard would require an MCU anyway. More datasheet reading ahead...
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4700
  • Country: gb
Re: PCB-only capacitive keyboard?
« Reply #10 on: October 27, 2022, 06:54:10 pm »
Right -- I had come across capacitive inputs as a peripheral item on MCUs, but forgotten about them too. That's another promising approach, since whatever I want to build around the keyboard would require an MCU anyway. More datasheet reading ahead...

Although I've often come across it (too).  I usually skip any such parts of the MCU datasheet, unless I am specifically interested in doing that.

Also, significant care, may be needed to get the PCB touch switch shape/design right.  Especially after the first spin of the PCB.  My understanding (hunch or gut-feeling), is it is quite tricky.
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4700
  • Country: gb
Re: PCB-only capacitive keyboard?
« Reply #11 on: October 27, 2022, 07:09:00 pm »
Right -- I had come across capacitive inputs as a peripheral item on MCUs, but forgotten about them too. That's another promising approach, since whatever I want to build around the keyboard would require an MCU anyway. More datasheet reading ahead...

Having a quick look at all the information guides, Microchip have about designing them and stuff.

https://www.microchip.com/en-us/products/touch-and-gesture/capacitive-touch-solutions-for-buttons-sliders-wheels-and-proximity/microcontrollers-with-integrated-capacitive-touch-module#

And their apparent hint(s), about using dedicated chip(s) to do it.  Makes me wonder, if it involves a lot of design effort, to get good results.  Which might only be worthwhile, for significant production projects, rather than hobby or quick one-off projects.

That's another reason why I was mentioning dedicated chips to do it, I think.
 

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
Re: PCB-only capacitive keyboard?
« Reply #12 on: October 27, 2022, 07:30:45 pm »
Yes, I was looking at the same Microchip page. A bit annoying that their parametric search seems quite limited (or I did not find the right one); I could only get a column which shows whether the MCU has a touch controller at all, but not the number of touch-enable inputs.

Regarding their ready-made dedicated chips, my understanding is that these would mainly save you from the programming effort, but you would still need to deal with PCB layout. Not sure how complex the programming is; maybe one has to deal with discarding spurious signals or crosstalk? I did not get that far yet.

 

Offline AndyBeez

  • Frequent Contributor
  • **
  • Posts: 856
  • Country: nu
Re: PCB-only capacitive keyboard?
« Reply #13 on: October 27, 2022, 07:31:44 pm »
Is your concept restricted to using a printed circuit board, FR4 I assume? You can fabricate capacitive tracks onto a flexible PCB, or even onto a coloured transparent acrylic sheet. A flexible PCB gives you a novel roll up keyboard. However, print onto a cardboard substrate and you'll have a (partially) recyclable keyboard.

So how big is the PCB, what surface finishes will it have and, how much per unit will it cost? Any LEDs for caps and num locks? And what is the keyboard layout: British, American, German, Spanish, French, Greek.... Windows, Linux, Mac, agnostic...?
 
The following users thanked this post: MK14

Offline magic

  • Super Contributor
  • ***
  • Posts: 6916
  • Country: pl
Re: PCB-only capacitive keyboard?
« Reply #14 on: October 27, 2022, 07:36:52 pm »
IBM Model F keyboards used matrix layout capacitive sensing on PCB with full N-key rollover using 1980's microcontrollers.
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4700
  • Country: gb
Re: PCB-only capacitive keyboard?
« Reply #15 on: October 27, 2022, 07:37:27 pm »
Yes, I was looking at the same Microchip page. A bit annoying that their parametric search seems quite limited (or I did not find the right one); I could only get a column which shows whether the MCU has a touch controller at all, but not the number of touch-enable inputs.

Regarding their ready-made dedicated chips, my understanding is that these would mainly save you from the programming effort, but you would still need to deal with PCB layout. Not sure how complex the programming is; maybe one has to deal with discarding spurious signals or crosstalk? I did not get that far yet.

This seems to confirm, that some of them are difficult and time-consuming to implement.

https://www.microchip.com/forums/m1009566.aspx

I think someone who has already created stuff with similar cap sensing keyboards, would know more about it.

I think there are libraries/similar (probably free), to help.  Which the suppliers can offer.  I've come across them, but never really looked into them, as I didn't need that feature.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12030
  • Country: ch
Re: PCB-only capacitive keyboard?
« Reply #16 on: October 27, 2022, 07:45:00 pm »
I am toying with the idea of designing a cheap-and-cheerful keyboard made of just a PCB with capacitive sensor areas (hidden under a layer of soldermask and silkscreen) and readout electronics. Full QWERTY keyboard, either regular size or a bit smaller.

Due to the lack of tactile feedback, I would not consider this for productive use on a computer. But it might be a nice solution for e.g. single-board functional models of vintage computers, an Enigma model, or a small "travel terminal" when combined with an onboard LCD.

Has this been done before? I could not find any open source projects, only a few commercial demos which apparently did not go anywhere.
I suspect the reason there aren’t any is because it’s not a particularly compelling thing to do. A keyboard size PCB is more expensive than a cheap USB keyboard. So you’d be spending more to produce something significantly inferior.
 

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
Re: PCB-only capacitive keyboard?
« Reply #17 on: October 27, 2022, 07:46:02 pm »
Is your concept restricted to using a printed circuit board, FR4 I assume? You can fabricate capacitive tracks onto a flexible PCB, or even onto a coloured transparent acrylic sheet. A flexible PCB gives you a novel roll up keyboard. However, print onto a cardboard substrate and you'll have a (partially) recyclable keyboard.

So how big is the PCB, what surface finishes will it have and, how much per unit will it cost? Any LEDs for caps and num locks? And what is the keyboard layout: British, American, German, Spanish, French, Greek.... Windows, Linux, Mac, agnostic...?

I have not settled on specs yet, and not even on an application. Had mentioned a few ideas in the initial post, which would all have relatively basic keyboards -- ASCII or Baudot teletype-style or similar. Maybe some status LEDs, which could be placed  on the top or bottom (reverse LEDs) of the PCB.

The general idea would be to have the keyboard share the PCB with whatever logic and display the gadget needs. Which would be the excuse for using the capacitive right-on-the-PCB keyboard, because as a keyboard it will probably not be too satisfying to use...

I like the idea of an Enigma model as a first application. Only 26 keys, and the original keyboard had an awkward feel, so expectations on the capacitive one would not be high.  ;)
 

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
Re: PCB-only capacitive keyboard?
« Reply #18 on: October 27, 2022, 07:48:49 pm »
A keyboard size PCB is more expensive than a cheap USB keyboard. So you’d be spending more to produce something significantly inferior.

Sure, as a stand-alone keyboard this would not make much sense. As mentioned in the first post, the idea would be to use this in single-board gadgets, where I like the idea of a minimalistic "just the one PCB" approach:

Quote
Due to the lack of tactile feedback, I would not consider this for productive use on a computer. But it might be a nice solution for e.g. single-board functional models of vintage computers, an Enigma model, or a small "travel terminal" when combined with an onboard LCD.
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4700
  • Country: gb
Re: PCB-only capacitive keyboard?
« Reply #19 on: October 27, 2022, 08:08:52 pm »
I knew I'd seen it.  But couldn't remember which MCU it was.  I suspect, you should be able to get hold of this one. (AtMega2560).

Up to 64 channels, built in.

https://ww1.microchip.com/downloads/en/devicedoc/atmel-2549-8-bit-avr-microcontroller-atmega640-1280-1281-2560-2561_datasheet.pdf

Quote
Atmel® QTouch® library support
– Capacitive touch buttons, sliders and wheels
– QTouch and QMatrix acquisition
Up to 64 sense channels
 
The following users thanked this post: ebastler

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12030
  • Country: ch
Re: PCB-only capacitive keyboard?
« Reply #20 on: October 27, 2022, 11:18:51 pm »
For those who don’t know, that’s the chip used in the Arduino Mega 2560, which exposes 54 GPIOs. So that’d be an easy and quick way to test that chip.
 
The following users thanked this post: ebastler, MK14

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
Re: PCB-only capacitive keyboard?
« Reply #21 on: October 28, 2022, 06:26:38 am »
Thank you both, MK14 and tooki. This looks like a friendly way to start and explore capacitive touch sensors. Atmel/Microchip provide a "QTouch" library and application notes on designing the electrodes for buttons, sliders etc.

https://www.mouser.com/pdfDocs/QTouch_QTAN0079.pdf
http://ww1.microchip.com/downloads/en/appnotes/atmel-42094-qtouch-schematic-and-layout-checklist_applicationnote_at02259.pdf

Edit: Of course, the bare MCUs (ATmega 640/1280/2560) are out of stock everywhere, with 1-year lead times or so... I'll take a look at alternatives, although other MCU series are likely to suffer from the same supply bottlenecks. While everything is out of stock at Mouser and TME, my go-to distributors, Digikey surprisingly has 50000 ATmega2560 on the shelf. Painfully expensive, but still reassuring.
« Last Edit: October 28, 2022, 07:16:59 am by ebastler »
 
The following users thanked this post: MK14

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6514
  • Country: fi
    • My home page and email address
Re: PCB-only capacitive keyboard?
« Reply #22 on: October 28, 2022, 02:24:22 pm »
One of my forever projects is a full-size projected capacitive keyboard on glass or transparent thermoplastic sandwich with indium tin oxide electrodes.
(I.e., a fully transparent keyboard.  A trinket, just like some people who love to wear a Rolex watch.)

Initially, I was hoping to use NXP MPR121 chips, which are essentially 12-channel capacitance-to-digital converters, with input range from 10pF to 2000pF with a 10-bit ADC.  Four chips can be connected to the same I²C bus (address 5A,5B,5C, or 5D, depending on where the ADDR selection pin is connected to).

I do not believe that a simple capacitance limit works well for touch detection.  I was hoping to use the proximity data –– with 1 cm² electrodes, MPR121 can easily detect a finger at about 10mm distance –– and velocity data prior to the touch/limit event to detect a keypress.  (I personally tend to have my fingers rest on the keyboard, so I'd want a "keypress" to really be a bounce away and back to the surface, tracked all the time, as opposed to just a "new" finger hitting the surface.)

Unfortunately, MPR121 isn't fast enough when it is precise enough, or precise enough when it is fast enough, for this: too much noise.  It might be, with good electrode design, but me no EE.  :(

So, what I really want now, is something like Apple Magic Trackpad, a projected capacitive proximity sensor, but in keyboard size and aspect ratio, essentially producing a high-resolution grid of capacitance values.  At 100+ Hz, the velocity data would suffice for my esoteric purposes.

Anyway, if you end up doing a capacitive keyboard, with individual sensors for each key, I recommend you look at the hexagonal electrode patterns: it fits the QWERTY keyboard layouts very well, if you orient the hexagons with peaks at top and bottom, so left and right sides are vertical.
 
The following users thanked this post: ebastler, MK14

Offline wilhe_jo

  • Regular Contributor
  • *
  • Posts: 189
  • Country: at
Re: PCB-only capacitive keyboard?
« Reply #23 on: October 28, 2022, 02:41:25 pm »
There's the STM8TL series... the STM8TL53C4 supports up to 300 cap-keys.

Programming can be done with SDCC. Documentation isn't that great, but you find enough helpful information out there.

73
 
The following users thanked this post: ebastler, MK14

Offline ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6676
  • Country: de
Re: PCB-only capacitive keyboard?
« Reply #24 on: October 29, 2022, 04:39:51 am »
There's the STM8TL series... the STM8TL53C4 supports up to 300 cap-keys.
Programming can be done with SDCC. Documentation isn't that great, but you find enough helpful information out there.

Thank you, these look promising and are much cheaper than the ATMega. Can drive a matrix of touch sensors; the maximum of 300 is via 15*20 transmitters and receivers. Unfortunately the STM8TL53C4 version (in the lareger 48-pin package) is unobtainable at this time, and is apparently uncommon even in normal times -- it is not classified as "normally in stock" at Mouser or Digikey.

One of my forever projects is a full-size projected capacitive keyboard on glass or transparent thermoplastic sandwich with indium tin oxide electrodes. (I.e., a fully transparent keyboard.  A trinket, just like some people who love to wear a Rolex watch.)
[...]
Unfortunately, MPR121 isn't fast enough when it is precise enough, or precise enough when it is fast enough, for this: too much noise.  It might be, with good electrode design, but me no EE.  :(
[...]
Anyway, if you end up doing a capacitive keyboard, with individual sensors for each key, I recommend you look at the hexagonal electrode patterns: it fits the QWERTY keyboard layouts very well, if you orient the hexagons with peaks at top and bottom, so left and right sides are vertical.

That is a cool idea.  8)

Thanks for the info on the MPR121. I had come across it too and thought it looked promising -- although you would need quite a few for a full-size keyboard. But if the MPR121 as a dedicated sensor IC still implies speed/precision readeoffs,  I might as well focus on the touch-enabled-MCU approach for my first attempt.

I would hope that sensitivity (and hence maximizing the electrode surface) is not critical for a PCB-only keyboard. Since I will only have a thin layer of soldermask and siklscreen on top of the electrodes, I would hope for a pretty strong capacitance change upon touch?

I think I will go forward with the Enigma model as my first application. No n-key-rollover in the original, and one has to hold each key for a moment to read the indicator lamp -- so this should be a relatively easy one to get right. And then I can try to make it faster, e.g. for a mini terminal.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf