(Skip to the third paragraph if you don't care about the context)

I've been thinking about piano actions -- the way piano keys are linked to the hammers that strike the strings. Different pianos have different actions, and thus their keys travel different distances, they require different amounts of force, and the resistance changes in different ways while the key travels as it activates different mechanisms and lands on the cushion (which may be of different materials and thus feel different). Specifically I was thinking about whether a digital piano could be constructed to replicate not just one acoustic piano action, but any acoustic piano action by modifying settings.

Ultimately a piano key is a lever that the player presses, and the counterforce it exerts against the finger changes as it is depressed. It is mostly a smooth transition, except there are often a couple of "bumps" where mechanisms are activated, and then a hard stop at the end when it hits the bottom.

My idea was to use electromagnetism to provide the resistance with feedback and active control to make it simulate a particular piano action (or rather, simulate a force-displacement curve). I'd use a hall effect sensor or rotary encoder or LVDT or something (not concerned specifically with that right now) to measure displacement and a microcontroller to control it all. For providing the resistance, I had a couple of ideas in mind:

  • Magnet on the underside of the key, electromagnet on the key-bed below, vary the current to the electromagnet based on the displacement of the key and the chosen force-displacement curve.
  • Iron rod mounted perpendicular to the bottom of the key that passes through a solenoid coil, again varying the current based on the displacement.
  • Linear motor mounted vertically, either under the key or at the back end of the key. Rather than being used to create motion, letting the player "overpower" the motor and have the motor exert counterpressure. This could actually be several different ideas depending on the particular technology employed.

For the design parameters I'm working with a maximum travel distance of 25mm, a maximum key velocity of 5m/s, a maximum key force of 50N, and an ideal "resolution" of 0.5 mm, or 50 steps over the full travel distance.

One of my big concerns is whether it's feasible to simulate a hard "wall" sensation this way, so I could make it feel like the key hits the cushions at the bottom after 10 or 12 mm or whatever, variable based on preferences.

Another concern with using either the electromagnet or solenoid solution is changing the magnetic field rapidly enough as the key moves. I'm guessing it might require a pretty big voltage spike to change the current that quickly.

With the linear motor solution I might be able to use several different coils to exert different forces as the key passes through, so maybe I could get the force-displacement curve without having to change the current / field in real time. The flipside to that though is that it might be hard to get the 0.5mm resolution I am looking for.

So now I come to my actual questions:

  • Is there prior work using EM for this sort of thing? I've tried Googling, but most of what I get is about using magnets to hold something in a fixed place (levitation, locks), or using linear motors for a fixed speed or fixed force.
  • Do you think this is even feasible? I'm sure it's physically possible, but the fact that I haven't found anything similar makes me wonder if there are big practical considerations like heat or power draw that will make this nonviable for a consumer product.
  • \$\begingroup\$ You appear to be asking questions that are likely beyond the scope of an EE site.; Is there prior work is like asking for product recommendations (off-topic) and, Do you think this is even feasible requires a lot of knowledge about piano mechanisms and I don't think that is generally on-topic here. \$\endgroup\$
    – Andy aka
    Oct 12, 2022 at 17:11
  • \$\begingroup\$ Re prior work: I don't mean anything to do with piano keys -- I mean has anyone used magnets in a way that controls the force exerted on an object based on its distance from the magnet. \$\endgroup\$ Oct 12, 2022 at 17:19
  • \$\begingroup\$ Thank you @Neil_UK! Is there a general term for this technique that I could search for? I thought about a controllable end stop, as that definitely would get rid of some of the hardest parts of the design, seems like that is a good idea then. \$\endgroup\$ Oct 12, 2022 at 17:22
  • 1
    \$\begingroup\$ Look up "haptic feedback". There are a lot of DIY projects which use a BLDC motor to give haptic feedback to a knob on the motor shaft. \$\endgroup\$
    – ErikR
    Oct 12, 2022 at 19:10
  • 1
    \$\begingroup\$ Apple patent US7166795B2 Method and apparatus for simulating a mechanical keyboard action in an electronic keyboard Abstract An electronic keyboard simulates the keyboard action of one or more acoustic pianos and/or organs. Sensors associated with each key capture the force exerted on the key, the speed of the key and the position of the key to compute an amount of force to apply in feedback to the depressed key. An actuator associated with each key provides the computed feedback value as a counter-force to the player's finger pressure. \$\endgroup\$ Oct 13, 2022 at 0:21

1 Answer 1


It's of course possible to use electromagnetism to modulate the force on a key.

The trick to equipping a piano would be to do it sufficiently cheaply per-key, as you have 88 of the things!

What you need is a motor, of some kind. You speculate about building types of motor with a magnet under the key, or a rod passing through a solenoid. This is generally a bad idea, as buying a motor will get you something more quickly, better engineered, smaller, more powerful, and probably cheaper in the long run.

My first thought is for a rotary motor - the most common and cheapest kind. You would need high torque, but low speed and travel. This could be met by a low speed BLDC motor. They will come cheaper when bought by the hundred! Used over a small angle, you need only drive one or two coils, and it will behave as a torque motor. You could couple this directly to the fulcrum of the key, or to a horn linked to further along the key for a bit of gearing, which may also allow you to get them sufficiently close together. Adjusting the current through this in response to its sensed position will give you the force feedback and mechanism 'bumps' you desire.

Achieving a hard stop will require an order of magnitude or two more torque than the action, so is probably best provided by an actual hard stop, possibly moved up and down by a jack-screw motor. Surely all the keys will use the same stop position? A stiff bar, or perhaps a shaft of cams, along the length of the keyboard, is all that's required.

  • \$\begingroup\$ This is excellent! Do you think the resolution would be a problem? With a key length of 200 mm to the fulcrum, a 10 mm travel is just under 3 degrees of arc, so each step of resolution would be about 0.15 degrees. I suppose I could run it through some gears to make it take up a larger arc distance and get better resolution. Re: key heights. Technically they can all be adjusted individually, but I'm pretty sure having them regulated to the same height is a goal for any piano tuner, so I think it's a fair compromise to force them all to be the same height. \$\endgroup\$ Oct 12, 2022 at 17:47
  • \$\begingroup\$ Also, thank you for adding "torque motor" to my vocabulary -- that's exactly the kind of concept I was thinking of, but I didn't have the word for it (and thus wasn't finding much info). \$\endgroup\$ Oct 12, 2022 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.