Hi! In this project we will try to get sound by using microphone (external not onboard microphone) and play it through speaker. This tutorial will be very short as I will give explanations of project parts by reference to some videos. So, let's jump into the project :)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Software and Hardware Requirements
- STM32F4 discovery board (or any other STM32F4 board)
- MAX9814 electret microphone with amplifier
- PAM8403 audio amplifier module
- 4 OHM speaker
- Keil uVision5
Step 2: Determine Project Plan
So, let's understand first what we want to do. First, we want to get sound from electret microphone. As you know, MCU process everything digitally. However, sound is analog signal. So, we need to convert it to digital signal and this is done by ADC (analog to digital converter) and the process is called sampling. You can search for more information. Here there is one important point: In order to get sound from the speaker appropriately, sampling frequency should be at least two times higher than audio frequency at the output. This is called Nyquist-Shannon theorem.
After converting it to digital signal we can process it as we want and then output that sound again. However, speaker needs analog signal. So, we need convert this digital signal to analog back. For that we will use DAC (digital to analog converter). At the end we can output that sound :)
Step 3: How to Setup and Implement ADC and DAC With DMA
Step 4: Out to Speaker
After doing all the steps, you need to connect the speaker as the image above. After that, play sound on your phone and decrease sound down to the limit which you can hear hardly. Then, take phone near to the microphone and you will hear sound from the speaker loudly. Don't speak to microphone, because it will be hard to catch whether there is output from speaker or not :)
Step 5: Conclusion
So, we have reached end of the project. If you have any question or problem please don't hesitate to ask :)