My Weekend Project: Audio Frequency Detector Using An Arduino

Поделиться
HTML-код
  • Опубликовано: 13 июл 2024
  • This Arduino project displays the approximate frequency of the loudest sound detected by a sound detection module. For this project, the analog output from the
    sound module detector sends the analog audio signal detected to A0 of the Arduino Uno. The analog signal is sampled and quantized (digitized). A Fast Fourier Transform (FFT) is then performed on the digitized data. The FFT converts the digital data from the approximate discrete-time domain result. The maximum frequency of the approximate discrete-time domain result is then determined and displayed via the Arduino IDE Serial Monitor.
    Schematics and code available for free at: clydelettsome.com/blog/2019/1...
    Also see my second project a Musical Note Detector: • My Weekend Project: Mu...
    If you have questions, please visit clydelettsome.com/blog/ask-th... .
  • НаукаНаука

Комментарии • 135

  • @weaq9370
    @weaq9370 8 месяцев назад

    THIS IS INSANE CLYDE LETTSOME!!!!!!!! LOVE FROM NORWAY

  • @Airsoftguns345
    @Airsoftguns345 4 года назад +4

    The one video I have been looking for 🙏 you sir are a life saver

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      You are welcome. Please like, share and subscribe.

  • @gaznevi
    @gaznevi Год назад +9

    If you don't want hardware reset, you should delete the while (1) line and if you want the time delay add delay(1000); (1sec) or something else.

  • @brocksamson8634
    @brocksamson8634 17 дней назад

    This is awesome

  • @youroldmangaming8150
    @youroldmangaming8150 3 года назад +1

    Nice clear explanation, thank you.

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Glad it was helpful!
      Please like, share, and subscribe.

  • @rafaellopesluthier4400
    @rafaellopesluthier4400 3 года назад +1

    awsome, i was in doubt about this sensor, now i´ll buy one for sure.

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад +1

      Happy to hear the video helped.
      Please like, share and subscribe.

  • @Airsoftguns345
    @Airsoftguns345 4 года назад +1

    Subscribed, code works great!

  • @Airsoftguns345
    @Airsoftguns345 4 года назад +11

    Code works amazingly! I just ran it and saw it was using 60% of the global variable space. If you move " double vReal[SAMPLES];
    double vImag[SAMPLES];
    unsigned long microSeconds;" into the for loop, that percentage drops to 10%. I had to do this to compact things for my Junior Design project, it still works great! thanks once again

    • @fatinfarahin6836
      @fatinfarahin6836 4 года назад +3

      Where can I get the code? I already went to the website and search for it. After I check out, it send the link but I cant open it.

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      Thanks for the advice. Please like, share, and subscribe.

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад +1

      Hi Fatin,
      If you gave your correct email address when you registered on my website, I sent you an email to tell you I corrected the error. You should be able to download it from my website now. Sorry for the issue.
      CAL

    • @fatinfarahin6836
      @fatinfarahin6836 4 года назад +1

      @@CALettsomePhDPE Can it detect sound of baby crying too?

    • @ahmetdagtepe2596
      @ahmetdagtepe2596 Год назад

      @@fatinfarahin6836 bebek sesini algılayan dedektör yapabildin mi

  • @lazarosarradell
    @lazarosarradell 4 года назад +1

    Your a MASTER! Thanks a lot!

  • @BarefootBeekeeper
    @BarefootBeekeeper Год назад

    Thanks! This could be useful in a bee-related project I have in mind.

  • @prassanna369
    @prassanna369 2 года назад +2

    This is really much needed video sir. Sir, is this the resonance frequency of that tuning fork?
    Or, is there any electronic device which specially made for calculating the resonant frequency of an object?

  • @double-v3218
    @double-v3218 3 года назад +1

    It's wonderful!!!

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Thank you.
      Please like, share and subscribe.

  • @Oddzilla51
    @Oddzilla51 2 года назад +2

    Thanks for the video? What is the lowest frequency that one of these modules can register?

  • @jihyeonmin245
    @jihyeonmin245 2 года назад

    Thank you for your video.
    What should I do if the second value is not displayed after initializing the serial monitor after receiving the frequency value first?

  • @SinaAtalay
    @SinaAtalay 3 года назад +1

    Thank you so much!

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      You're welcome!
      Please share, like and subscribe.

  • @jamesgrissom9741
    @jamesgrissom9741 2 года назад +1

    Is there a way to set a frequency range for the fft? Im working on building an EEG with an arduino and i need to compute an FFT on the input signal. The issue is I need the dominant frequencies that fall within 5 different frequency ranges....

  • @plutarco8556
    @plutarco8556 6 месяцев назад

    Very nice

  • @ahmetozdemir7173
    @ahmetozdemir7173 2 года назад

    Is it possible to count a continuously changing duty cycle? For example When counting a frequency, we first turn the analog signal to the square wave. The frequency count of a regular analog signal can be considered regularly with 50% duty cycle. However, the square wave duty cycle is not regular in the count of irregular and mixed analog signals. For example, 50, 55, 43, 20, 70, 30, 3, 43, 20, 70, 30, 3, 21, 17, 35 ....... can be a duty cycle. In this case, can the frequency of an analog signal provided in this case?

  • @aliarslan2638
    @aliarslan2638 2 года назад +1

    I should get frequency data at least in every quarter of a second from my 15 seconds speech for my project and I will use this data for an immediate comparison with another dataset. So, Is this sensor usable and what is its name?

  • @motivationtech5231
    @motivationtech5231 4 года назад +1

    Nice project sir

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      Thank you! Please like, share, and subscribe.

  • @dominikschmitt1503
    @dominikschmitt1503 Год назад

    Does the FFT convert the analog signal from the sensor to Hz or from where Arduino getting the frequency in Hz?

  • @bobbamba7703
    @bobbamba7703 Год назад

    Am I right that a frequency is known first so I can change the sampling frequency(2 times the known frequency) in the code to output the same known frequency in the serial output of Arduino IDE? Or is it getting the sound and let the system(the sound sensor and arduino display the real time audio to it's equivalent frequency?) I have tested the system using frequency generator app to several frequencies and it did serial output correct frequency but need to change the sampling frequency everytime I need to verify it .
    Thanks.

  • @parthpurohit6033
    @parthpurohit6033 2 года назад

    Hi does the sensor have to be DEVMO or can I use another brand, they look identical?

  • @apatiamusic
    @apatiamusic Год назад

    Hello sir, The program codes you shared did not work on the arduino Promicro device. What do you think could be the reason for this?

  • @inferno6012
    @inferno6012 4 года назад +1

    awesome

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      Thank you. Please like, share, and subscribe.

  • @SLguitarGuy
    @SLguitarGuy 3 года назад +2

    Nice vid

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Thank you!
      Please like, share, and subscribe.

  • @MaverickTrustees
    @MaverickTrustees 3 месяца назад +5

    What was the version of the arduinoFFT library you added when you made this video, the latest version seems that it is not working

    • @gururajk9702
      @gururajk9702 Месяц назад

      same problem here, did you find a solution?

    • @centrobiomeca580
      @centrobiomeca580 Месяц назад

      @@gururajk9702 After several error_codes .... finally, it was compiled, but it doesn't work

    • @digitronix532
      @digitronix532 7 дней назад

      Install version 1.50

  • @rkjayakrishnan3997
    @rkjayakrishnan3997 4 месяца назад

    how can I get the instantaneous output received from a Arduino mic, as I do not wanna use SD, pre-loaded MP3, WAV or any other stored data. I need live IP to OP.

  • @ChronoGXay
    @ChronoGXay Месяц назад

    My OFFSETSAMPLES are all always zero (I'm really not sure why- maybe this is why my frequency results seem almost random). I'm using the same analog audio module, I've calibrated the potentiometer very well to where the sensor LED only comes on at all with so little as a finger tapping on the table, I have double-checked that my wiring is the same as in the video, and have copy-pasted the program from the website. Do I need to use an external pulldown resistor since this is an analog input? If so, what value approximately?

  • @nobod354
    @nobod354 2 месяца назад

    can you demonstrate this via a spectrum analyzer? I was hoping to see all the frequency components of a given signal

  • @randomhobby2764
    @randomhobby2764 3 года назад +1

    Will i be able to detect a frequency of a knock or tap on a table using this sensor? Or is the sound source suppose to be constantly being broadcast to detect.

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      It is better if the sond is constant.
      Please like, share and subscribe.

  • @palingebrigtsen4365
    @palingebrigtsen4365 3 года назад +4

    Great video! How would you measure the frequency with an accuracy of 0.01Hz?

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад +6

      Thank you for asking. I think you will need more precise components to do that. This video is for hobbyist and educational purposes.

  • @enGGamer98
    @enGGamer98 3 года назад +3

    Amazing!
    Can i use it detect human voices ?
    And why should reset everytime ?
    Can i make it always in detect mode ?
    Im trying to make a project for college and hope this video help me

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад +2

      Hi Aballa,
      Thank you for asking.
      It is much more difficult to do with voice and word recognition because human speech is more complicated than a note.
      The code, as written, does not loop forever. Therefore, it has to be reset. You can change that if you want.
      You cannot change it to always be in detect mode. It has to process data at some point.
      Good Luck!
      Like, Share, and Subscribe.

  • @shaunmurda4727
    @shaunmurda4727 11 месяцев назад

    The highest frequency the mic can record is around 20kHz so what happens to your circuit if a signal higher than 1024hz hits your circuit

  • @apatiamusic
    @apatiamusic Год назад

    Hello sir, how many hertz is the maximum Frequency this app can detect?

  • @mycurrents
    @mycurrents 3 года назад +1

    Hi Dr. Lettsome
    Where can I buy the actual sound detector module? I have searched on google and got many options, but I want to get the same one you are using.
    Thank you :)

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Hi,
      I added the link to the parts list on my website. clydelettsome.com/blog/2019/12/18/my-weekend-project-audio-frequency-detector-using-an-arduino/
      Please share, like and subscribe.

    • @mycurrents
      @mycurrents 3 года назад

      @@CALettsomePhDPE thank you dr.!!!

  • @Anonymous-ym6oz
    @Anonymous-ym6oz 4 года назад +1

    Hey, Thank you for such a helpful video. I tried to download the code from the website but it saves the file as a cpio archive which I can't seem to open any help would be greatly appreciated!!

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      Please try downloading again. There was an error on the site that has now been corrected.

  • @johnmaricagravio4357
    @johnmaricagravio4357 4 года назад +2

    Hello sir, may I know how to modify the code because I'm using 6 sound sensor and I need the frequency output of that 6 sound sensors simultaneously

    • @thebeat2575
      @thebeat2575 Год назад

      You can probably use interrupts on each sound sensor, but probably with a faster clocking uC like a ESP32

  • @shrekanthofficial-8540
    @shrekanthofficial-8540 Год назад

    Sir.
    could you please tell me how to write code for detecting higher frequencies(4000Hz-6000Hz)
    I have noticed that increasing the sample frequency can make it detect higher frequency, but that is an inefficient code..it is not detecting accurately (showing 6000Hz for 4000Hz) ..
    could you please let me know what changes to be made to detect higher frequencies

  • @Tina-zn1lx
    @Tina-zn1lx 3 года назад +2

    Thank you for your great video. I deleted last code 'while (1);' because I wanted to get continuous frequency data when there was more than a certain size of sound. But meaningless frequencies were printed without any sound. How can the output be reduced when there is no main sound?

    • @Dogburt_Junior
      @Dogburt_Junior 3 года назад +1

      You'd need a way to determine the amplitude of the sound, so it only acts when the sound is loud enough.

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Glad it helped! Tristan is correct. You would need to set a higher threshold so only "main sound" as you say, can be detected.
      Please like, share and subscribe.

    • @Dogburt_Junior
      @Dogburt_Junior 3 года назад +1

      @@CALettsomePhDPE I've been messing with this sensor and it seems that's it's main purpose, to detect loud noise.
      It has been struggling to read frequencies between 440hz and 55hz, those octaves have been the only ones to yield accurate results. Connected everything just like your video and getting the audio sample from my phone tuner which is correct.

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад +2

      Hi Tristan,
      You may have to make some adjustment to the code and/or adjustments to the audio sensor that you used.
      Good luck!

  • @SusanAmberBruce
    @SusanAmberBruce 3 года назад +1

    Great music and project thanks
    I kind of wish you had put the name of the music in your description

  • @davidgentzel4001
    @davidgentzel4001 3 года назад +1

    I'm using my phone to generate a frequency and the readings I'm getting aren't too accurate, what can I do to improve my results?

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад +1

      Hi David,
      Thank you for asking. I could not get my tablet to work alone either. I had to connect my tablet to pc speakers with an amplifier built in. The issue may be related to amplitude and sensor sensitivity. Try adding pc speakers. If this does not help, you may have to adjust the code.

  • @jamesgrissom9741
    @jamesgrissom9741 2 года назад +1

    Is there a way to set a frequency range for the fft?

    • @jamesgrissom9741
      @jamesgrissom9741 2 года назад

      Im working on building an EEG with an arduino and i need to compute an FFT on the input signal. The issue is I need the dominant frequencies that fall within 5 different frequency ranges....

  • @longdongsilver4719
    @longdongsilver4719 3 года назад +2

    Very interesting video. It's always a good thing to know how the FFT library works. Thank you for the clear explanations. But the method is not very accurate on an arduino. I had differences of up to 10Hz at 440Hz with a calibrated audio source.

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад +5

      Hi Longdong,
      Thank you for the comment. The results are not very very accurate. You are correct. It does work fine though for none commercial projects.
      Thanks again for the comment.

    • @ACID2BREAKS
      @ACID2BREAKS Год назад

      Are there any more accurate sensor modules out there?

    • @longdongsilver4719
      @longdongsilver4719 Год назад

      @@ACID2BREAKS Please define what you mean by "accuracy" for a microphone.

  • @medb2322
    @medb2322 2 года назад

    hello sir thanks for this video, i want to ask about the amplitude and how can I get the frequency and the amplitude at the same time

  • @01aananditasharma64
    @01aananditasharma64 4 года назад +2

    Hello sir , this is an amazing video . Could you please guide me for a project that i am trying to make ? The basic idea is that the traffic lights detect an ambulance coming it's way by detecting the frequency of the siren , and as soon as it detects it , it turns the traffic light green . But I am facing a lot of problem. Would be great if we get your guidance .

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад +2

      Hi Aanandita,
      Thanks for asking. Unfortuantely I do not teach and tutor anymore. I am working full-time as a consultant, contractor, and researcher.

    • @buvaneshkanths894
      @buvaneshkanths894 3 года назад

      Hi Sir! Did you succeed in completing your project?

  • @solardad
    @solardad 4 года назад +2

    The high frequency that you detected was 1024hz. Is this audio sensor and library able to detect higher frequencies. My project will be detecting 2000 to 3000hz. Is this doable with this sensor and library?

    • @NavodKiriwaththuduwa
      @NavodKiriwaththuduwa 3 года назад +1

      Heyy, I'm doing a project for detecting high frequency. were you able to find a method to detect higher frequencies?

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Thank you for asking. I did not try higher frequencies.

  • @christianbautch4015
    @christianbautch4015 2 года назад

    Can you also read decibels from the audio module?

    • @temmuzboyraz3086
      @temmuzboyraz3086 Год назад

      Can you find anything about decibel measurement?

  • @TiagoodosSantos
    @TiagoodosSantos 4 года назад +1

    Thanks for the video. You are fucking good

  • @philliposnakas7314
    @philliposnakas7314 Год назад

    Hi, I have a question regarding how to bypass the constant "reset" hitting, as I want a quick update of frequencies due to a variety of notes that will be hit in a short amount of time, and I cant hit reset every time. Thank you.

    • @gaznevi
      @gaznevi Год назад

      Hey, did you find the answer?

    • @philliposnakas7314
      @philliposnakas7314 Год назад

      @@gaznevi Have not yet unfortunately, I think it is best to use Fast Fourier Transform and a different circuit using a better sound sensor.

  • @ArthurLnz
    @ArthurLnz 3 года назад +1

    Hello, I'm trying to use this code on ATMEL Studio, in a C code project. It seems that c code doesn't understands classes, do ou know how I can fix that ?
    Thank you for your video anyways !

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Hello Arthur,
      Thank you for asking. The code was not written with classes. If you need to use classes, you will have to code it to do so.
      CAL

    • @ArthurLnz
      @ArthurLnz 3 года назад

      @@CALettsomePhDPE thank you for your response. I mean the header file uses classes, not your code, so Atmel Studio can't compile your code in a C project . Do you know how I can fix this ?

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Thank you for asking. I do not off at this time. The code I wrote was specifically for the Arduino IDE. Sorry.

    • @ArthurLnz
      @ArthurLnz 3 года назад +1

      @@CALettsomePhDPE no worries, thank you for your answers anyway !

  • @albandaumer3441
    @albandaumer3441 3 года назад +1

    maybe you can use the tone function and a buzzer instead of the "device(s) that create(s) a known frequency" :)

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад +1

      That is possible but it is so much more interestng to use items that are more common.
      Please like, share, and subscribe.

    • @longdongsilver4719
      @longdongsilver4719 3 года назад

      No, because the tone function is not very accurate.

  • @creativitytools4576
    @creativitytools4576 3 года назад

    can a audio frequency dectector decotor dectect from a distance ?

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Hi,
      Thank you for asking. The sensitivity of the sensors used will be the main determinant.
      Please like, share and like.

  • @yassirbendrao2862
    @yassirbendrao2862 4 года назад

    hello please how can I get the amplitude from this code

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      Check the arduinofft library information (github.com/kosme/arduinoFFT). It may be available there.

  • @NikanKm
    @NikanKm 2 года назад

    The circuit schematics does not load for me anyone able to tell me why?

  • @jayantabanik2751
    @jayantabanik2751 3 года назад

    should we not do pinMode(0, INPUT); ?

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Hi Jayanta,
      Thank you for asking. If pin 0 is an input, it should be. Please go to my website for the code. If pin 0 needs to be an input, it is set in the code.

  • @yassirbendrao2862
    @yassirbendrao2862 4 года назад

    please after execution of FFT...... vreal will be signal amplitude

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      Check the arduinofft library information (github.com/kosme/arduinoFFT). It may be available there.

  • @aizuddinhasri8903
    @aizuddinhasri8903 3 года назад

    Hi Dr, i facing error when i want to open code download link, what can i do to solve this issue. The error was "there has been a critical error on this website."

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Hi Aizuddin,
      I responded to a message you sent me by email. I was working on the site at the time. Please try to download the file again and let me know if you are still having issues.

    • @aizuddinhasri8903
      @aizuddinhasri8903 3 года назад +1

      Thank you Dr...really appreciate your help and it's working really nice...heheheheh

  • @twashinilahi6823
    @twashinilahi6823 3 года назад

    Is the frequency measure in HZ

  • @amadeus.a
    @amadeus.a 3 года назад +1

    seems like your website is down?

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Hi Amadeus,
      It was down temporarily for short periods of time each day as I rework the look. Just look at note at the top to see what times it will be down.

  • @fisikaok5818
    @fisikaok5818 4 года назад +2

    Can i measure the frquency in real time?

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад +2

      Thanks for asking. The frequency cannot be determined instantaneously as the frequency is determined by a set of samples collected. However, the frequency can be determined after a sufficient amount of samples have been collected. You can loop the code so it can continuously sample signals if this is what you desire.
      Like, Share and Subscribe.

    • @fisikaok5818
      @fisikaok5818 4 года назад

      @@CALettsomePhDPE thank you sir to answer my quetion, too loop the code, which code should i add? thanks 🙏

    • @fisikaok5818
      @fisikaok5818 4 года назад

      if you wish, maybe you can send me the code to the following email: mafiaganjil18@gmail.com
      thank you very much

  • @JA-yy6bd
    @JA-yy6bd 3 года назад

    Can this detect gps tracker?

  • @madhavikennedy2225
    @madhavikennedy2225 Год назад

    I followed the video exactly but mine won't output the frequency? Did anyone else have this problem or does anyone know how to fix it?

  • @anonymoususer900
    @anonymoususer900 3 года назад +1

    Thanks a lot buddy. There are not many people making useful things on youtube. You are definitely not one of them

    • @CALettsomePhDPE
      @CALettsomePhDPE  3 года назад

      Thank you. If you like this project, you might like this one also: ruclips.net/video/2n_JiXvBwsw/видео.html
      Please like, share and subscribe.

  • @user-kl1wc2bg7b
    @user-kl1wc2bg7b 4 года назад +1

    Can you send me a fft code for my email?

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      Thanks for asking. Please use the following link and go to clydelettsome.com/blog/2019/12/18/my-weekend-proje…using-an-arduino/
      the "Obtain the arduinoFFT libarary" section of the page to see how to get the library.

    • @user-kl1wc2bg7b
      @user-kl1wc2bg7b 4 года назад +1

      @@CALettsomePhDPE What function should I use other than MajorPeak if I want to receive the data on a serial monitor every second?

    • @CALettsomePhDPE
      @CALettsomePhDPE  4 года назад

      @@user-kl1wc2bg7b I am not sure. I did not write the libarary. Here is where you can find more information about the arduinoFFT library. github.com/kosme/arduinoFFT