Using Wio Terminal microphone with Edge Impulse

I would like to use the microphone for keyword spotting using Edge Impulse to build the model. I see that the accelerometers and gas sensor have been implemented. Is there any support available for the microphone?. Will there be any issues using it with DMA?

Ralph

Sorry, the microphone on the device does not have the recording function, it can only be used to check whether there is sound, which is decided by the hardware design.

I apologize for responding to an old thread, but I wanted to add a solution here in case anyone reads this looking to do keyword spotting with Wio Terminal and Edge Impulse. As @Baozhu mentions, the internal microphone appears to be configured to only sample levels rather than the actual sound. When I tried sampling it at 16 kHz, I found that I got ADC values between 0 and 1024 (less than the 12-bit values promised by the ADC).

I attached an electret microphone (with amplifier) to pin 13 on the Wio Terminal (A0, PB08). With that I was able to set up a DMA (thanks to help from MartinL on the Arduino forums) to sample from the ADC. That filled up a buffer for the Edge Impulse inference library.

Code for this can be found here: https://github.com/ShawnHymel/ei-keyword-spotting/blob/master/embedded-demos/arduino/wio-terminal/wio-terminal.ino

I created a video showing it in action here: https://www.youtube.com/watch?v=a_osS0VdkzE

Hope that helps!

2 Likes

A microphone on Wio Terminal is certainly a mystery. Originally the hardware engineers told me the same thing, that it can only be used for measuring sound levels. I tried FFT demo and found that after adjusting the gain level to 7, the results were satisfactory (FFT displaying proper frequencies in response to sound played near Wio Terminal). So I started digging and put up a sketch for recording sound as .wav file to SD card with 8 kHZ sampling rate and 8 bit audio depth. That allowed me to create a beta version of Edge Impulse firmware with Built-in microphone enabled, which you can find here


and the video with article about creating Audio scene recognition

The audio quality will be improved in later versions of firmware. So far I have tested the recording with 16 kHz and 16 bit (rescaled from ADC maximum 12 bit) audio depth .

So, all in all, while microphone on Wio Terminal is not a professional recording microphone-grade (it does have a strong DC component, which can be partially rectified by using a filter), it is certainly suitable for audio recording/processing. Once I’m done with new Edge Impulse firmware (16 kHz 16 bit), I’ll publish the link here.

1 Like

Here is a sample and recording sketch for 16 kHZ, 16 bit

1 Like