I can't figure out how I can use my Arduino Mega 2560 as a sound detector. What I would like to do is hook it up to audio and then when the audio is over (Arduino not sensing any sound) it will send a 5 volt signal out after about 15 seconds or so. It seems pretty simple, but I can't figure it out.
el_supremo:
Where is the Arduino Mega going to be in all this?
Pete
I kind of changed my mind. I won't be hooking it up directly to an amp, I will use an LM386 Op Amp with a microphone to detect the audio. Once the audio is silent, I want my program to start to count down from 15 seconds to 0. It needs to reset if audio is detected. Then when at 0 sec, I want a 5V signal to an output that will drive the coil in a relay. After a few seconds I want the 5V signal to drop. I need the countdown to start on the downward transition from 5V to 0V on that pin. If audio is still present, like I said, the whole thing just keeps resetting.
This has a lot to do with cutting my own vinyl records. I will be using this inside an old jukebox to detect when a song is done. The problem I have is that I cannot cut the lead out groove on a vinyl record with the equipment I have. The lead out groove quickly ends a record when the music is done. Since I cannot cut a lead out groove on a record, I will need to cut a bunch of silence all the way to the label. Some of this silence will be up to 2.5 minutes long. Its too long to wait between songs on a jukebox. There is a switch attached to the tone arm that tells the jukebox that a song is done based off of the lead out groove. I will be placing a relay, attached to the 5V output pin of the Arduino, in parallel with that switch. Once the Arduino does not detect anymore audio, the 15 second countdown will start. Then at 0 seconds, the Arduino will trigger the relay to end that record and play another one if one is selected.
I may not even need an op amp as the microphone will be connected to the metal case of the speaker to just sense some vibrations. The jukebox makes a lot of noise when a selection is placed and I do not want that noise to interfere with the audio I am trying to detect.
I am having issues with the code. That's my problem.