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



  • 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



  • 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.



  • 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



  • 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



  • Sorry here is print code -
    0_1643402932626_Mic_Plotting.jpg



  • @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.



  • 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



  • This post is deleted!


  • This post is deleted!


  • 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.