I want to build an arduino controlled machine that recognizes if someone is shouting and react to that.
It should messure the the length of the shout.
I thought of something like this:
microphone ->preamp -> arduino
(if sound is going louder than xy start messure Time, if sound is not louder than xy anymore stop messure Time
-> 30% of the messured Time = doing nothing
-> than trigger a Relais for 100% of the messured Time)
I hope you understand that, my english isn't that good on Sundays
It seems like an easy thing to do to me, is it?!
Ah btw. i want it standalone, without a PC. Dont know if it makes any difference.
You see I am pretty new to arduino, so maybe you know some existing codes that could be used for it? Or just some general advice how to realize the interpreting of the audio in signal etc.
Hi Max, welcome where are you from (I can't see in your profile)
Think you have a reasonable idea how you would do it. Have you checked the tutorial section allready, There are several samples that contain code parts that I recognize in your project.
learn how to measure time wilt millis()
Here some code to get started...
void setup()
{
Serial.begin(115200);
Serial.println("Soundmeter 0.1");
}
void loop()
{
// DO MEASUREMENT
unsigned long startTime= millis();
while (analogRead(A0) > 300); // 300 threshold to be tuned
unsigned long duration = millis() - startTime;
Serial.print("duration:\t ");
Serial.println(duration);
if (duration > 10000) // 10 seconds minimum value to be tuned
{
// wait 30%
// switch on Relay 100%
}
}
No.
Because a microphone gives you the whole audio waveform. It is only the size of the peaks that determin the loudness.
So you have to do one of a few things
Just filter out the peak readings.
Take an RMS value from a number of readings.
Have an envelope detector between your amplifier and the arduino's input.
No.
Because a microphone gives you the whole audio waveform. It is only the size of the peaks that determin the loudness.
So you have to do one of a few things
Just filter out the peak readings.
Take an RMS value from a number of readings. Have an envelope detector between your amplifier and the arduino's input.