Arduino Project using Sound Sensor

Hello fellow Arduino users,

We've got a school project and we don't know how to solve our problem.

We have an Audio Sensor,, and some LED's.
Our LED has to light up if we clap, and has to go out when we clap again.
And our second project is that the LED has to light up brighter when the noise around it is louder, and has to be dimmed when its silent.

We hope you can give us an answer.

We hope you can give us an answer.

Don't try to do the whole project at once.

Read, on every pass through loop(), the sound level, and print the value to the serial port. Open the Serial Monitor to see the data.

If, as you make louder and quieter noises, you see the value changing, then you know you are getting good data.

Making the LED intensity correlate to the sound level is the easier part. Simply divide the sound reading by 4 and use the result as the LED brightness level.

Reacting to a clap is more challenging. How will you determine that a clap occurred, as opposed to someone shouting at the microphone? If you are simply looking for a sharp gradient (the values increase rapidly within a short time frame), that might be sufficient. Or, it might be overkill.

You might want to simply look for the sound value to be over some threshold, and, if that happens, consider it a clap.

The state change detection example shows how to deal with state changes when the input is digital (a switch is either on or off). It doesn't take much imagination to see how that could be applied to an analog input (the sound level is above the threshold now, and wasn't then, or the sound level is below the threshold and wasn't then).

When you have a state change (to above the threshold), toggle the state of the LED.

When I entered "clap sensor" in the search box on top of this page I got this as first hit.