Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Audio Frequency Detection

Status
Not open for further replies.

transistance

New Member
Im using a 16f877 PIC to drive an LCD screen which will display the frequency of a note played by a guitar - basically a guitar tuner.

I am having trouble with the frequency detection. There are couple ideas that I came up with:(after running the signal through LM386 with 20x gain)
1. Run the LM386 output through 74LS14 schmitt trigger (I have already tried this and i have miserably failed at getting output from schmitt trigger). Take output from 74LS14; time the pulse and detect frequency with 16f877.

2. Run the LM386 output through LM2917 frequency-to-voltage converter and use ADC module of 16f877. (Unfortunately, I am not familiar with this IC and have no clue how to convert audible frequencies into voltage; so any input is highly appreciated)

Which one is a more accurate method? Is there a better way to capture the frequency? Is there specific way to use 74LS14 that I am not aware of? Any schematics or C and R values to help me with LM2917 available?

Thanks in advance,
~transistance
 
For a start an LM386 is a really poor choice, it's a power amplifier, you need an opamp.

Next a guitar doesn't output a very pure frequency, so it's not easy to measure like that.

EPE did a PIC based one a number of years ago, they used filters controlled by the PIC in order to give a clearer signal to measure - it wasn't a really a trivial project.
 
I have seen a similar project where 74LS14 Schmitt Trigger gave out a very clear square wave signals at peak points of the guitar notes. I just connected the gained frequency to an input port and got the output from the corresponding pin. Im wondering if there are additional components used to filter out the signal. Unfortunately the project paper does not specify that part of the circuit.

**broken link removed**
 
Last edited:
transistance said:
I have seen a similar project where 74LS14 Schmitt Trigger gave out a very clear square wave signals at peak points of the guitar notes. I just connected the gained frequency to an input port and got the output from the corresponding pin. Im wondering if there are additional components used to filter out the signal. Unfortunately the project paper does not specify that part of the circuit.
**broken link removed**
Page 7 of the referenced paper shows two op amps configured to amplify and low-pass filter the output from the microphone. I believe signal V2 is the simulated microphone signal. U2A's output apparently goes to the Schmitt Trigger input.
 
Thans for pointing that out crutschow. I've just been skimming through a lot of papers lately and i missed that. So I see that there is a dual stage LM324 amplifier with low pass filter capacitors. According to the pictures on page 8, this is supposed to give out a clear square wave signal when passed through a schmitt trigger. But i googled the LM324 audio applications and read that the opamp causes heavy crossover distortion. Do you think that LM324 is still gonna be suitable for this project? Can LM741 be a good choice?
 
transistance said:
Thans for pointing that out crutschow. I've just been skimming through a lot of papers lately and i missed that. So I see that there is a dual stage LM324 amplifier with low pass filter capacitors. According to the pictures on page 8, this is supposed to give out a clear square wave signal when passed through a schmitt trigger. But i googled the LM324 audio applications and read that the opamp causes heavy crossover distortion. Do you think that LM324 is still gonna be suitable for this project? Can LM741 be a good choice?

Those are all antique low spec devices, something like the Texas TL07x or TL08x series will be many tmes better.
 
I built the dual stage amplifier with low pass filter using TL082. Is it normal to not get an audible output?
 
transistance said:
I built the dual stage amplifier with low pass filter using TL082. Is it normal to not get an audible output?

No, what you're looking for is a squarewave output of the fundamental input, this will be just as audible as the original, but highly distorted.
 
I'm using twisted pair wires for my sound input and outputs and still getting a constant 500 Hz noise that the above low pass filter is not filtering out. Could this be because I'm using an adapter to power my protoboard? should i switch to batteries?
 
transistance said:
I'm using twisted pair wires for my sound input and outputs and still getting a constant 500 Hz noise that the above low pass filter is not filtering out. Could this be because I'm using an adapter to power my protoboard? should i switch to batteries?

If your PSU is faulty, or completely useless, then swapping to batteries may well help.

But you might try posting your circuit, EXACTLY as you've built it, it's quite possible you've left out many vital components?.
 
The very simple circuit has a very simple lowpass filter.
If the guitar is played a little too loudly then its harmonics will trip the Schmitt-trigger, then the output frequency will be wrong.
If the guitar is played a little too softly then the Schmitt-trigger will not be triggered, then there will not be an output.

Unbalanced audio circuits like this one need shielded audio cables, not twisted pairs that are used for balanced telephones.

The schematic of the preamp and lowpsss filter from the little school kids has a few problems.
 

Attachments

  • lowpass filter fot guitar.PNG
    lowpass filter fot guitar.PNG
    70.2 KB · Views: 444
is there any suggestions that you got to improve this circuit? how can the low pass be built in a better way?
 
1. Use a OPA2134 operational amplifier for your low pass filter.
2. Use this 24db/octave low pass filter below
filter
**broken link removed**
3. Adjust the crossover point by changing the value of R.
4. Make a preamp before the low pass filter which will allow you to attentuate or amplify the audio signal from the guitar. Therefore, you will be able to detect the frequency correctly no matter how loud or softly you are playing the guitar.
 
1. Use a OPA2134 op amp to design your low pass filter.
2. Use the schematic below if you would like. It is a 24/dB low pass filter
3. Change your crossover point by changing the R values. All R values should be the same.
4. Here is the equation. R= 1/(2*pi*1.414*frequency*c)


c=100n
substitute the desired frequency in the equation to find the resulting R value.
**broken link removed**
 
Last edited:
Hi,
If I'm not mistaken you're cascading two sets of S&K with the Q factor of 0.7071 each, so the result will be Bessel response (Q factor of 0.5). So the roll off is not -24 dB/oct (-80 dB /dec) anymore. For 4th order Butterworth filter with -80 dB/dec roll off, it should be designed according to the polynormial:
(s2 + 0.7654s + 1)(s2 + 1.8478s + 1)
(from Wiki)
 
The resulting Bessel filter is down -6dB at the cutoff frequency. It eventually reaches 24dB/octave but its cutoff is not sharp.

This type of filter is used in a Linkwitz-Riley speaker crossover network because a highpass and a lowpass add together perfectly (unlike a Butterworth type).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top