Arduino UNO Audio Recorder / Playback

I like to push the limits of the ATMega328P micro controller used in the Arduino UNO.
I had an idea to build a device that would record audio and then play it back. Something to amuse the grand kids, press the start button, say something, press the stop button and the recorded audio would play back to them.
I wanted to use the ATMEga328P; and yes I know this is not new, and yes there are many devices that do just this, cheaply and accurately. Anyway … the record side works well, the audio output no so. This will discuss only the record side.

My circuit uses :-
Electret Microphone Amplifier - MAX9814 (SKU: ADA1713I)
MicroSD card breakout board (SKU: ADA254)

The code digitizes audio at 22191Hz and saves it to the SD card as a .wav file. It allows up to 100 different files to be recorded. Replaying the .wav files on a PC produces a good quality representation of what was recorded. I am happy with the way this part works.

I thought I would put this here for others who may be interested in a similar project.
Yes, the UNO can be used to record Audio, accurately and reliably.

I am happy to share the code if anyone asks. It is modification of code from :-
APC magazine - Arduino Masterclass
Project #18 - Digital Audio Recorder v2.0
Darren Yates - 11 April 2014

Hi James,

I think we can all understand wanting to make something your own way even though a product might exist that does it :slight_smile:

I’d like to see the code that you used to record audio using the UNO. Here is a simple tutorial where .wav files are played back from the Arduino Uno:

Maybe this could help with the second half!

Thanks for the link Stephen. Sorry for the slow response.

I have been looking closer at the TMRpcm.h library with respect to playback.

Initially I rejected the library because the Recording Example would not compile. At the time I was focused on the recording part more than the play back. I found the APC article and ran with that. Also I did not understand the registers as much as I do now, having built my own record routine.

I can get my recorded wave files to playback, but the quality is terrible. The example from the link seems to produce reasonable audio. So I intend to look further into the TMRpcm.h librabry and what is happening with my code, it might be something basic I have missed.


1 Like

Update: Schematic change. The reference diode should be reverse biased and the symbol used is incorrect.

The title of this post should now be “Arduino UNO Audio Recorder / Playback”. I have solved the problem of poor quality audio output. The ADC was set to sample at 8KHz. Changed that to 15625Hz. Audio output is now reasonable, considering …
Also the carrier rate was not an exact multiple of the sample rate. This meant the pulse width of the last cycle of the carrier was cut short, resulting in frequencies not in the original. This problem had a much lower effect than upping the sample rate.
The UNO now records audio to an SD file in .wav format and reproduces it correctly. Audacity & Groove music play the audio correctly from the .wav file.

I now am confident to build this device and test it on the grand kids. Once done I will submit it as a project.


1 Like

Glad to hear you got the kinks ironed out James! I wouldn’t expect very good quality out of a 10bit ADC, it sounds like your wringing everything possible out of the system :slight_smile:

I’m looking forward to seeing the finished project!

Updated the image to show my final circuit.
The device records audio, saves to the SD Card, and replays the audio.
Quality is what you would expect with the ATMega328P, but is not distorted like before.

Intend to write this up as a Project and submit it, along with the code. Now that I have built the device.
I am happy with the end result.

Glad to hear it James! I look forward to seeing your write-up!

Grand kids come over today. 5 year loved this device. He ran around recording everything and playing it back.
Ran fine with just a 400mAH battery for the time he was using it.

1 Like