Sound intensity from sound module

Here is the code for an SPL meter I made. There are lots of comments (and caveats) so it should make a good tutorial. (Different sound sensor.)

Normally the sound sensor is biased at half of Vcc and a regular Arduino (with a 10-bit ADC) will read about 512.

Perfect!

Perfect again! If you do an RMS calculation the values are squared so that also takes care of the negative values but it's "complicated" and it eats-up CPU time.

The maximum peak (1) or an average of the absolute values will also work. Of course that requires a "time window". With a digital display you don't want to updated more than about once per second so you can read & comprehend the numbers.

If you don't use absolute values (or ignore the negatives) the average of an AC waveform is zero. :wink:

Note that since you are sampling a waveform the raw data will "look random", even with a constant tone.

(1) I say "maximum" peak because there is a peak every cycle and with real-world audio every "cycle" is different, with a different duration and a different peak.