I have a MEMS microphone connected to the microcontroller on a PCB. The microphone collects the data and sends the analog data to the microcontroller in real-time. On the microcontroller, this data is converted to digital form and then I extract this digital data from the microcontroller. But when I plot the signal, I get the signal as a curved one. It looks like the DC offset is not constant. All the recordings have this issue.

However, for ex., I record a song and when I play the file (after converting them to .wav files using MATLAB with specs such as sampling freq: 40KHz, Bits/sample:16), I don't see any problem in the audio files, I am able to hear the song properly. I have attached the plot as well as the audio file for reference.

As the microcontroller and microphone are part of an assembled PCB, I plan to scratch off the insulation and expose the copper line (analog signal line from the microphone to the microcontroller's pin), and then I can probe there using an oscilloscope to check what could be happening there.

Can anybody suggest what could be the issue here or what can I try to get rid of this?

Thanks, Gagan

Link for the audio file: audio file enter image description here

  • 1
    $\begingroup$ This looks similar to the phenomenon that occurs when the data acquisition system has just initialized. There also seems to be a consistent DC offset. If possible, set your acquisition system to AC coupling and don't power cycle the acquisition unit between collects. If the curve persists, you may just need to collect a few seconds to allow the system to initialize and discard that in post processing or remove the offset using a quadratic detrend. $\endgroup$
    – Ash
    May 1, 2022 at 23:12
  • $\begingroup$ Hi Ash, Unfortunately, I cannot set my system to AC coupling. However, I did not understand why you said that the DC offset looks consistent, isn't the DC offset is a particular value that is added to the whole signal? $\endgroup$ May 2, 2022 at 2:09

2 Answers 2


Remember that sound pressure is directly proportional to air pressure (both measured in Pascal). To be precise, sound pressures is the variation of the pressure around the static air pressure or DC pressure. This definition implies some sort of corner frequency, where variations above that frequency are considered "sound" and variations below are considered "shift in static air pressure".

Microphones already have a built-in acoustic high pass (they wouldn't work otherwise). Typically manufacturers try to set the acoustic high pass as low as is technically feasible and let the application designer decide where they really want it by adding another high pass somewhere. That's often called "AC coupling".

The signal that you are seeing is perfectly normal for a residential sound signal. You get frequently large shifts air pressure: someone opens or closes a door, an AC kicks on, people or other objects moving around. In fact, the noise levels rise dramatically as frequency drops.

Unfortunately, I cannot set my system to AC coupling.

You kind of have to. First of, it's already AC coupled somewhere. The microphone, your pre-amp and/or your ADC will have a high pass. Yours looks to be around 1 Hz or so. If you don't high pass at corner frequency that's suitable for your application, you will have enormous noise issues and are liable to frequently overload and clip your data acquisition system. The energy you pick up between 1Hz and 40 Hz will be much higher than the total energy in the audible frequency band.

  • $\begingroup$ Hilmar, thanks. However, it's a different case with my PCB. I am using a ring (3d-printed) surrounding the acoustic port of mic which sits on a pipe (the ring has a curved area that sits on the pipe and another flat side sticks to the PCB). This forms an acoustic chamber to pick up sound efficiently, so there is less chance that "shift in static air" would matter. Another reason I am sure is that this is the second design, the first PCB design did not have any such drifting issue. I did make some changes in the design, so maybe that? But that high pass seems a good try. $\endgroup$ May 7, 2022 at 6:41
  • $\begingroup$ How can I find a suitable high pass filter? Can you provide any links or refer any docs? Thanks. $\endgroup$ May 7, 2022 at 6:41
  • 1
    $\begingroup$ A simple RC circuit should do it. I would look a the data sheet of your MEMS, they often have some reference circuit $\endgroup$
    – Hilmar
    May 7, 2022 at 20:09

Either, the microphone's signal is not decoupled by an appropriate capacitor in series or the input pin has no proper path to ground. Possibly both. Try activating/applying a pulldown resistor to the input pin and check if there is indeed no capacitor in the signal path.


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.