Introduction: Arduino Nano Voice Recorder With the MAX9814 Microphone
I got a MAX9814 microphone from AZ delivery on Amazon and wanted to test the device out. Therefore, I created this simple project built on Great Scott's Spy Bug (published under this creative commons licence). I modified the projects structure quite a bit to improve efficiency and add a few new features. This is my first Instructables project so it will not be perfect but I've willing to learn and open to advice.
Test results from the microphone with different gains are added at the end so if you only want to compare the quality of 40dB, 50dB and 60dB gains you can skip to there.
I hope this project will be useful for people trying to implement a microphone into their project. I also hope to make this project as accessible to beginners as possible so I have added many comments to my code but am also happy to revise my work to add any extra clarification that would be helpful. The wiring is very beginner friendly but implementing the software is a bit trickier.
View all the project files and suggest improvements to my code on my GitHub repository.
Step 1: Circuit and Explaination of Device
I customised my circuit to work with the Arduino Nano device, but you can run your circuit on different Arduino devices by editing the pin numbers at the top of my code (next section). To set up the circuit on your device search "Arduino [Your model] pinout" and there should be many images which illustrate what functions each pin can perform (e.g. Analog Input, SS, MOSI etc). Most devices also come with labelled pins. I drew this schematic using the EasyEDA editor but created it using a solderless breadboard as I wanted to create this as quickly as possible and wanted to quickly reconfigure the layout.
Step 2: Programming
I wrote some simple code for recording the audio on the device. I used Great Scott's code as inspiration but used changed the structure to increase efficiency and simplicity. I also removed the restrictions on the number of files that could be recorded and added more comments which should help beginners to navigate. Download the finished code below and open it using the Arduino IDE. Download the required modules ("SD.h”, "SPI.h" and "TMRpcm.h") using the Arduino Package manager (shown in the images above).
Recording to a WAV file on an SD card is an advanced feature of the TMRpcm library so to use it you must edit the configuration file of the library. While this sounds daunting (it did for me at least) it is only searching for the "pcmConfig.h" file using file explorer and uncommenting a few lines of code (then saving it).
- On Uno or non-mega boards uncomment the line #define buffSize 128
- Also uncomment #define ENABLE_RECORDING and #define BLOCK_COUNT 10000UL
Once complete return to the Arduino IDE, plug in your Arduino, select it, and then compile and upload the program. Opening the Serial monitor will also give you some feedback during run time.
Step 3: Finished Project and Testing
When I had finished the wiring and debugging, I tested the project.
WARNING restarting the device will reset the filename counter causing new files to overwrite old files.
To use the device:
- plug a USB power lead into the Arduino
- press the tactile button to start the recording (the LED will light up to indicate this)
- press the button again to end recording
- repeat for as many recordings are necessary
- disconnect the USB power cable
- Remove the SD card
- Insert the SD card into a computer or phone
- Open the files in your chosen playback application
The initial purpose of this project was to test the MAX9814 microphone, so I conducted three tests to find out the effect its inbuilt amplifier had on the result. While producing the recordings I used one of Mozart’s symphony's as a control variable. I played it on my phone's speaker which I kept pointed at the microphone at a constant distance for all three recordings. The only variable I changed was the gain of the microphone (adjusted by connecting it to VCC, GND or leaving it floating). The resulting audio clips are attached. I also combined the 40dB and the 60dB audio into a single recording in which the 40dB is played in the left ear and the 60dB is played in the right ear. This makes the difference in quality very noticeable and highlights how important the gain provided by the MAX9814 module is.
Overall, I was incredibly pleased with the recording results especially as the setup for the device is one of the simplest, I've seen (with only three wires and no external components - even a simple LED requires a resistor). It also must be taken into account that the Arduino Nano has a 10bit ADC so any amplitude reading can only be one of 1024 discrete values. Due to its good audio quality, compact size, and negligible power consumption; I hope to use the device in future projects.
If I have not went into enough detail, I would be more than happy to help and add extra clarification. This is my first Instructables so any advice I am given now can be reflected in all my projects to come. If you have any suggestions to improve my codes, I'd be happy to add them to my project on GitHub and this Instructables.
Participated in the
Battery Powered Contest