Can I multiplex 88 inputs or

I am asking if you think it could be done and hints of how...

A formula on how to find out how many inputs would be required would also be nice to have.

I need to make a n arduino controlled piano keyboard, so I need to measure the strength of the expresses.

Another option would be to place different digital sensors on the keys themselves, but that would require me at least 172 inputs, perhaps 264 or more.

Just now I have realised that with a digital LDR or something photosensitive you could place multiple lines on the keys and then use it as a counter to get a good estimate of the key press velocity, so it may not need to be analogic input after all...

Hi,

Can you explain how you would detect the pressure on each key, either using these "digital ldr" you mention or otherwise? Some links to these components would be helpful.

Two possible methods of reducing the number of inputs would be A. multiplexing and B. creating a matrix (which is in truth another form of multiplexing).

Using analog or digital multiplexors, you can generally reduce the number of inputs required by a factor of 8 or 16. So for example 5 x 16-channel multiplexors would be enough for your 88 keys. This would require 5 inputs and 4 outputs.

A matrix would probably require more inputs and outputs, but might avoid the need for more components/chips.

Paul

Key velocity is generally determined by using a changeover switch - one with a normally closed and a normally open contact. You measure the time between breaking the normally closed contact, and making the normally open one. (Alternatively, you can use two normally open contacts at different levels under the key.)

This is vastly simpler than using any sort of analog sensor. You need two input pins per key; you should still be able to multiplex them however.

the centipede shield?

can you give some figures about speed / accuracy/ precission?

I've doubts that it makes any sense to try to reproduce a cheap mass produced device.

I see a lot of work and the need to buy many parts just in order to reinvent the wheel.

So I'd go for a plug&play USB/MIDI Masterkeyboard and connect this to an Arduino.

PaulRB: Hi,

Can you explain how you would detect the pressure on each key, either using these "digital ldr" you mention or otherwise? Some links to these components would be helpful.

Oh oh... I made a mistake... It happens when you edit things up so that they look nothing like what they did when they started.

My idea was this:

You got one white LED and one LDR hooked up (the LED is simply hooked up to Vcc, with its resistor of course). It is has all sides except its top painted blsck.

You got one LDR hoocked up next to it, also protected by a black cover an all sides except top.

They are both conected to the inside of the keys. On the inside of ervery key (out of view by pianist), they are painted with a zebra pattern.

The light would reflect from the LED back to the LDR on the white strips, but no light would reflect on the black ones. You should be able to detect the number of strips down and therefore the speed of the keypress that way... I beleive...

The digital LDR reference was incorrect. An LDR is an analog pin, not a digital one.

How does this sounds?

I still have the problem of the need of too many pins. This means that I need to use a MEGA to detectonly 2 octaves, while the UNO not being able to tackle even one.

PaulRB: Two possible methods of reducing the number of inputs would be A. multiplexing and B. creating a matrix (which is in truth another form of multiplexing).

Thanks. I will research both options.

PaulRB: Using analog or digital multiplexors, you can generally reduce the number of inputs required by a factor of 8 or 16. So for example 5 x 16-channel multiplexors would be enough for your 88 keys. This would require 5 inputs and 4 outputs.

This doesn't adds up to me...5*16=80, which is less than 88... Am I missing something?

PaulRB: A matrix would probably require more inputs and outputs, but might avoid the need for more components/chips.

Paul

I am not afraid to do use additional chips, but I want to avoid shields if at all possible. The reason or this will became clear in a later post on this thread.

Paul__B: Key velocity is generally determined by using a changeover switch - one with a normally closed and a normally open contact. You measure the time between breaking the normally closed contact, and making the normally open one. (Alternatively, you can use two normally open contacts at different levels under the key.)

This is vastly simpler than using any sort of analog sensor. You need two input pins per key; you should still be able to multiplex them however.

Thanks. @Paul__B!

I would definetly consider this...

A zebra like metallic and plastic inside of a key... with a small metallic wheel making and breaking contact...

Amazing! This is much better than my LED/LDR idea, and it works with a digital pin and not an analog ones. Superb!

And yes, I could multiplex them...

With what? A 74HC595 is only good for controlling many output pins by using only 3 digital pins... Is there any chip that does the reverse?

robtillaart: the centipede shield?

can you give some figures about speed / accuracy/ precission?

Well, I am trying to avoid shields if at all possible, I guess I should have said that to begin with.

I don't mind external components (chips)... It is just shields I mistrust.

For 2 reasons:

1) I do not want to put anything ontop of my arduino and risking burning it up.

2) I want to learn how it works. If I use a shield, I risk not figuring out how it works on the elementary level.

For example, I first implementeda standard push button H bridge... With that learnt, I implemented one with only 2222 transistors... Then I moved to the L293D chip. That's how I did it, not the other way around.

A shield would be nice after I have figured out how to do it the harder way.

As for speed / accuracy / precission...

It doesn't has to be very fast. My solution should only be fast enough to detect a human pressing a key, which should not be very fast.

Accuracy... I am not entirely sure I read you right, but I will try to answer it to the best of my abilities. The solution should be accurate enough for it to detect up to 10/20 keys (2 piannists goofing off) being pressed at the same time, and it should distinguish them accuratly.

Precission... Not only which keys where pressed at what thime, but also the speed of each strike should be dettected.

Helmuth: I've doubts that it makes any sense to try to reproduce a cheap mass produced device.

I see a lot of work and the need to buy many parts just in order to reinvent the wheel.

So I'd go for a plug&play USB/MIDI Masterkeyboard and connect this to an Arduino.

You are almost correct staing that it makes no sense do do this... almost.

There is one particular case where it would make a LOT of sense to do it.

I have no use for a commercial device... since I do not play the piano. I still want to do this, however.

Why?

To learn how to do it. If I am able to successfullyt pull this off, I will not only able to learn how to build a pianno, but I will be able to learn many techniques with the Arduino that I would not had learnt otherwise. For example, just asking this question here, before even soldering the first resistor, made me learn from Paul__B's superve technique something I would not had thought about it otherwise.

I could very well reward myself with some pianno lessons for pulling this off... Something I would never do with some pianno from down the store!