Record audio with high sample rate

Hi guys,

I want to record audio data from an Arduino Nano with high sampling frequency and would like to ask you guys what is the best way to do it. In the interface alone there are several options, microphones with I2C, I2S or SPI interface or even with an analog input.
In my application I need to detect frequencies up to 500 Hz and very precisely. Therefore, a high sampling rate is required to get good data from the FFT. Has anyone worked with something like this and can give me some advice on which microphone and interface is best?
I am really grateful for any suggestions :slight_smile:

I am missing something if it is coming from the Nano you should already have it in digital form. If not post an annotated schematic showing exactly how this is to be wired.

The classic Arduino Nano ?
I suggest to use a I2S microphone and a board that can deal with I2S and preferably have DSP posibilities.

The Arduino Nano can do FFT with a microphone, but only barely.

The Teensy boards are compatible with the Arduino software layer. There are libraries for audio with Teensy boards: https://www.pjrc.com/teensy/td_libs_Audio.html

The classic Nano does not have the speed or memory to handle audio at high sampling frequency.

If all you want to do is detect 500 Hz, that requires sample rates of 1 kHz or higher and you don't need to record much data. The default sample rate on the classic Nano is 9.6 kHz.

The Goetzel tone detector algorithm requires only a small memory buffer.

What is the source of these "audio frequencies up to 500 Hz" and how precisely do you wish to detect frequencies?

I ask this because 500 Hz isn't particularly high frequency for what one would normally consider "audio" and even sampling at several times that rate is easily achieved with "analogRead()" and a suitably amplified electret microphone.

Oh sorry, the audio is not recorded from the nano directly. I have the classic Arduino Nano without a built in microphone.

Yes, a classic Arduino Nano. I also thought that I2S microphones could be fine for this. Can a classic Nano work with that interface?
I am not out of speed, I just need to record 512 samples and do a FFT of this. I think a nano should handle that.

I am building a guitar tuner and it would be great to detect frequencies with 1 Hz resolution. I am currently testing it with an analog microphone and it is working but for now it has trouble detecting low frequencies and I need to play loud also :smiley:

The classic Nano has no I2S interface.
512 samples at which frequency ?

The ATmega328P microcontroller on the classic Arduino Nano is very optimized for high speed input and output. It is possible to take analog samples with a timer interrupt (in software). There are no DMA channels and the Arduino layer is slow. The Arduino analogRead() is even slower.
Because of that, there is no perfect sampling interval, even if you go beyond the Arduino layer and use the possibilities of the chip.

I think that it starts with a good microphone. Some microphones do not record low frequencies on purpose (such as noise-canceling microphones).

By the way, we use the common "REPLY" button at the bottom. Answering to a post does not really work well. You can reply to a sentence by selecting that sentence with your mouse and then click "Quote" (that will pop up, try it).

Alright thanks.

But is there no way to "create" an I2S interface via digital IOs on the nano?

I meant that I just record 512 values from the microphone and then process them. The microphone is recording signals which contain frequencies from 50 to 500 Hz. But to look for an analog microphone that is optimized in this spectrum is a good hint.

This is a nice little device for recording and playback Overview | Adafruit VS1053 MP3/AAC/Ogg/MIDI/WAV Codec Breakout Tutorial | Adafruit Learning System

There are many variations of this breakout just search for vs1053, I have not used a mic with one of these but I can tell you it plays back mp3 files with really good sound quality.

Have you thought of getting some audio out of the pickup (I think you have one). Lows are hard to get with the small diaphragm microphones. Hopefully this helps.

Very popular project! The search phrase "arduino guitar tuner" turns up a large collection of tutorials, hardware suggestions and code.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.