Can I meassure somehow the frequency of a sound wave

Hey,

I'm new to Arduino and want to learn it based on projects. I thought about making a frequency meter. Well frequency is declared as number of waves per second.

So how do I get the number of waves. .

I thought I could use somehow the red sound sensor in the elegoo kit to get sound waves when speaking for example. Well I am kinda stuck. I also read something about FFT. I read a lot online and I am really confused, because some people tell you you can't do things like that with the sound sensor, but don't say how to do it otherwise and other people say it works if you know how to convert voltage, which you get from the sound module into frequency.

Can someone give me some advice which components to use, so I could read into it?

Have a wonderful sunny day and stay healthy :slight_smile:

Sorry for my bad English

Perhaps an internet search on the words 'arduino frequency counter library' might get you to see the code of how others have done such things?

Idahowalker:
Perhaps an internet search on the words 'arduino frequency counter library' might get you to see the code of how others have done such things?

But I don't want to use a library.

I thought if I could somehow get the number of waves in a specific time I could easily calculate the frequency.

I wanted to use a library if nothing else work...

Its a lot harder than you seem to think. There are issues of harmonics, noise, variations over time. If you have only a pure note at constant amplitude its a lot easier to determine a frequency and even zero-crossing counting
will work fairly well.

In particular speech is made almost entirely of harmonics and noise, has a constantly varying frequency and
requires more advanced techniques to pull out the formant data than just FFT analysis

Do you have an oscilloscope? And a function generator, perhaps? I think a detailed study of the characteristics of a single waveform would prove useful. Before getting to the Arduino side of things you will certainly need to process the signal to eliminate noise, harmonics etc. This is very straightforward and well documented using small signal transistors, capacitors (low frequency filtering) and chokes (inductors; high frequency filtering). Once your signal is neat and tidy writing a function to count every time the signal passes a voltage threshold will reveal the frequency.

You have chosen two interesting topics. I recommend you look at them separately.

If you would like to learn about Arduino, start with something simpler. There are plenty of other things you can do with an Arduino. You did not tell us what expertise you have in electronics and C/C++ programming, so it is hard to give you advise where to start.

The FFT algorithm requires you to multiply a lot of numbers and add them all together. 8-bit Arduino's where not build for that.

The Arduino Nano 33 IoT uses an ARM Cortex-M0+ processor which can do some computation.
The Arduino Nano 33 BLE uses an ARM Cortex-M4 processor which has special DSP instruction making signal processing algorithms run a lot faster.
The Arduino Portenta H7 uses a dual Cortex-M7 processor which is even better at DSP algorithms.

There is a CMSIS-DSP library which provides the base functions for FFT and other signal processing algorithms, but I do not know what the integration into mbedOS looks like. The Nano 33 BLE and Portenta use mbedOS.

If you do not have expert knowledge of FFT and the underlying math you will not be able to do this without a library. CMSIS-DSP has been written by DSP experts and is licensed free from ARM. Its source code, so plenty of opportunity to learn.

If you are more interested to build your FFT or digital signal processing skills first I recommend you start with the inverse and look at generation of signals from sin waves. You can do this in Excel or Mathematica (free on Raspberry Pi). Both have FFT functions build in. This would allow you to create a couple of frequencies add them all together and then use the FFT and see whether this all works as expected.
I also recommend you watch a couple of Youtube videos on the subjects. There is everything from introduction to university lectures available.