I just built my first Arduino and am working through a bunch of tutorials, so I am very new to this stuff.
One thing that I'd like to experiment with is creating music using buttons. One feature I'd like to add in is to change the music created depending on how hard or soft the button is pushed. Is there a specific type of button that I need to do this? What are they called? Any ideas as the best ways to do this?
My idea was to have a decent sized 2D array of these things... perhaps as many as 100. This could get costly @ $5-7 each! Or is there a less expensive alternative?
Your magical google juice is "DIY force sensitive resistor"
This one is easy if you've ordered a lot of parts - the foam you have to use is very particular. It certainly works and you can experiment with thicknesses of foam to get your required sensitivity:
The test to see if you have proper conductive foam is to hold it in your hand and see if you can operate your iPhone (or other capacitive screen) by touching ONLY IT to the screen. If it works- you're golden. Video:
Now - as a new Arduino user, you will likely find that your biggest issue is going to be USING 200 analog devices. See, since you're wanting to get pressure sensitivity on the cheap (just as I would!), you're not going to be using expensive force sensitive digital buttons. You're going to need 200 analog inputs. When you're doing something like reading a matrix of ON or OFF buttons, you can cheat a bit, but for variable resistance like this, you're going to have to multiplex in a huge way.
So... how done?
As a convenient pre-made schematic, you can take a look at using the well known 74HC4067 on Mark Mayhew's MUX shield:
It's easy enough, and you'd be able to string together as many of those multiplexors as you'd like.
You're likely to want to keep your code as slim as possible with this. Just polling those multiplexors will take ~30ms each round. While not a HUGE issue, it's something to think about!
Also: you're gonna need a MEGA to pull this off unless you go crazy with I2C or SPI daisychainable multiplexors - possible but slows things down too much for your application in my opinion. The shield and related code I linked to specifically ties one 74HC4067 to each analog pin, and on the UNO you only have 6. Note that the 4067 is not the only multiplexer in town at all. there are MANY. I just like that one because it's 16 ports and easily found in DIP form. Google "arduino analog multiplexer"
edit: added some spacing around video - didn't realize it was going to embed!
Less expensive alternative might just be a MIDI-controller/keyboard.
Up to 88 keys, MIDI can report how fast key was pressed, for how long, etc.
Or daisy chain a few less expensive 25-key keyboards.
Are you sure those are sensitive to force or just to touch/no touch?
As I googled them - no I am not sure.
But they often are and buying some touchpad or touchdisplay will come way cheaper than this huge array...
A few things... First- it's unlikely that these are force sensitive, at least most of them.
Next, these are, for the most part, not multitouch. Each unit would let you press in ONE place at a time and multiple presses would result in a confused or inaccurate result.
Given that the stated result is a musical instrument interface, polyphony is assumed, so these aren't really appropriate.
There ARE resistive+force sensitive screens but they are not multitouch. There ARE multitouch screens, but they're capacitive, and their "force sensitivity" is done through a software interpretation of the capacitive change based on a bigger touch (squished finger) or smaller touch (small fingertip). These are REALLY dodgy for public / multiuser applications.
The way music keyboards work is that there is a break before make change over switch on each key. What you do is to measure the time between the normally closed contact breaking and the normally open contact making. That time is then proportional to how hard you have pushed it. The pressure sensors record what is called "after touch" and not velocity which is what you want for an instrument.
Switches designed to make keyboards with these break before make change over switches are available.
Grumpy_Mike:
The way music keyboards work is that there is a break before make change over switch on each key. What you do is to measure the time between the normally closed contact breaking and the normally open contact making. That time is then proportional to how hard you have pushed it. The pressure sensors record what is called "after touch" and not velocity which is what you want for an instrument.
Switches designed to make keyboards with these break before make change over switches are available.
Agreed as long as the intention is a traditional velocity = attack and volume setup. If this is closer to "start pressing soft, then press harder and it gets louder" ala many synth pads, the FSR route is better. Should have asked.