Page 643 - 3-2
P. 643

The Goertzel algorithm is long standing so see
            http://en.wikipedia.org/wiki/Goertzel_algorithm for a full description.
            It is often used in DTMF tone detection as an alternative to the Fast
            Fourier Transform because it is quick with low overheard because it
            is only searching for a single frequency rather than showing the
            occurrence of all frequencies.


            If what you really want is DTMF tone detection see el_supremo's fork of
            this library at http://forum.arduino.cc/index.php/topic,121540.0.html


            To use, you'll want a microphone not unlike this electret from Sparkfun
            https://www.sparkfun.com/products/9964 with AVD plugged to A0, VCC to 5V, and GND to GND


            See Contributors.md and add yourself for pull requests
            Released into the public domain.
            */
            #include <Goertzel.h>


            int sensorPin = A0;
            int led = 13;


            // ideally an integer of SAMPLING_FREQUENCY/N to center the bins around your content so if
            you're
            // looking for 700hz, frequencies below and above it equally contribute. Read up on Kevin's
            article
            // for more info.
            // Nyquist says the highest frequency we can target is SAMPLING_FREQUENCY/2
            const float TARGET_FREQUENCY = 1241; //      원하는 주파수
            // 내가 원하는 500~600     의 주파수 대역을 맞추기 위해 오실로스코프를 통해 측정을 하였고
            // 가장 적합한 값을 선택하여 적용하였다.
            // if you're trying to detect several different drum hits all within low frequency like
            // ~100-200hz you'll need a small bin size like 25 or 50 to distinguish them.
            // If however you're just trying to find ANY bass hit you might want something
            // basically equal to frequency youre looking for like ~100


            // If Im detecting a frequency much higher with no care about nearby tones, like 2000hz
            // Ill set to a round divisor like 200 So 1900 to 2100 could trigger, but not less or more
            // Max is 200 as we have limited ram in the Arduino, and sampling longer would make us less
            // responsive anyway
            const int N = 100;


            // This is what will trigger the led. Its INCREDIBLY squishy based on volume of your source,
            // frequency, etc. You'll just need to get in your environment and look at the serial console
            // to start. Then pick something that triggers pleasantly to your eye.
            const float THRESHOLD = 74180;


                                                         - 643 -
   638   639   640   641   642   643   644   645   646   647   648