Sensing the velocity of something that has been pushed.

Thread Starter

Bod

Joined Sep 18, 2016
317
I'm wondering if there is a way to sense the velocity of something that has been pushed. I think the best example is any midi keyboard that has velocity sensing keys.

My original idea was to use 2 push buttons (or something like carbon pads for the final design) and once the first button was pushed it would start a timer until the second button was pushed. Then you would take that value and do 'speed = distance / time' to get the velocity. But if a normal small midi keyboard has 25 keys in total, thats means there is 50 buttons and 50 outputs. That's a lot of wires!
The only arduino that I know of that has 50+ digital pins is the Mega which uses the Atmega2560 but I don't want to have solder an SMD chip to my board. The Atmega1284 has 32 digital pins and is a 40 pin DIP package. I would still have to use 2 of them.
When searching velocity buttons, I found these: https://www.ebay.co.uk/p/2channel-S...4/1090848954?iid=142892529128&chn=ps&thm=1000. They normaly are used with motors but would they work with something going up and down?
My idea for the push buttons came from this video if you skip to about 14:18: https://www.youtube.com/watch?v=iAcNjVdd25w

I feel like none of that made sense, so I will say it again: I wondering if there is aything out there that will alow me to sense the velocity of something being pushed, I.E a piano key, without having to have 50 or so outputs.

Thanks,
Bod!
 

ericgibbs

Joined Jan 29, 2010
18,848
hi Bod,
When a key is depressed, does it matter if any other key is pressed on the keyboard.?
Are you wanting to identify which keys are being used.?

E
 

Thread Starter

Bod

Joined Sep 18, 2016
317
Thanks for the reply, eric!
I don't quite get what you mean - all I am trying to do is figure out how hard a key was pressed.

Bod.
 

ericgibbs

Joined Jan 29, 2010
18,848
hi,
OK,
How about two light beams [ laser pointers] under the keyboard, full width of keyboard.
A simple beam blocking shutter under each key.
Key press, beam 1 blocked, as key press further down beam 2 blocked,
Two beam detectors at one end of keyboard.
E
 

Thread Starter

Bod

Joined Sep 18, 2016
317
Thanks you eric!

That's is a really good idea however I now know what you were trying to say in your question and yes, it would matter which one was pressed. With your method I wouldn't be able to distinguish between what key wass pressed. Should I just do 2 lasers per key?

Bod.
 

ericgibbs

Joined Jan 29, 2010
18,848
hi,
I thought it was any one key from 25.
Checking all keys will not be easy, especially if user plays a Chord.?

Why are you trying to measure the key operation in this way.?
 

MrChips

Joined Oct 2, 2009
30,806
Using two switches is the common technique used on electronic pianos for velocity sensing as you have described it.
As for the large number of wires on a keyboard, you can assume that they do not use Arduinos. A typical digital keyboard could have 88 keys. Reducing the number of wires can be accomplished with appropriate hardware design.
 

Thread Starter

Bod

Joined Sep 18, 2016
317
hi,
I thought it was any one key from 25.
Checking all keys will not be easy, especially if user plays a Chord.?

Why are you trying to measure the key operation in this way.?
Doing it this way will make it so the harder you press the key, the louder the note.

Using two switches is the common technique used on electronic pianos for velocity sensing as you have described it.
As for the large number of wires on a keyboard, you can assume that they do not use Arduinos. A typical digital keyboard could have 88 keys. Reducing the number of wires can be accomplished with appropriate hardware design.
Hello,
As @MrChips said, there are special chips for scanning keyboards.
The E510 is one of them and it will produce a midi signal as output.
http://cedos.com/e510_midi_chip.htm

Bertus
Thanks for the help on this, it seems that the E510 is going to be the way to go! I want to use the arduino for the main processing (ie the display) and not for the keys as was mentioned, I just couldn't find a chip like the E510.

Thanks again,
Bod
 

Thread Starter

Bod

Joined Sep 18, 2016
317
How well do you think this would work for detecting velocity. Althought there is 50 buttons, there is only 25 outputs.

Screen Shot 2018-08-26 at 16.33.45.png
The cyan, ochre, and orange wires are the outputs. If these were hooked up to the positive of and led, when the first button was pushed the led would light, then when the next button would get pushed, the led would become brighter. I think there is enought of a voltage difference (4.0 - 4.7v) to tell how many buttons where pushed and when. This could be used to determine the velocity.

Do you think this circuit would be feasable in a 25 key piano, or should I look into diode matrixes?

Thanks,
Bod.

EDIT: If I used a diode matrix and still used 2 push buttons to yeild the velocity, that would make it a 2 x 25 matrix meaning there is 27 outputs rather than 25 like in my method. I would also have to use more diodes in a matrix, than I would in my method. I am really leaning towards my method.
 
Last edited:
Top