• VaughnJ1 commented on amandaghassaei's instructable Arduino Frequency Detection3 weeks ago
    Arduino Frequency Detection

    It's possible to do this with just the circuit and code.I am using a variation of this sketch to read the output of a guitar pickup and display the string's frequency and intonation (an adjustment that corrects harmonics).Since we are using instruments; we do have to consider some adverse effects of harmonics/overtones. I have included a Low Pass Filter ( 4.7K and 6.8uF - canning everything above 5kHz.) You'll want a filter that allows your highest note to come through - assuming you don't overblow or play using harmonics.Double your highest playable note, then convert it to a frequency - insert an if statement to not display everything above it.http://www.phy.mtu.edu/~suits/etvsmean.htmlChange the code to divide any sampled frequency to a fundamental listed.A 10uF coupling capacitor did not work well with this circuit for my intended application. A value of 4.7uF instead allowed me to have a quite fluid readout in my terminal display. I have also removed the 47nF capacitor to ground. All it did was hold onto my sample for too long and prevent accurate/reliable readings.I am in the process of writing a header for musical computations which includes FHT/FFT algorithms - but all you'll need to do is use your preferred method of identifying and dealing with different number values.double noteFrequency = 440; // Concert 'A' - 440 hzdouble deviation = 4; // nobody's perfectdouble hiRange, loRange;hiRange = noteFrequency + deviation;loRange = noteFrequency - deviation;if(frequency >= loRange && frequency <= hiRange){// We have detected roughly an 'A - 440hz" do something}Expand this as you will but it's a basic start.Thanks for an excellent instructable Amanda!

    See post above.

    View Instructable »