I'm trying to use this SPW2430 sensor to listen to audio and use the FFT library to output the most dominant frequency. I followed this project with the only difference being the sensor I used. Its not reliably outputting the expected value. Ive used guitar strings, frequency generating apps on my phone/computer, and a piano and each one gives a different number way outside of what I would expect error to be.
I know I've properly set up the Arduino connections to the microphone. Do I have a misunderstanding of how this code should be working? Is the sensor I'm using not appropriate for this kind of project? Or is there something else I've missed entirely?
My wishes for this project are to be able to detect a "whirring" sound every so often. If perfect accuracy is impossible with these sensors, then would anyone have any suggestions on how to do that in real time, using FFT or some other means?
and use the FFT library to output the most dominant frequency.
Well an FFT is not the best thing to do that especially on a small processor like an Arduino.
An FFT will put the frequencies into bins, that is a range of frequencies will all end up in the same single reading. The more samples you have the finer the bins will be but the more time and memory it takes to do this.
There are better ways of looking for specific frequencies like auto correlation.
Grumpy_Mike:
There are better ways of looking for specific frequencies like auto correlation.
From what I've read and understood, I would need to have some sample or expected frequency to use with autocorrelation? I won't be able to predict the exact frequency of the whirring noise, but its noticeable enough to differentiate it from ambient noise.
Grumpy_Mike:
Do you know the signal to noise ratio you are working with?
No, I dont think its feasible to calculate for this project. Thanks for all of your help so far.
I dont know how well I've explained what I'm trying to do, or maybe I dont understand the limitations. If I wanted to use sound to measure when a power drill is turned on, solely by the sound it makes, how would you recommend going about that?
Again this depends on the signal to noise ratio. With a simple Envelope follower that will will be easy if your input only contains your wanted sound.
However, with a sound within an environment with other sounds It is a lot more difficult. Maybe the best approach is a neural network approach that you can do with a BLE 33 sense Arduino. These can be trained to spot words or sounds in the presence of other sounds but it is experimental at the moment. But search for tensorflow for an idea of what can be done.