Connecting a microphone to a microcontroller board port
In this section, we are going to learn about the hardware components needed to build a clap switch using the STM32 Blue Pill and the microphone FC-04 module.
However, before we begin connecting the components, we must understand the basics of a microphone.
Understanding the electret microphone module
A clap switch uses a microphone to sense the environment while waiting for an event that will trigger an action. In this section, we will understand how to apply this functionality in a project.
We will use a generic microphone module, which is a breakout board with an electret condenser microphone (as shown in Figure 7.2):
Condenser microphones are composed of a diaphragm membrane on a plate, and both are conductors. Condensers are essentially capacitors formed of conductors and insulation between them. Therefore, when there is a smaller distance...