I'm looking for a formula/code to convert the analog input of 0 ... 1023 in dB. I didn't found the right answer in other threads.
The microphone has a sensitive of -46dB (Sensitivity (0dB=1V/Pa. 1kHz)) and the highest pressure that it could be handle with is 130 dB.
I try to set the amplify, that i get a voltage range of 0 ... 5V.
Yep, the reference level is the offset to be subtracted. If the calibration is done properly it will be the same reference level as used by the standard for comparison.
But I think it is fundamental to understand that dB are not an unity like volt or ohm but a ratio, expressed in logarithmic form for convenience calculation.
A ratio has no unity.