Go Down

Topic: Newbie recording audio (Read 815 times) previous topic - next topic

Alex_osborne

Oct 16, 2019, 05:46 pm Last Edit: Oct 16, 2019, 06:04 pm by Alex_osborne
Hello,


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.

Code: [Select]

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

#define SD_ChipSelectPin 10 

TMRpcm audio;   

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


void loop() {
 
    if(Serial.available()){                       
      switch(Serial.read()){
        case 'r': audio.startRecording("test.wav", 10000, A0); break;   
        case 's': audio.stopRecording("test.wav"); break;             
      }
    }
}

Grumpy_Mike

Quote
and microphone wired up.
How?
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?

Alex_osborne

It is wired up like in this tutorial (https://www.instructables.com/id/Make-Your-Own-Spy-Bug-Arduino-Voice-Recorder/), 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 (https://www.ebay.co.uk/itm/Max9814-Electret-Microphone-Amplifier-Module-Auto-Gain-Control-For-Arduino-C16/283401758790?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649). 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.

Grumpy_Mike

#3
Oct 17, 2019, 05:27 pm Last Edit: Oct 17, 2019, 05:31 pm by Grumpy_Mike
Quote
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
Quote
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?
Edit
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.


Grumpy_Mike

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.

Go Up