Newbie recording audio


Completely new to the world of Arduino so please bear with me.

I have an Arduino Pro Mini 5v with an SD card and microphone wired up. Essentially all I want this to do is record 10 seconds of audio (wav format) to the SD card when it is first uploaded. So no switches to start or stop.

This is the code I have so far (it doesn’t work) so any help would be gratefully appreciated. The SD card and microphone do work as I have tested them separately.

It is a max9814 microphone.

Thank you.

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

#define SD_ChipSelectPin 10  

TMRpcm audio;   

void setup() {
  if (!SD.begin(SD_ChipSelectPin)) {  
    Serial.println("SD OK"); 
  audio.CSPin = SD_ChipSelectPin;

void loop() {
        case 'r': audio.startRecording("test.wav", 10000, A0); break;   
        case 's': audio.stopRecording("test.wav"); break;              

and microphone wired up.

Is it biased to half the rail?
Is it AC or D.C. coupled?
Can you post a schematic of your system please?

What is the output voltage of the microphone? Normally you will need an amplifier to get a signal of around 2.5V peak to peak?

What are the results of running your code?

It is wired up like in this tutorial (, I know your reservations about this but it was as simplified as possible for me to understand.

I do not know what biased to half the rail is.

I would presume it is DC?

This is the wiring schematic I used. Minus the LED and Tactile switch.

The microphone is this one (Max9814 Electret Microphone Amplifier Module Auto Gain Control For Arduino C16 | eBay). I presumed it had some limited amplification.

The code appears to do nothing, doesn't create a file on the SD card or produce any messages.

Thank you.

I do not know what biased to half the rail is.

No, and nether does GreatScottLab either. This particular author thinks he knows one hell of a lot more than he does.

The microphone board says it has an output of

Output: 2Vpp on 1.25V bias

If indeed you get this to work it would distort the sound on loud signals because you need a bias of half the power rail, so if you have a 5V supply then the bias needs to be 2.5V. This is a thing that this author often gets wrong, see his totally useless walkie talkie project for how much he doesn’t understand DC bias.

Where did you get that code from?
I did not see it in the crap article he wrote?
Oh I spot a .ino file link which I cannot look at because I am on a mobile device and they don’t do .ino files.

I got it from this post (Arduino voice recorder - Audio - Arduino Forum)

5at code is not very good as any error will not be recorded in the serial monitor.

Are you getting the serial messages that the SD card is OK?
Because if so that means the baud rate is set correctly on the serial monitor.

If not insert a line before the return call saying that the SD card failed to initialise correctly.