I am an a level student just about to start making my product design project. The project in mind is a bin that when opened plays a sound that encourages children to recycle.
My issue is that i am new to the electronics world and this is my first major project using an arduino nano. I am going to be using a push to break switch in the bin so that when its opened it plays the sound i want it to play.
I need to find a way to actually get the sound to play though, and i think i know that i need to use some kind of sound board to play the sound through the speakers. Also, how would i use the arduino to choose at random which sound can be played, so the sounds don't just cycle through on a loop.
So basically how would i use an arduino and a sound board to play sounds and also play the sounds on random?
My issue is that i am new to the electronics world and this is my first major project using an arduino nano.
Have you ever done any programming?
The good news/bad news is, the Arduino isn't very good at sound. By itself, it can only make simple tones like a musical greeting-card. But, there are [u]Audio Shields[/u] (add-on boards) that do most of the work. So, the Arduino only has to send some simple "commands" to select a file and start/stop sound.
Some audio shields can only play WAV files, and some can't directly drive a speaker (so you'd need an amplifier or "powered" speakers).
Wow - Amazing - I am working on something similar right now.
I would recommend checking out a Adafruit Audi FX mini sound board. I was just playing with one of these last night - it's incredibly easy to use.
You can load WAV or OGG files onto it like you would with a thumb drive. You can then control the sounds either with an Arduino or a similar device - or you can just use individual switches to play the sound. For what you are attempting to do - you don't even need an Arduino.
What sort of a sound are you wanting to play? If you just want to play audio frequencies (like beeps, tones, etc.) then you could just use a piezo buzzer or a speaker attached to the Arduino. You could play a tune or make some cool R2D2 sorts of noises but you are somewhat limited. There actually is a library called Talkie that allows you to generate speech with just a speaker connected to the Arduino but it will be fairly crude.
If you want to actually play sound files then look at the options for the various MP3 player modules or shields that are available. I know the DFPlayer Mini is popular with the DIY light saber crowd but there are certainly other options. Once you decide on the hardware you can look at the examples and documentation for the associated library to get an idea of how to do the programming. After that you can come back here if you have specific questions.