I want to build a learning game that have 27 buttons and each button when pressed play audio file of 3 seconds long,
What do I need?
I would start simple and learn how to setup and program a button first. http://arduino.cc/en/tutorial/button
Then, to play audio files you will need a shield like this one Adafruit Wave Shield for Arduino Kit [v1.1] : ID 94 : $22.00 : Adafruit Industries, Unique & fun DIY electronics and kits
That is often called a soundboard.
I agree with Pauly.
I haven't done the following, but I am very interested in the shield-less method:
I haven’t done the following, but I am very interested in the shield-less method:
I tried it and it works quite well.
Thx u all,
Which product can handle working with 27 buttons, I will learn on that one,
Probably a Mega, but before you settle on the Arduino you should sort out what board / shield you’re going to use for the audio playback and what pins need to be reserved for that.
If you want to wire all of the buttons to the processor directly, then you need something with a lot of pins (such as the Mega 2560 or Due).
However, there are other ways to handle reading a lot of buttons. You could for instance use 2 MCP23017's, which are i2c chips, that allow you to connect up to 16 digital inputs and/or outputs to a single i2c bus. You can put up to 8 MCP23017's on a single bus for reading up to 128 distinct buttons.
Whether you wire the buttons to a Mega or to MCP23017's, it can be somewhat tedious connecting all of those buttons, and making sure each button is connected.
Or you can get a LOBShield (Lots of Buttons) which uses only a single analog button, and anything that takes the Uno style shields would work (such as an Uno). The video on tindie in fact shows connecting an Adafruit wav shield with a LOBShield to get a music player to play 35 different sounds: LOBShield - Lots Of Buttons from ElectricLaboratory on Tindie
Thx for this detailed answer, I can't use the LOBShield because I need the buttons seperated ( each buttons located elsewhere ),
So u think it's easier to use the mega or different one with MCP23017,
Well no matter what, you are going to have a rats nest of wiring.
If you have several buttons grouped together, it may simplify things if you have a separate MCP23017 (or MCP23008 if you only need 8 buttons per cluster) for each grouping of buttons. You would only need 4 wires to go from each cluster back to the microprocessor, and those wires would all be daisy chained.
Or you can use multi-stranded wire, such as cat 5e ethernet cables to reduce the wires you need to keep track of.
For 27 buttons, I would probably use AnalogButton approach to reduce the number of wires compared to a matrix. 27 seems like a lot for one analog pin though, I might use 2 or 3 analog strings to improve accuracy.
Why do you need such a large number of buttons? curious about the project specs...
I'd strongly consider putting the buttons in a matrix. 5x6 would get you up to 30 buttons, with only 11 wires.
I might consider Charlieplexing if I were -really- desperate for buttons with few pins...