Skip to main content

Detect Audio through the Microphone on STM32U5 Board

AVH includes support for connecting your computer's microphone to virtual devices. This article will demonstrate how to detect audio using the virtual STM32U5 board.

Build the ADF_AudioSoundDetector Firmware File

Follow this process to build the required .elf custom firmware files using the free STM32CubeIDE tool from STMicroelectronics.

  1. Install the STM32CubeIDE tool. In our example, we will use the MacOS version.

    Download CubeIDE

  2. On the top menu, click Help then Check for Target Selector Device Database Updates.

    Check for updates

  3. On the popup window click REFRESH. Your project files will update.

    Refresh button

  4. Create a new project by clicking New then STM32 Project from the File menu.

    New project screen

  5. Click on Example Selector.

    Target selection

  6. Set the Name to ADF_AudioSoundDetector, click on the ADF_AudioSoundDetector example to the right, and click Next.

    ADF_AudioSoundDetector example

  7. Click Finish to create the project.

    Finish project setup

  8. In the Project Explorer window, right-click on the ADF_AudioSoundDetector project and choose Build Project.

    Build project

  9. The default path for your firmware file is:~/STM32CubeIDE/workspace_1.0.1/ADF_AudioSoundDetector/STM32CubeIDE/Debug/ADF_AudioSoundDetector.elf.

    ls ~/STM32CubeIDE/workspace_1.10.1/ADF_AudioSoundDetector/STM32CubeIDE/Debug/*.el

    .elf File

  10. Proceed to the next section to boot the custom firmware file.

Boot the Custom Firmware and Detect Audio

Follow this process to boot the custom firmware and detect audio:

  1. Log in to the AVH platform and click CREATE DEVICE.

    Create device

  2. Click on the STM32U5 device.

    Select device

  3. Upload your ADF_AudioSoundDetector.elf custom firmware file click NEXT, then choose CREATE DEVICE.

    Upload firmware

  4. After your device boots, open the Sensors tab and enable the microphone.

    Enable microphone

  5. Confirm on your browser that you would like to share the microphone.

    Share microphone with browser

  6. The device should begin automatically detecting sound. You will see LED #2 lighting green to indicate audio is detected.

    Audio detection