I set up a system to measure the sound pressure level in a location. This consists of a Knowles SPU0410LR5H-QB microphone connected to the codec SGTL5000, which is connected to the micro-controller over I2S.

The SGTL5000 codec microphone input has a 30dB gain before the ADC. I calculate the SPL by sampling the I2S data over 1 second and getting the logarithmic of the RMS value. I took some measurements with the device and a commercial sound level meter and another I2S MEMS microphone using the same calculation method.

Plot of readings from

Although the measurement method wasn't very scientific, it's clear that there's a deviation from the 45° line indicating that the microphone output level(mV) is not proportional to the sound pressure (Pa).

This is not the result of any Automatic Volume Control by the CODEC by feeding the mic input from a signal generator. (SGTL5000 has AVC but it's turned off in my case).

  • 1
    \$\begingroup\$ What does the datasheet say? \$\endgroup\$
    – winny
    Commented Sep 8, 2019 at 11:36
  • \$\begingroup\$ Where do you see the deviation from the "perfect" line? There is a difference, but this is really small. \$\endgroup\$
    – asdfex
    Commented Sep 8, 2019 at 11:57
  • \$\begingroup\$ Have you eliminated DC offset and quantisation noise from your post-measurement calculations? They would show up as some constant microphone output in the absence of sound input. (I had to resort to 3am measurements and waiting a minute when cars passed the building when I was doing this stuff!) \$\endgroup\$
    – user16324
    Commented Sep 8, 2019 at 12:02
  • 2
    \$\begingroup\$ looks like a simple gain error to me, most of the resistors used in an amplifier may only be 1-5% matching in value, so some deviation is to be expected, As its linear apart from the gain error you could likely correct it by trimming one of the gain resistors slightly. \$\endgroup\$
    – Reroute
    Commented Sep 8, 2019 at 12:08
  • 1
    \$\begingroup\$ Have you verified CODEC linearity using a signal generator? \$\endgroup\$ Commented Sep 9, 2019 at 2:06

2 Answers 2


Although the measurement method wasn't very scientific, it's clear that there's a deviation from the 45° line

Actually it isn't clear. Without error bars you cannot determine the actual slope with any accuracy.

If you ignore the 'clearly' anomalous I2C mic reading at ~40dBV the slopes are virtually identical, indicating a simple gain error.

enter image description here

  • \$\begingroup\$ I didn't read the question as being that the two mic's had different slopes, but that neither slope is 1:1 with the meter. \$\endgroup\$ Commented Sep 8, 2019 at 22:05
  • \$\begingroup\$ Yeah I can live with the small difference between the two mics, but the problem is that neither has the 45 degree slope as like @ChrisStratton said. \$\endgroup\$
    – chamod
    Commented Sep 8, 2019 at 22:09
  • \$\begingroup\$ The revised graph has clarified the issue, but I'm still not convinced there is a real effect. Two different types of mic seem to have virtually identical response, so if there is a non-linearity it's probably not in the mics. We have no specs for the 'commercial sound level meter', so why should it be considered the standard? \$\endgroup\$ Commented Sep 9, 2019 at 0:56
  • \$\begingroup\$ The meter isn't necessarily the standard, but that then raises the question of why that is non-linear. It's the same problem on one side or another; granted the internals of the meter are probably less known. It isn't doing some sort of perceptual weighting mode, is it? \$\endgroup\$ Commented Sep 9, 2019 at 5:28
  • \$\begingroup\$ We should also consider that there may be a subtle bug in the asker's digital measurement algorithm... \$\endgroup\$ Commented Sep 9, 2019 at 5:29

Reading further into the datasheet, you are only facing a gain error, and its very linear, so you may be able to correct your gain error by using the ADC analog gain block, you can trim the signal gain by steps of +-1.5dB, page 15 of the datasheet you linked. its not a particularly great step size, but will get you within +-0.75dB of a pretty linear response.

enter image description here

  • \$\begingroup\$ I believe that a slope error on a log/log graph is not a gain error. If it were it would look like a constant up or down shift. \$\endgroup\$
    – carloc
    Commented Sep 8, 2019 at 17:39
  • \$\begingroup\$ I agree with @carloc. A gain difference would be just a shift. This looks as if the microphone sensitivity decreases when the input level gets higher. \$\endgroup\$
    – chamod
    Commented Sep 8, 2019 at 21:29
  • \$\begingroup\$ But if you ignore the anomalous I2S mic reading at around 40dB, both lines have almost the same slope. \$\endgroup\$ Commented Sep 8, 2019 at 21:42
  • \$\begingroup\$ I updated the plot with the sound level meter readings in orange. If I am not mistaken, both the mics should produce plots parallel to orange reference line, with a vertical shift that's determined by the changes in gain. \$\endgroup\$
    – chamod
    Commented Sep 8, 2019 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.