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

    M5StickC or M5StickC PLUS microphone basic example not working [Solved]

    M5 Stick/StickC
    3
    10
    11.4k
    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.
    • M
      miamifish
      last edited by miamifish

      Hi, I am new to the M5stickc eco system. Wanted to try some experiments with the built-in microphone. Tried to run the example provided with M5Stickc->Basic->Microphone. Compiles and runs. I can see "Mic Test" on tft. But it doesn't do anything past that. Interestingly the M5Stickc->Basic->FactoryTest is the only microphone example that works and shows the wave form on the tft screen. I have tried both M5stickc and M5stickcplus. Can someone please provide any thoughts on what I am doing wrong? Please see video of my test in this attached link.
      YouTube Link

      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by

        You will be lucky to get a response at the moment due to the Chinese New Year.
        @felmue do you have any experience with the Stick C mics and Arduino?
        Have you tried comparing the microphone code between the two? it could be that something has changed and the code has not been updated.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0
        • felmueF
          felmue
          last edited by felmue

          Hello guys

          I quickly had a look, but I couldn't spot the reason why the example doesn't work. Sorry.
          But since the factory test code works maybe you could try to extract the necessary microphone code from there?

          Edit: Just had another look using M5StickCPlus and the fix is quite easy. The gain factor needs to be upped to 30 (from 3) like this:

          #define GAIN_FACTOR 30
          

          and if you compile for arduino-esp32 version 2.x.x you also need to add this line:

          pin_config.mck_io_num = GPIO_NUM_0;
          

          to the pin config.

          Thanks
          Felix

          GPIO translation table M5Stack / M5Core2
          Information about various M5Stack products.
          Code examples

          ajb2k3A 1 Reply Last reply Reply Quote 1
          • M
            miamifish
            last edited by

            Thank you Felix & ajb2k3! I tried to run it using the above changes and the example runs so well on M5stickc Plus. Is it possible to print the values using the Arduino IDE's serial plotter? I tried it like this, but it is not a clean wave ....!! There seems to be an offset in the signal? Thank you so much for saving the day!

            0_1643402786324_Mic_Plotting.jpg 0_1643402799357_Mic_Offset.jpg

            1 Reply Last reply Reply Quote 1
            • M
              miamifish
              last edited by

              Sorry here is print code -
              0_1643402932626_Mic_Plotting.jpg

              1 Reply Last reply Reply Quote 0
              • ajb2k3A
                ajb2k3 @felmue
                last edited by

                @felmue said in M5StickC or M5StickC PLUS microphone basic example not working:

                Hello guys

                I quickly had a look, but I couldn't spot the reason why the example doesn't work. Sorry.
                But since the factory test code works maybe you could try to extract the necessary microphone code from there?

                Edit: Just had another look using M5StickCPlus and the fix is quite easy. The gain factor needs to be upped to 30 (from 3) like this:

                #define GAIN_FACTOR 30
                

                and if you compile for arduino-esp32 version 2.x.x you also need to add this line:

                pin_config.mck_io_num = GPIO_NUM_0;
                

                to the pin config.

                Thanks
                Felix

                Thanks @felmue I thought you may be able to solve this one and give the solutions.

                UIFlow, so easy an adult can learn it!
                If I don't know it, be patient!
                I've ether not learned it or am too drunk to remember it!
                Author of the WIP UIFlow Handbook!
                M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                1 Reply Last reply Reply Quote 0
                • felmueF
                  felmue
                  last edited by

                  Hello @miamifish

                  w/o trying it myself one thing that seems wrong to me is the fact that in every loop about READ_LEN (=512) samples are read from the microphone but at the same time you plot about 1000 samples...

                  Thanks
                  Felix

                  GPIO translation table M5Stack / M5Core2
                  Information about various M5Stack products.
                  Code examples

                  M 2 Replies Last reply Reply Quote 0
                  • M
                    miamifish @felmue
                    last edited by miamifish

                    This post is deleted!
                    M 1 Reply Last reply Reply Quote 0
                    • M
                      miamifish @miamifish
                      last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • M
                        miamifish @felmue
                        last edited by miamifish

                        Thank you to @felmue . The original issue I posted was resolved. We can close this post for basic microphone example works just fine after @felmue's suggestions. I will open a separate thread for the issue with regards to microphone offset in M5stickcPlus.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post