(Concept) modulable keyfeel optical discrete switch

User avatar
PlacaFromHell

18 Apr 2021, 05:32

Hello guys. Today I want to show you my newest switch concept. At first I want to thank HuBandiT for descending into the depths of the forbidden ancestral knowledge and bring back this idea to me. Good job, fella!

So, what's a "modulable keyfeel" switch? Well, the definition of modulation is, literally, the exertion of a modifying or controlling influence on something. When we think on a normal switch, we mostly find mechanical features that delimitate a certain type of feel, that feel is an inherent atribute of the mechanism that can't be altered without any modification to the estructure of the piece, which represents quite a problem if you want to personalize your key feedback. A modulable keyfeel switch is the absolute opposite, of course, it has a mechanical nature, but the operation of it fuctions based on a phenomenon alien to its own mechanical propperties.
Enough stupid talk, let's release Cthulhu!
Image

This cursed thing has a total of 9 parts, consisting on two housing parts, a slider, two magnets, an infrared LED, an infrared sensor and two coils. The switch operation is separated in two parts:

Keyfeel response:
A pair of electromagnets that push two center permanent magnets simulate the same interaction a spring produces in a normal switch, while also being capable of produce a difference in feedback via restricting or releasing the supplied current of the coils.

Analogic sensing:
In order for the controller to know how much current supply to a switch at a given moment, it needs an analog input. What an infrared sensor does is simply bounce infrared light into a surface and measure the result with a photodiode. The closer the surface, the stronger the measure. The square in the bottom part of the slider, which I call "reference surface" is nothing more than bare plastic with the purpose of producing such readings. For our purposes we need a high resolution proximity sensor so the switch feels smooth and not steppy.

Image

Combining this two steps the result is a sort of Excel table we can play with, producing WHATEVER feel we want:
Image

Not liking this one? Let's tell the controller to do something else, maybe you want to play a game and you are looking for a linear switch:
Image
BOOM!

Now, this switch has two main issues: a whole keyboard would eat a fuckton of power, being necessary an external power supply and the controller must be way more complicated than usual, both being able to run a very large bunch of code in short time and having a massive analog GPIO. Still possible. Costs are a different situation.
I can also describe some other aspects like the fact that the switch has 8 pins, making it solid for PCB mounting, if you want a plate is meant to be screwed on the switches, not the switches to be clipped in. Anyways, I think I touched the central points quite well, thanks for making it to here!
Last edited by PlacaFromHell on 30 Apr 2021, 01:40, edited 1 time in total.

User avatar
Lalaland124

18 Apr 2021, 13:41

Very interesting and cool design, would be awesome if you could do an animation again :)

User avatar
Muirium
µ

18 Apr 2021, 14:11

I'd put a coil spring under the slider, so they still return to home even without power. Otherwise, the keyboard's going to be real floppy when disconnected. Should also save power draw.

Active dial-a-force-curve mechanisms are a holy grail in keyswitch design. The idea's been around since, if I recall, a patent from the 1970s. Certain well known community members have worked on this a bit themselves. Though many years have passed and there's still no result, so you might as well have a go at it if you're serious.

Strong electromagnets like you require are termed solenoids. (I'm not an electrical engineer so I may be missing the exact terminology, corrections always welcome.) Solenoids are indeed something we have built stuff for in keyboards, with their ever-so-cunning driver circuitry in USB modded beamsprings. I don't know what their reaction speed is, but you need to juice them plenty, so maybe inductance / capacitance is going to be in play. My intuition is they need a good kick on the accelerator before they lurch to life.

User avatar
XMIT
[ XMIT ]

18 Apr 2021, 14:57

I feel like HaaTa and I were discussing electromagnetic force curves using solenoids about five years ago. Have you calculated exactly how much power would be used by an HHKB sized board? I think it's prohibitive. It would be fine for prototyping key feels in a lab or as a one off but the power draw would make it prohibitive to run.

The neat thing about solenoid based tactility is you can make the force curve go negative, and actively pull the key cap out from under you, similar to the way a Selectric works.

User avatar
Muirium
µ

18 Apr 2021, 15:12

He's been at it longer than that. What do you think all those force curve measurements he's been gathering are for? ;)

I can picture all manner of wild inventive stuff on a mechanism like this. Ergo weighting like on Topre is just the beginning. How about making keys lighter (or their tactile actuation event higher) when you're already typing fast, to enhance the sense of flow? Or indeed the opposite for common typos of your choice? I've auto-corrections aplenty on my Mac to fix my frequent mistakes on the fly (see below) but stiffening the keys would give me the feedback where I actually need it: NO NOT THIS KEY! Move over!
Spoiler:
Screenshot 2021-04-18 at 2.06.25 pm.jpg
Screenshot 2021-04-18 at 2.06.25 pm.jpg (87.53 KiB) Viewed 568 times
These are synced to my phone as well, which excuses some but not all of them!
Dynamic force curves can be altered as you type, for a really dynamic, downright haptic keyboard. We have the processing at our disposal to do this stuff. But the actuators are, indeed, a power hog. Is magnetism the right path, I wonder? Anyone know much about piezoelectrics?

User avatar
raoulduke-esq

18 Apr 2021, 15:20

Your substitution list could also be used to translate Scottish pronunciation to written English!

micmil

19 Apr 2021, 05:03

Pointless waste of electricity. The much better option is to use a ferrofluid-filled tube system like is used in the suspension systems of expensive cars. Sure, it'll cost about $200 per key but at least you won't have to spend that extra $1.85 on electricity per month. It'll only be about $1.75 in electricity to run those. :mrgreen:

Okay, I was being a snarky cunt as usual but the ferrofluid thing sounds really cool now.

On the actual topic, I do like the idea in general. Having that infinite variability would be amazing but my analysis-paralysis ass wouldn't be able to cope.

User avatar
PlacaFromHell

19 Apr 2021, 06:21

XMIT wrote:
18 Apr 2021, 14:57
Have you calculated exactly how much power would be used by an HHKB sized board? I think it's prohibitive. It would be fine for prototyping key feels in a lab or as a one off but the power draw would make it prohibitive to run.
Still not, but the stronger the permanent magnets and the less the wire gauge, the more power efficiency of the switch. Also if you see the curves, the current supply in the resting position is barely enough to maintain the key up, so the keys that are not being used can consume less. When you press a key, the controller must skyrocket the current at the very first movement.
XMIT wrote:
18 Apr 2021, 14:57
The neat thing about solenoid based tactility is you can make the force curve go negative, and actively pull the key cap out from under you, similar to the way a Selectric works.
Muirium wrote:
18 Apr 2021, 14:11
I'd put a coil spring under the slider, so they still return to home even without power. Otherwise, the keyboard's going to be real floppy when disconnected. Should also save power draw.
Boy, this two pair really nice together, right? I can add an external spring just like in F&F switches, but I have the intuition that the bare electromagnetic switch will be stupidly smooth.
I might do an animation later, if I can pairing the current modulation with the switch operation.

User avatar
PlacaFromHell

19 Apr 2021, 06:27

micmil wrote:
19 Apr 2021, 05:03
Pointless waste of electricity. The much better option is to use a ferrofluid-filled tube system like is used in the suspension systems of expensive cars. Sure, it'll cost about $200 per key but at least you won't have to spend that extra $1.85 on electricity per month. It'll only be about $1.75 in electricity to run those. :mrgreen:

Okay, I was being a snarky cunt as usual but the ferrofluid thing sounds really cool now.

On the actual topic, I do like the idea in general. Having that infinite variability would be amazing but my analysis-paralysis ass wouldn't be able to cope.
Why would you do that if you can make a piston switch with an independent mini-pump for every key for keyfeel modulation? And you can use a separated static preassure piston with a quartz crystal inside to use it as a pressure sensor and know where the key is, easy :lol:
There was a dude at Discord who wanted to make a radioactive switch using Geiger counters, still worth compared to artisan keycaps.

User avatar
vvp

20 Apr 2021, 09:34

PlacaFromHell wrote:
19 Apr 2021, 06:21
XMIT wrote:
18 Apr 2021, 14:57
Have you calculated exactly how much power would be used by an HHKB sized board?
Still not, but the stronger the permanent magnets and the less the wire gauge, the more power efficiency of the switch.
That is rather strange way of understanding how electricity works. Although the current required to drive a coil with more turns is lower, the voltage required to drive it is higher. The required power is P = U*I. So you will not get fundamental power savings on the coil itself. But you will get some power savings with more turns thanks to the drain-source voltage of an open FET and anode-cathode losses of the freewheeling diodes. Therefore it makes sense to go for a lower current (bigger voltage) but not because of the solenoids themselves.

The power losses of a switch which is not being pressed corresponds to ohmic losses. These will be dominated by losses in diodes and the FET switching losses (for PWM driving).

The power losses of a switch which is being pressed (a coil against a magnet) will correspond to the work required to press the switch. That is only around 24 mW for 60g switches and 120 WPM typing. That is little and you actually could recover part of that energy from user typing instead of putting it. But that is only a theoretical option. Anyway, the point is that you will need at least 24mW / 5V = 4.8 mA of current in the ideal situation to do the required mechanical work only. That is if your circuits are ideal. And they won't. But maybe you can do it in 5-10 times the power if you are careful with the design.

Muirium's idea do add springs so that you do not need to power the switches which are not being pressed is a good one.

User avatar
Muirium
µ

20 Apr 2021, 17:48

Call that strange? My understanding of electricity is that it ultimately involves a black lodge, a red room and a backwards speaking dwarf.

User avatar
Go-Kart

20 Apr 2021, 22:15

I like all these ideas, Placa. Though, I'd again have concerns about bleed from adjacent coils for this particular design.

Keep the ideas coming, my dude.

User avatar
PlacaFromHell

21 Apr 2021, 02:42

vvp wrote:
20 Apr 2021, 09:34
The power losses of a switch which is not being pressed corresponds to ohmic losses. These will be dominated by losses in diodes and the FET switching losses (for PWM driving).
This is the part I have not very clear, why would I want to PWM the switches? I was thinking on varying the input voltage so the current will do too and with it the strength of the magnets
Muirium wrote:
20 Apr 2021, 17:48
Call that strange? My understanding of electricity is that it ultimately involves a black lodge, a red room and a backwards speaking dwarf.
My bad anyways, I remembered the "less current per more turns" but not the "more voltage per more turns".
Go-Kart wrote:
20 Apr 2021, 22:15
I like all these ideas, Placa. Though, I'd again have concerns about bleed from adjacent coils for this particular design.

Keep the ideas coming, my dude.
Thanks. There's a bunch of materials that can box EM fields pretty nicely. Keep in mind this is a concept, if I ever do serious work on this think some parts will be redesigned for a real life situation.

Although my training on electromagnetism doesn't go further than the electronics oriented vocational school, with practice, error and reading I'm sure I can get this thing working. Thanks to all, guys!

User avatar
vvp

21 Apr 2021, 10:00

PlacaFromHell wrote:
21 Apr 2021, 02:42
This is the part I have not very clear, why would I want to PWM the switches? I was thinking on varying the input voltage so the current will do too and with it the strength of the magnets
Only a very rough "on the back of a napkin" calculation. Feel free to improve it.

Because PWM is more energy efficient. Let's say you use standard varying voltage in the range of 0-5 V and most of the time you need about 2.5 V and 5 mA to power the coil. That means that you need to waste 5-2.5 = 2.5 V on the controlling transistor. That is a pure waste of energy in the range of 2.5 * 5e-3 = 12.5 mW.

If you use PWM than this waste happens only during the time the transistor is switching (which is in the range of 0.1 µs). On the other side, you will be loosing energy in the freewheeling diode which PWM needs. The diode forward voltage is around 0.5 V so that loss is around 0.5 * 5e-3 * ½ = 1.3 mW. The additional ½ is there since we need about half the duty cycle in our example and the diode is used only when the transistor is switched off.

Switching loss needs to be added. Let's say you ran it at 20 kHz (so that it is not audible). Than the switching losses will be around 2 * 20e3 * 1.3e-3 * 1e-6 = 0.05 mW. That is actually not bad. You will also have forward transistor losses of around 5e-3 * 0.1 = 0.5 mW if you use a higher quality FET with the on-resistance of only about 0.1 ohm.

So overall you have losses around 1.3 + 0.05 + 0.5 = 1.9 mW for PWM controll.

All of the above must be multiplied by the number of active switches. In your case without springs it is around (lets assume a non-ergonomic 105 key keyboard):
105 * 1.9 = 194.3 mW if you use PWM
105 * 12.5 = 1.3 W if you use varying voltage

Plus you will have significant losses in all the other supporting control logic (probably around 5 mW at least). Plus losses from the analog sensors and the actual work you will need to do which I mentioned in my previous message. Plus some LEDs, maybe buzzer and LCD.

Overall, I think it is doable in the 5 V * 0.5 A = 2.5 W USB2 limit. Not easy. Both schematic and firmware will be quite complicated and the firmware will have significant real time requirements.

I actually plan to do something similar for the 4 home keys on each half of my K84CS to achieve smooth linear analog input for better mouse emulation and a simulated tactile feedback when the keys are used in a standard keyboard mode. But I do not have time for it now. Maybe I'll get to it when I retire :D

User avatar
PlacaFromHell

21 Apr 2021, 10:17

vvp wrote:
21 Apr 2021, 10:00
PlacaFromHell wrote:
21 Apr 2021, 02:42
This is the part I have not very clear, why would I want to PWM the switches? I was thinking on varying the input voltage so the current will do too and with it the strength of the magnets
Only a very rough "on the back of a napkin" calculation. Feel free to improve it.

Because PWM is more energy efficient. Let's say you use standard varying voltage in the range of 0-5 V and most of the time you need about 2.5 V and 5 mA to power the coil. That means that you need to waste 5-2.5 = 2.5 V on the controlling transistor. That is a pure waste of energy in the range of 2.5 * 5e-3 = 12.5 mW.

If you use PWM than this waste happens only during the time the transistor is switching (which is in the range of 0.1 µs). On the other side, you will be loosing energy in the freewheeling diode which PWM needs. The diode forward voltage is around 0.5 V so that loss is around 0.5 * 5e-3 * ½ = 1.3 mW. The additional ½ is there since we need about half the duty cycle in our example and the diode is used only when the transistor is switched off.

Switching loss needs to be added. Let's say you ran it at 20 kHz (so that it is not audible). Than the switching losses will be around 2 * 20e3 * 1.3e-3 * 1e-6 = 0.05 mW. That is actually not bad. You will also have forward transistor losses of around 5e-3 * 0.1 = 0.5 mW if you use a higher quality FET with the on-resistance of only about 0.1 ohm.

So overall you have losses around 1.3 + 0.05 + 0.5 = 1.9 mW for PWM controll.

All of the above must be multiplied by the number of active switches. In your case without springs it is around (lets assume a non-ergonomic 105 key keyboard):
105 * 1.9 = 194.3 mW if you use PWM
105 * 12.5 = 1.3 W if you use varying voltage

Plus you will have significant losses in all the other supporting control logic (probably around 5 mW at least). Plus losses from the analog sensors and the actual work you will need to do which I mentioned in my previous message. Plus some LEDs, maybe buzzer and LCD.

Overall, I think it is doable in the 5 V * 0.5 A = 2.5 W USB2 limit. Not easy. Both schematic and firmware will be quite complicated and the firmware will have significant real time requirements.

I actually plan to do something similar for the 4 home keys on each half of my K84CS to achieve smooth linear analog input for better mouse emulation and a simulated tactile feedback when the keys are used in a standard keyboard mode. But I do not have time for it now. Maybe I'll get to it when I retire :D
This has a lot of sense, anyways I'm somehow concerned about the impact on feel, I mean, it has sense for controlling a motor's speed, but while making this thing vary on weight you will have no weight and full weight intervals. It must be tried by sure anyways.

User avatar
vvp

21 Apr 2021, 13:41

PlacaFromHell wrote:
21 Apr 2021, 10:17
This has a lot of sense, anyways I'm somehow concerned about the impact on feel, I mean, it has sense for controlling a motor's speed, but while making this thing vary on weight you will have no weight and full weight intervals. It must be tried by sure anyways.
It is not a problem. You must realize that a coil is an inductive load (i.e. the current is changing slowly) and that frequency is high and that the force generated by coil depends on its current only. It is not a problem to achieve current ripple only few percent and adding the key stem and cap inertia to that will result in a system which will have no noticeable vibration.

Notice that brush-less (and even stepper) motors all use this kind of powering and they do not feel jerky. It is all a matter of PWM frequency in relation to the coil inductance and the DC bus voltage.

But by all means, if you like varying voltage more then just use it. I do not want to limit you in your project in any way.

User avatar
PlacaFromHell

21 Apr 2021, 19:47

vvp wrote:
21 Apr 2021, 13:41
It is not a problem. You must realize that a coil is an inductive load (i.e. the current is changing slowly) and that frequency is high and that the force generated by coil depends on its current only. It is not a problem to achieve current ripple only few percent and adding the key stem and cap inertia to that will result in a system which will have no noticeable vibration.

Notice that brush-less (and even stepper) motors all use this kind of powering and they do not feel jerky. It is all a matter of PWM frequency in relation to the coil inductance and the DC bus voltage.

But by all means, if you like varying voltage more then just use it. I do not want to limit you in your project in any way.
My man, you're pure wisdom, in fact I'm regretting being a lazy ass and don't go with an electronics engineering degree. I will take clear notes of this and PWM will be my first test if this materializes.

User avatar
Muirium
µ

22 Apr 2021, 14:46

Pulse it good and fast. Some of us can hear 20kHz quite nicely, and dogs very keenly do, up a fair bit higher!

I swear, my high frequency hearing is designed specifically so that cheap whiny power supplies will bug the shit out of me while nobody else notices they're even on. It's a gift!

User avatar
vvp

22 Apr 2021, 19:49

Wiki claims that the best of humans can hear up to 28 kHz. Dogs up to 45 kHz and cats up to 79 kHz. It is not a problem to make it about 30 kHz. Going higher, especially to the cat range would mean to cut corners a tiny bit on control precision since common counters are fed by 180 MHz source at most and that would lead to a lower counter precision than the precision of common 12 bit analog digital converters. Not a big deal.

May be it should be configurable. The older of us could set it to about 18 kHz to repel kids pestering us when we work at a computer :mrgreen:

Post Reply

Return to “Workshop”