Homemade button to test how hard it was hit

So I am trying to determine how hard a button has been hit, rather than just on off. Infact I have 16 buttons in a matrix and I want to know how hard any of them are hit. So I have decided to basically do it with 32 buttons in the matrix.
The way I want to do it though is with three strips of sprung steel, on top of each other. They are screwed down at one end, but at the fixing, they are seperated by felt/rubber or something, i.e not touching. The other end there is a gap between each strip of metal.
The top piece of metal is connected to vcc. The middle strip is connected to a pin and a 10k resistor to ground, and the botton strip is also connected to a pin and 10k resistor to ground.
When you press the top strip down (vcc), it connects with the middle strip pulling the pin to vcc, and you begin timing how long it is until the other pin (the bottom strip) is connected to vcc. The length of this time (cailbrated) tells you how hard it was hit.

Does that make sense, and would that work?
Thanks
Alex

Very unlikely this would work - especially without any definition of what you mean by "how hard". Have a look at the wiki page on 'impulse'. How hard something appears to be hit depends not only on the force applied, but how long the impact lasts for so to speak. Think of those that break though the tile towers with a hand strike, it's the very sudden force that breaks the tiles, they would support that same force if applied gradually.

The best (and easiest) way to do this, is using something that is designed for this exact purpose - an acceleration. Force = Mass * Acceleration.

Hmm I dont know if I used the right word, Just to clarify, it is for a midi "ntoe" - like a piano key, so its not so much force I am interested in, more speed..The faster it is pressed, the louder to play the midi note...?

Idk how easy it would be but it would be very cool if you instead used two laser matrixs, separated by a space
once the first matrix is broken it would time until the second one goes off, that time is your speed
This way its not mechanically sensitive and wil be more robust
You could either use a colored laser and play it in the dark, or infrared laser and just place markers for where the buttons are

The above is a very good idea - you could implement it very easily using two pairs of IR LEDs and phototransistors mounted under each key. Like winner said, when the upper phototransistor switches off, start a timer, when the second switches off - look how long it took.

You would still need to check though if this is actually the right way to go about it - when you watch some people play, it's not so much the speed they hit the keys, but how hard they ultimately push down. Again, back to the impulse thing.

Maybe a load cell of some sort is the best way to go about it - better yet, pull apart an existing one, see how it's done!

Hi Guys, yeah a completely non mechanical solution could be much better. Currently keyboards use little silicone compressible domes, over copper pads on the pcb.
I have attached an image of what I think you mean, sorry just knocked it up in paint. Is that right?
I have alot of them to do though - 50 in total (i want two octaves), so I want to put them in a matrix. I assume I can put 2 IR leds in series straight from VCC to GND and then those in parralel with the other 25 pairs, then set a resistor in series with them, and then put the phototransistors in a matrix.
I assume the phototransistors pick up an analog reading as opposed to a digital one, so could it even be better to use a pin expander and then connect them to an analog pin?

In terms of the practicalities of mounting them, they obvoisuly (the leds and the photoresistors) need to be facing each other, so can you get right angled smd versions? Also how would I stack them on top of each other?

Thanks guys, I like this electronic solution rather than a mechanical one alot

EDIT:

Like these?
http://www.rapidonline.com/Electronic-Components/Transistor-Darlington-photo-interrupter-68054

Could you use piezo knock sensors or just plain piezo transducer to determine hardness of hit?
http://interface.khm.de/index.php/lab/experiments/knock-sensor-with-piezo-element/

Already tried that, smd ones are really expensive for that many keys, and through hole ones are really fiddly to install. I want something more robust.

really expensive for that many keys

Guess why good Digital Pianos (this one is not the high end) are so much more expensive than Keyboards.
Are you interested in discussions about "fully weighted" vs. "graded soft touch" keys ?

If you want to tell how hard a hit is you need to set some kind of range. You can use a spring and a pot to tell how hard the hit is

hit.PNG

Normally on a music keyboard this is done by the sort of switch you describe but wired differently. It is called a break before make change over switch. You have to measure the time between when it is broken and made. In effect this means turning it into two switches. The common connection is connected to ground and the other two ends both have pull up resistors to +5V and also connect into separate inputs. You time the period when both these inputs are high, that gives you the press velocity.

Are you interested in discussions about "fully weighted" vs. "graded soft touch" keys ?

Yes I am, but first I want to work out the best way to solve the problem of velocity reading - using standard parts

If you want to tell how hard a hit is you need to set some kind of range. You can use a spring and a pot to tell how hard the hit is

Yeah ive thought of this, but unless you know a company that produces these by the millions, and sells them cheaply, this would be a major faff to put together and setup, plus its totally mechanical and therefore much more prone to failure.

Grump_Mike:
Is what you're talking about a Dpdt slide switch? They have three connections - the middle one to ground, and the outside two to +5v and a digital pin.
Is this how its usually done is it? I pulled apart a midi keyboard, and they use two push switches per key, and time the time between the two being pressed - hence my light gate idea - anyone want to comment on the pro's/cons of that technique?

Is what you're talking about a Dpdt slide switch?

No, that was an illustration to describe the action of the switch. What I have used is a small switch with gold plated wires being bent by the switch. You used to be able to get them from electronics shops in the 60s to the 90 made for making keyboards. I might have one in my workshop, but I have not got access at the moment as I am away for a week.

Hmm doesnt sound very easy to get hold of, ir receiver's currently winning. Any cons to it?

Depending how u want ur keys laid out u may not be able to matrx it that much, also 50 keys x 2pair ir will be. Alot of inputs you'll need to figure out how to do that like shift registers

a.mlw.walker:
Hmm doesnt sound very easy to get hold of

I am not saying get one. I am saying this is how your original idea is not so original and how to wire it up in order for it to actually work.

ir receiver's currently winning. Any cons to it?

Have you priced it up? How many keys are you after?
This will be many orders of magnitude more expensive than actually buying a keyboard and the results will not be as good.

Here's my take (see image below, which is a side view):

Three strips of spring steel ("shim stock" or "feeler gauge stock", etc) cantilevered with spacers between them. Piano key is attached to the top strip.

When the key is depressed contact will be made with the middle strip of metal (which is attached to a digital pin) registering a digital high. When the key is depressed farther both strips will contact the bottom strip and ground out registering a digital low. The time between the high and low is the velocity.

Of course there are resistances needed here -- ~5K between each middle strip and the Arduino and ~500R between the 5V and GND strip. The top strip should be pretty thick (for durability) and the middle strip should be very close to the top strip. You might want to put a bend in the middle strip near the end so it contacts the bottom strip (which could be a contact sheet for all the keys) more easily.

piano_key.png

Would anti-static foam work? Such foam typically is conductive and has a certain resistance; when it is compressed, this resistance changes...

How about a force sensitive resistor pad, FSR?

Lefty