Projects / Microphone noise floor and gain lab

Microphone noise floor and gain lab

Beginner1 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANO

    Wire the module to 5V, GND and A0

    The module's power light may come on.

  2. NANO

    Upload and open the serial monitor at 9600

    Three numbers print twice a second.

  3. NANO

    Stay quiet with the gain at its lowest

    Note the noise floor RMS.

  4. NANO

    Raise the gain to the middle and then the top

    Note the RMS again.

  5. NANO

    Repeat near a running fan

    The RMS rises further.

  6. NANO

    Clap once at each gain

    Compare the peak-to-peak.

In short

How do you build a microphone noise floor and gain lab?

Read a MAX4466 microphone module in a quiet room, then at several gain settings, and see how the quiet signal and the noise change. You learn what a noise floor is and why too much gain only makes the hiss louder. You need Arduino Nano, MAX4466 microphone module, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
4

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
MAX4466 module VCCNano 5VPower
MAX4466 module GNDNano GNDCommon ground
MAX4466 module OUTNano A0The audio signal, centred near half the supply

Code

The MAX4466 module turns sound into a wobbling voltage centred near half the supply, and a small trimmer on the board sets the gain. The sketch collects 256 readings over a few milliseconds, then prints the average, the gap between the highest and lowest reading, and the RMS value, which is a steady measure of how much the signal wobbles. In a quiet room with no sound the wobble that remains is the noise floor. Turn the trimmer gently with a small screwdriver to three settings, low, middle and high, and write down the numbers for a quiet room, for a fan running nearby and for a clap. You will see that more gain makes the loud sound bigger, but the noise floor grows too, so the quiet signal does not get any cleaner. The program only measures how loud it is. It records and stores no sound.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

const uint8_t MIC_PIN = A0;
const int N = 256;
int samples[N];

void setup() {
  Serial.begin(9600);
  Serial.println("mean  peak-to-peak  rms   (counts out of 1023)");
}

void loop() {
  long sum = 0;
  int lo = 1023, hi = 0;
  for (int i = 0; i < N; i++) {
    samples[i] = analogRead(MIC_PIN);
    sum += samples[i];
    if (samples[i] < lo) lo = samples[i];
    if (samples[i] > hi) hi = samples[i];
  }
  int mean = sum / N;
  long sq = 0;
  for (int i = 0; i < N; i++) {
    long d = samples[i] - mean;
    sq += d * d;
  }
  float rms = sqrt((float)sq / N);
  Serial.print(mean);
  Serial.print("   ");
  Serial.print(hi - lo);
  Serial.print("   ");
  Serial.println(rms, 1);
  delay(500);
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

mean  peak-to-peak  rms   (counts out of 1023)
511   149   42.8
512   148   41.8
509   147   42.5
511   148   44.3
509   149   43.5

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Quiet room, low gainRMS of only a few counts
Quiet room, high gainRMS clearly larger
Fan runningRMS rises above the quiet value
ClapPeak-to-peak jumps toward the full scale
Mean valueSits near the middle, around 500

If it does not work

Mean is near 0 or 1023

Check the OUT wire goes to A0 and the module has power.

Reading never changes

Turn the gain up a little.

Signal clips at the top

Turn the gain down.

Very large noise

Keep the wires short and away from the USB lead.

Serial text is garbled

Set the monitor to 9600 baud.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the microphone noise floor and gain lab?

Arduino Nano, MAX4466 microphone module, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the microphone noise floor and gain lab take to build?

About 60 minutes for a beginner maker, in 6 steps.

How do I know the microphone noise floor and gain lab works?

Quiet room, low gain: RMS of only a few counts. Quiet room, high gain: RMS clearly larger. Fan running: RMS rises above the quiet value.

Mean is near 0 or 1023: what should I check?

Check the OUT wire goes to A0 and the module has power.

Reading never changes: what should I check?

Turn the gain up a little.

Signal clips at the top: what should I check?

Turn the gain down.

Very large noise: what should I check?

Keep the wires short and away from the USB lead.