🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5StickcCPlus: Microphone not working

    Scheduled Pinned Locked Moved M5 Stick/StickC
    1 Posts 1 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      Ange Cyrile Nouthogbe
      last edited by

      Hello everyone,
      It's been 2 weeks I'm trying to configure the microphone on M5stickCplus 1.1

      Here is the sample code I'm using
      I believe that the module has a built-in microphone.

      As output of this code, only 0 is displayed.

      Can someone please help me out 🙏?

      
      #include <M5StickCPlus.h>
      #include <driver/i2s.h>
      
      #define SAMPLE_RATE 16000
      #define SAMPLES 256
      
      void setup() {
        M5.begin();
        Serial.begin(115200);
      
        // I2S config
        i2s_config_t i2s_config = {
            .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
            .sample_rate = SAMPLE_RATE,
            .bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
            .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
            .communication_format = I2S_COMM_FORMAT_I2S,
            .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
            .dma_buf_count = 8,
            .dma_buf_len = 64,
            .use_apll = false,
        };
      
        i2s_pin_config_t pin_config = {
            .bck_io_num = 0,
            .ws_io_num = 34,
            .data_out_num = I2S_PIN_NO_CHANGE,
            .data_in_num = 32
        };
      
        i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
        i2s_set_pin(I2S_NUM_0, &pin_config);
      
        Serial.println("Mic test started...");
      }
      
      void loop() {
        int16_t buffer[SAMPLES];
        size_t bytesRead;
        i2s_read(I2S_NUM_0, (char *)buffer, SAMPLES * sizeof(int16_t), &bytesRead, portMAX_DELAY);
      
        // Print a few samples
        for (int i = 0; i < 10; i++) {
          Serial.println(buffer[i]);
        }
      
        delay(500);
      }
      
      
      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post