Librarian FFT.h LED blinks when sound is 80HZ to 300Hz

image

Good morning, I need help with the FFT.h library
I need to build a code, when the sound module captures sounds between frequencies from 80hz to 300hz, an LED flashes. I saw some projects with this library, where some are frequency detectors, would it be possible??

You may find it easier to use a band pass filter and you probably won't need a microcontroller.

https://www.electronics-tutorials.ws/filter/filter_4.html

That should be possible if the sound is loud enough and not drowned-out by other sounds/noises.

There are a couple of different kinds of microphone boards. Make sure to get one that puts-out amplified analog audio (it's the most common kind).

Before playing around with FFT, run the Analog Read Serial Example with the sound sensor instead of a pot, and take out the delay().

With silence you should read about half of the ADC range (about 512 on an Arduino with a 10-bit ADC). Then the louder the sound, the more the readings should deviate above & below the mid-reading. Even with a constantly-loud tone you'll get "random looking" readings because you are sampling a waveform, but you should be able to tell the difference between loud & quiet sounds.

...With FFT and a constant tone, the data won't "look random" because it's analyzing the signal. The 512 "bias" is DC (zero Hz) so if it shows-up it will be in the zero-Hz bin, and in any case it won't affect the 80-300Hz readings.

It's also a good idea to make some test-tones with, which you an do with Audacity. You'll probably want to at-least make one somewhere around the middle between 80 & 300Hz, and one above and one below.

...I've never used FFT (or FHT which is "similar") but the results are in "bins" (frequency ranges) and every time though the loop the data will be updated. The number of bins (frequency resolution or the frequency-range of one bin) depends on the sample rate and the length/size of the FFT sample.

The library may allow you to combine bins at the higher frequencies, or it may do that automatically... I'm not sure... That's often done because, for example, a 100Hz difference at 100Hz is "relatively bigger" than a 100Hz difference at 10kHz.

P.S.
If you want to analyze an electrical signal instead of the sound in the room (a headphone output, etc.) there are ways of doing that, and it usually works better without room noises.

goodnight, Thank you very much for your support and help. I will explain to you how the system will work This range that I placed from 80Hz to 300Hz is exactly the frequency range of the human voice, meaning men 100Hz, women 200Hz and children 300Hz. In my research I saw that winds have a frequency lower than 30Hz Could you take a look at this project, where a sound frequency detector was made. If possible, could you give me an idea of ​​how I can do this code to flash an LED when sound is detected at that frequency? Follow the link to the project I told you about

The projecthub article linked above in post #4 is a complete waste of time, not the least because it makes only one very short pass, then stops listening until you reset the Arduino.

There are plenty of audio spectrum display projects posted that use the FFT, but sensibly, and some even display the result on an LED matrix.

You don't need the FFT, though. The MSGEQ7 chip does the frequency discrimination in seven bands, one of them around 160 Hz.

1 Like

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