Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: AUDIO board internal Mic failure...?

  1. #1

    AUDIO board internal Mic failure...?


    Finally I got exactly the same type of microphone, which is shown on the pages of the Audio Shield at

    I soldered the microphone onto the board and wanted to do a quick check, whether the microphone "is online" .

    For that, the "Recorder" example sketch was taken and freed from all unecessary stuff (since I have no reliable
    SDcard interaction still).
    I prints all bytes in the data buffer via the serial monitor.
    Or at should...

    Unfortunately I can't find the bug...either the microphone is demaged (optical check of the soldering is ok) or...the sketch
    is buggy:

    // Record sound as raw data to a SD card, and play it back.
    // Requires the audio shield:
    // Three pushbuttons need to be connected:
    //   Record Button: pin 0 to GND
    //   Stop Button:   pin 1 to GND
    //   Play Button:   pin 2 to GND
    // This example code is in the public domain.
    #include <Bounce.h>
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    // GUItool: begin automatically generated code
    AudioInputI2S            i2s2;           //xy=105,63
    AudioAnalyzePeak         peak1;          //xy=278,108
    AudioRecordQueue         queue1;         //xy=281,63
    AudioPlaySdRaw           playRaw1;       //xy=302,157
    AudioOutputI2S           i2s1;           //xy=470,120
    AudioConnection          patchCord1(i2s2, 0, queue1, 0);
    AudioConnection          patchCord2(i2s2, 0, peak1, 0);
    AudioConnection          patchCord3(playRaw1, 0, i2s1, 0);
    AudioConnection          patchCord4(playRaw1, 0, i2s1, 1);
    AudioControlSGTL5000     sgtl5000_1;     //xy=265,212
    // GUItool: end automatically generated code
    // For a stereo recording version, see this forum thread:
    // A much more advanced sound recording and data logging project:
    // which input on the audio shield will be used?
    //const int myInput = AUDIO_INPUT_LINEIN;
    const int myInput = AUDIO_INPUT_MIC;
    // Remember which mode we're doing
    int mode = 1;  // 0=stopped, 1=recording, 2=playing
    void setup() {
      // Audio connections require memory, and the record queue
      // uses this memory to buffer incoming audio.
      // Enable the audio shield, select input, and enable output
    void loop() {
      // If we're playing or recording, carry on...
      if (mode == 1) {
      // when using a microphone, continuously adjust gain
      if (myInput == AUDIO_INPUT_MIC) adjustMicLevel();
    void startRecording() {
    void continueRecording() {
      if (queue1.available() >= 2) {
        byte buffer[512];
        // Fetch 2 blocks from the audio library and copy
        // into a 512 byte buffer.  The Arduino SD library
        // is most efficient when full 512 byte sector size
        // writes are used.
        memcpy(buffer, queue1.readBuffer(), 256);
        memcpy(buffer+256, queue1.readBuffer(), 256);
        int i;
        for( i=0 ; i< 512 ; i++ ) {
          Serial.print( buffer[i], HEX );
    void stopRecording() {
       mode = 0;
    void startPlaying() {
      mode = 2;
    void continuePlaying() {
      if (!playRaw1.isPlaying()) {
        mode = 0;
    void stopPlaying() {
      mode = 0;
    void adjustMicLevel() {
      // TODO: read the peak1 object and adjust sgtl5000_1.micGain()
      // if anyone gets this working, please submit a github pull request :-)
    Is there anything, which I should program differently so the microphone can be read?

    Thanks a lot for any help in advance!

  2. #2

    in the audio tutorial I found the "Mic Check" sketch, which works for me and proofs, that the mic is working!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts