+91-7834999925       contact@tacthub.in

Audio Frequency Detector

This project uses a sound detection module and detects the highest frequency sound to display it.

Hardware Required

Arduino Uno

Sound Detection Module

Breadboard                                

USB-A to B Cable                             

Jumper wires

 

Software Required

Arduino IDE


Develop your cicruit by makingt the connections as shown in the above figure.

Code

#include"arduinoFFT.h"

#define SAMPLES 128             
#define SAMPLING_FREQUENCY 2048 

arduinoFFTFFT=arduinoFFT();

unsignedint S_Period;
unsignedlong microSec;

doublevReal[SAMPLES];
doublevImag[SAMPLES];

voidsetup()
{
    Serial.begin(115200);//Baud rate for module is 115200
   S_Period=round(1000000*(1.0/SAMPLING_FREQUENCY));//Period in microseconds 

}

voidloop()
 
    for(inti=0;i<SAMPLES;i++)
    {
        microSec=micros();   
     
        vReal[i]=analogRead(0);//Reads the value from analog pin A0
        vImag[i]=0;//imag term is to be 0

        while(micros()<(microSeconds+samplingPeriod))
        {
          //do nothing, just a delay
        }
    }

    /*FFT Samp0ling*/
    FFT.Windowing(vReal,SAMPLES,FFT_WIN_TYP_HAMMING,FFT_FORWARD);
    FFT.Compute(vReal,vImag,SAMPLES,FFT_FORWARD);
    FFT.ComplexToMagnitude(vReal,vImag,SAMPLES);
 
    /*Peak Frequency Detection*/
    doublepeak=FFT.MajorPeak(vReal,SAMPLES,SAMPLING_FREQUENCY);
    Serial.println(peak);     //Printing the result
    while(1);
}

Price: 7000 INR

Buy Now