I use a Wemos D1 Mini with Tasmota in our basement which is also our bands rehearsal room. I have attached a BME280 to monitor temperature and humidity to check that our gear has a good environment which works great. In addition, I connected a KY-038 sound sensor to monitor sound-level, specifically I want to monitor decibels during the rehearsals.
I randomly set the potentiometer to the analog value of 760 which is equivalent to 50db (just checked with a smartphone app, nothing special). When the noise level rises during the reheasels, the analog value decreases. So from my understanding the louder it is, the lower the analog value. But how can I properly calculate the analog value to (more or less) correct value of decibels?
Can you give me a more specific hint how to calculate the analog value to decibel? Am I on a right track in general or do I need another hardware to get this done?
The formula you posted is actually for dbV (Deci Bel Volts) where we look at a ratio of a voltage change. If looking at sound pressure is dbA and becomes 10 * Log rather than 20 * Log. Again db is merely used to express a ratio. From the WiKi:
"One decibel (0.1 bel) equals 10 times the common logarithm of the power ratio. Expressed as a formula, the intensity of a sound in decibels is 10 log10 (S1/S2), where S1 and S2 are the intensity of the two sounds; i.e., doubling the intensity of a sound means an increase of a little more than 3 dB".
Since db merely expresses a ratio and the change is logarithmic. 0 decibel is the so-called hearing threshold for the human ear. Obviously that will vary person to person. My threshold is not what it was 50 years ago. Since a point of reference is needed that is what is used for sound pressure. There are also weighing factors for sound which for now can be left alone.
This is a good read on the subject and why you are seeing what you see I don't know. My best suggestion would be to get a good audio meter. You also want to consider distance from source of sound and how quickly the sound pressure level drops with distance.
Calibrate with a known good dB(A) meter. A phone may work for this - if your phone itself has been calibrated against a known source or the measurement of a known good dB(A) meter.
Get a few measurements of dB, write down the analog values, and fit the dB(A) curve - which is indeed logarithmic - to this. Knowing the response of your microphone to different volume and frequencies will be helpful as well.
740-760 is an awefully small part of the 0-1023 range of the ADC. Also the ADC has an error of +/- 1-2 points, which in your case is >10 dB(A) difference. That makes the measurement seem rather useless.