Voice Recording: Too Much Noise

RE: http://forum.arduino.cc/index.php?topic=573158.0

hello everyone i am having the same problem

here am using
Electret Mic Breakout Board;

Arduino uno

and

SD card adapter

what i noticed is that when i give a 3.3v to the mic i get a reasonable output put the noise is still present but when i give a 5v then i get the same output that was posted by MarkT

I searched online and i found “power supply noise rejection”

Power supply noise rejection – Technical Brief. … PSNR is a measurement of how well a circuit rejects noise from various frequencies which get coupled into the power supply. In high speed analog and digital circuitry, power supply pins are vulnerable to random noise.

so i tried giving vcc and ground of the mic from a nodemcu(3.3v) i have with me but still getting the same output.

from the zip file
TEST 4 is when i give vcc to 5v
TEST 5 and 6 is with 3.3v

test files.zip (214 KB)

That noise is way too low to be caused by the power supply. It is not noise anyway, which in electronics is a specific thing which sounds like a hiss.

The clicking sounds like interference from another source, maybe clipping caused by too much input signal or an LED or something flashing.

there no other input signal other than the sd card and and the mic and definitely for sure no led flashing

any other suggestions plz

TEST4.WAV has this sort of spike on a sporadic basis (not every 512 samples, so not buffering probably):

Mark T

what can i do to get better recording am not understanding the graph

Its a plot of sample value against sample number taken direct from the wav file - read a byte, plot it, just
a simple bit of python using matplotlib.

You have those noise spikes in your system, you have to troubleshoot this... The more information you
give us the more likely we can help. Without an oscilloscope problems like this are trickier to troubleshoot.

Here’s the Python code if its useful to anyone…
Needs numpy and matplotlib.

import numpy as np
import matplotlib.pyplot as plt

content = None

with open ("TEST4.WAV", "rb") as f:
    content = f.read()

samplen = np.zeros ([len(content)], int)
samplev = np.zeros ([len(content)], int)

for i in range (len(content)):
    samplen[i] = i
    samplev[i] = content[i]

#START = 1000
#LIMIT = 15000

START = 13700
LIMIT = 14200

# plot and show that the difference of output complex amplitudes for high and low has constant amplitude
fig = plt.figure()
ax = fig.add_subplot (1,1,1)
ax.plot (samplen[START:LIMIT], samplev[START:LIMIT], 'r')
plt.show()

Azeez_Jimoh:
there no other input signal other than the sd card and and the mic and definitely for sure no led flashing

any other suggestions plz

Post all your code along with schematics and photographs of the wiring.

connections

Arduino and SD Card

https://hallroad.org/wp-content/uploads/2018/03/Micro-SD-Card-Reader-Module-In-Pakistan-3.jpg

arduino with mic

A0 to audio

3.3v to vcc

gnd to gnd

Code

#include <SD.h>
#include <SPI.h>
#include <TMRpcm.h>


#define SD_ChipSelectPin 4  //using digital pin 4 on arduino nano 328, can use other pins

TMRpcm audio;   // create an object for use in this sketch 

void setup() {
  
  Serial.begin(115200);
  
  if (!SD.begin(SD_ChipSelectPin)) {  
    return;
  }else{
    Serial.println("SD OK"); 
  }
  // The audio library needs to know which CS pin to use for recording
  audio.CSPin = SD_ChipSelectPin;
}


void loop() {
  
    if(Serial.available()){                          //Send commands over serial to play
      switch(Serial.read()){
        case 'r': audio.startRecording("test.wav",16000,A0); break;    //Record at 16khz sample rate on pin A0
        case 'R': audio.startRecording("test.wav",16000,A0,1); break;  //Record, but with passthrough to speaker.
        case 't': audio.startRecording("test.wav",16000,A0,2); break;  //Do not record. Output direct to speaker
        							       //Note: If samples are dropped before writing, it
        							       //      will not be heard in passthrough mode
        case 's': audio.stopRecording("test.wav"); break;              //Stop recording
        case 'p': audio.play("test.wav"); break;                       //Play the recording 
        case '=': audio.volume(1); break;                              //Increase volume by 1. Does not affect recording
        case '-': audio.volume(0); break;                              //Decrease volume by 1. Does not affect recording
        case 'S': audio.stopPlayback(); break;                         //Stop all playback
        
      }
    }
}

That link does not work, I get a page not found.

That description is not a schematic, at best it is incomplete.

Sorry for that for the sd card

Arduino to SD card

VCC to 5V in the Arduino.

GND of SD card to the ground of Arduino.

CS to pin 4

SCK to pin 13

MOSI to pin 11

MISO to pin 12

i gave different ground from the for both SD card and the mic from the UNO

i gave different ground from the for both SD card and the mic from the UNO

They should have the same ground.

Link still does not work, that is not a schematic, are you serious about getting help?

A png of both connections

SD card and MIC with uno.zip (187 KB)

Blood -> stone :frowning:

The things I want to check is do you have level logic shifters on the SD card. A stupid Fritzing diagram is not going to tell me that, a schematic will because you will / should have labeled the SD card with the actual type it is.

Have you tried recording at a lower sample rate?
It is likely the dropouts you are seeing is a result of sporadic writing to the SD card.