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.

Guitar Audio Filter For Frequency Detection

Status
Not open for further replies.
Is LM324 low noise though? The advantage is that this IC has no phase inversion, will there be a disadvantage when replacing it for the TL074?

hi t.
As 'agu' points out, the two opa's are pin compatable, it would be a simple test just to plug in the LM324 and try it.

If you don't, the TL074 is not going to get the job done anyway.:rolleyes:

Is the voltage divider R6/7 = 3K3 and 330uF ?
 
That is true, I was just wondering...

It's just kind of a hassle to go to the electronic bazaar in Istanbul after work. If you ever been here or have ever heard of it; we got major traffic issues.

Although, the cool thing is I don't have to order stuff online, it's a good time going to the electronic bazaar - a luxury I missed when I was in the States. I can post pictures of the place if anyone is interested (this forum seems to be too serious for that stuff sometimes). I don't know I like the place and I will go there today to get LM324 and the 3k3 resistors and 330uF capacitors.

So cheap too! The guys there now know me by name, they pretty much don't charge me for anything accept the ICs - which are less than a dollar a piece most of the time anyways!

So if there are other alternatives to LM324, let me know so I can get them as well while I am there today.

Is LF353 a good option as well?

Here is the latest version that I am going to build today - add replacing the opamps and new voltage divider setup.
 

Attachments

  • 20080823.jpg
    20080823.jpg
    77.9 KB · Views: 540
Last edited:
hi transistance, am a new member and saw your picture of guitar tuner.i have to do a project with this but am not sure where to start,could you point me in right direction?am studying electronics in england and half way though my two year course.charlie
 
hi transistance, am a new member and saw your picture of guitar tuner.i have to do a project with this but am not sure where to start,could you point me in right direction?am studying electronics in england and half way though my two year course.charlie

My project is still in testing/prototyping phase but you can see the latest circuitry (still a prototype) on the post above yours. Pretty self explanatory: [input] -> Preamp -> Low-Pass Filter -> High Pass Filter -> Peak Voltage Detector -> Voltage Comparator (90%) -> [square wave output] -> 16F877(frequency analysis)

If you read this thread from beginning to end you will find a lot of information on how the circuit was debugged and improved to this version. From the output of this circuit you should be able to get a squarewave with the same frequency as the fundamental of your musical input frequency. With this output I'm using a PIC 16F877 (timer and capture modules) programmed in PicBasic pro. The PIC is going to capture the time it takes for 200 rising edges and average them to get the period and calculate the frequency.

If you want more focused answers, please ask more specific questions.

good luck
 
Last edited:
The LM324 is too noisy to be a microphone preamp with a gain of 50. But its noise will not be noticed in your circuit that has a gain of only 10.
The LM324 is so noisy that it is not mentioned in its datasheet. It is probably the same as a lousy old 741 opamp which has about double or triple the noise of a TL074.

The LM324 has crossover distortion that also does not matter in your circuit.
The TL074 has very low distortion.

The bandwidth of the LM324 is low, to about 1kHz at full output and higher with less output swing. The bandwidth of your circuit is low so it doesn't matter.
The bandwidth of a TL074 is to 100kHz at full output.

There are hundreds of quad opamps that will work in your circuit. The older ones with FET inputs have the phase inversion problem when the input level is high.
 
LM324 with latest schematics:
Idle Vpp reduced to 0.1V

With Input Output Vpp still at 1.1V

At the instant of plucking i still get phase inversion..

I also bought some LF353 (only duals were left) I'm going to try with those as well.

I am now coding the PIC to wait 300 ms before actual capture which will eliminate the phase inversion imo. I'd still like to get the hardware done properly though.
 
Last edited:
The LM324 has phase inversion when an input voltage goes well below ground.
The LF353 is an older FET input opamp that has the same input circuit as the TL074, so I think it has the phase inversion problem.

Scope each stage to see if the input level is too high or if the gain of the first opamp is too high.
 
Scope each stage to see if the input level is too high or if the gain of the first opamp is too high.

The output of the preamp's Vpp is just 2.01V. Not high enough for a phase inversion, is it?

Would you say -1 V is well below ground?

I checked my filter outputs as well, they are as designed in unity gain.

The output of the peak detector can be found here. I am not sure when I say this but aren't there too many peaks here? I thought that the harmonics should have already been eliminated from the filters. Some of those looks like the harmonics and not the fundamental.
 

Attachments

  • PreAmpOutput.JPG
    PreAmpOutput.JPG
    119 KB · Views: 449
  • PeakDetectionOutput.JPG
    PeakDetectionOutput.JPG
    110.7 KB · Views: 577
Last edited:
It looks like your circuit or your sound card scope is clipping. The signal levels of each opamp should clip at 7.8V peak-to-peak if the input impedance of the sound card is high and the 9V battery is new. So the sensitivity of your scope is wrong.
Maybe your sound card is using a mic input but you are supposed to use a line input.

The output of the peak detector is at the connection of D1 and C7 but it looks like you measured the output of the peak detector opamp whose output goes close to ground between the positive peaks of each cycle of sound.
 
Simpler and Smaller Design Approach

Considering this image:

Couldn't I just use a Hi-Z preamp and a 95% comparator and feed it into the 16F877 ADC module and go on from there? It'd save me a lot of power, space and time too imho. After all, highest harmonic seems to be the second harmonic which is just an octave higher. This could be the reason I'm getting something that looks like a phase inversion (which exactly doubles the frequency I am expecting). When analyzing a ~82Hz signal, the second harmonic @ ~164 Hz will pass through the filters and comparator will allow it to pass since it has a high amplitude. By capturing the second harmonic and dividing it by half, i should be able to get the fundamental frequency really quickly even at lower clock speeds.

Jasper's AVR page has a similar but simpler scheme of a **broken link removed** with 1 preamp and 1 atmel controller programmed in C.
 
Last edited:
I don't think (hear?) that a guitar has its second harmonic higher than its fundamental frequency. But I looked in Google and found some guitar playing lessons that show how to play harmonics instead of the fundamental frequency.

I don't think the pickup of an electric guitar has a very low 3mV p-p level which is less than a microphone.

Here is a FET preamp that does not have phase inversion. It can drive the LM324 preamp. Its high output level might cause phase inversion if it drives a TL074.
 

Attachments

  • guitar preamp.PNG
    guitar preamp.PNG
    15.4 KB · Views: 1,547
I don't think (hear?) that a guitar has its second harmonic higher than its fundamental frequency. But I looked in Google and found some guitar playing lessons that show how to play harmonics instead of the fundamental frequency.

Playing harmonics is just a particular playing style, it's probably more common on basses though, and is often used for tuning them (it's easier to zero beat high notes than low notes). Jaco Pastorius, often considered the greatest bass player ever, made extensive use of this technique.
 
Ok... I took a break from my project for a few days to clear my mind about what to do. I'm planning to run some output and input amplitude tests for each stage of the circuit, see where the phase reversal begins.

Since everything except the first stage of the circuit is unity gain, I don't see any other stage contributing to the phase inversion. I am not sure how much gain this stage provides me with (I couldn't calculate it properly with my knowledge), but what i learned is that phase reversal will happen due to the input swinging out of the range of the opamp. Am I amplifying the signal too much on the first stage?

What's even weirder is that I am not getting enough Vpp as it is! Maybe I could decrease the gain on preamp and add in a power amp between the current 5 stages and the PIC.

I thought LM324 had phase reversal prevention btw, does it not?
 
Since everything except the first stage of the circuit is unity gain, I don't see any other stage contributing to the phase inversion.
Correct.

I am not sure how much gain this stage provides me with (I couldn't calculate it properly with my knowledge),
The gain is (R8/R9) + 1= 11.

but what i learned is that phase reversal will happen due to the input swinging out of the range of the opamp.
Correct.
The datasheet for the LM324 explains that the output will suddenly go high or low when its input voltage goes negative more than 0.3V.
The output from a guitar's pickup could be driving the input of the first opamp well below ground. If you add the FET preamp (that I posted) to the input then the input of the opamp will not go below ground and there will be no phase reversal.

Am I amplifying the signal too much on the first stage?
Probably, then the output of the first opamp will clip and produce many harmonics.

What's even weirder is that I am not getting enough Vpp as it is! Maybe I could decrease the gain on preamp and add in a power amp between the current 5 stages and the PIC.
I think something is wrong with your 'scope. A power amp is not needed since the input of a PIC is a high resistance load that is easily driven by an opamp. Maybe the input of your 'scope is a low input resistance mic input instead of a high input resistance line-level input.
 

Attachments

  • LM324.PNG
    LM324.PNG
    18.9 KB · Views: 376
Last edited:
The datasheet for the LM324 explains that the output will suddenly go high or low when its input voltage goes negative more than 0.3V.
This is meaning the input Vmax≤+0.3V Vmin≥-0.3V, right?
Assuming my guitar outputs 3mV; which you thought was too little, the first stage shouldn't have a phase reversal.
If I misread my voltmeter and the guitar output was 30mV, the first stage still won't have a large enough input to have phase reversal; yet 30mV×11= 0.33V will cause a phase reversal on the 2nd stage.

The output from a guitar's pickup could be driving the input of the first opamp well below ground. If you add the FET preamp (that I posted) to the input then the input of the opamp will not go below ground and there will be no phase reversal.

What if I changed R5 value to 3MΩ, would that help? Can't I redesign the opamp based preamp for a higher input impedance like that?

If I was to build the FET preamp you suggested, will that be replacing the current first stage(the preamp)?

I think something is wrong with your 'scope. A power amp is not needed since the input of a PIC is a high resistance load that is easily driven by an opamp. Maybe the input of your 'scope is a low input resistance mic input instead of a high input resistance line-level input.

Is the reason behind using Hi-Z inputs for audio applications prevent clipping?

I had mentioned this before; I was using my laptop's mic input for scope.Maybe I should switch to my desktop and use the line input? :)

I'm guessing that this could be my problem.. **broken link removed** My next laptop is going to be an apple...
 
Last edited:
Is the reason behind using Hi-Z inputs for audio applications prevent clipping?

No, it's for feeding the rare hi-impedance connections to - basically the only one these days are passive guitars, these need 500K upwards.

I had mentioned this before; I was using my laptop's mic input for scope.Maybe I should switch to my desktop and use the line input? :)

Yes, the mic input is pretty crappy.
 
It is the mic input of your sound card that is clipping at about 2V peak-to-peak.
The Zeitnitz Oscilloscope instructios say the input voltage range of a sound card is 1.4V peak-to-peak!!! They say if you want to see a higher voltage then an input voltage divider is needed.
A loud mic level is about 10mV RMS and a loud line level input is about 300mV RMS.

You need to know the exact input resistance and impedance of the sound card to make an accurate voltage divider.

The software oscilloscope and sound card have an AC input, not DC so you won't know when a signal goes negative.

Your voltmeter can measure sine-waves (not music) accurately only at 50hz and 60Hz.

The designer of the FET preamp I posted limits its gain to only 1.4 times because he knows that a guitar can produce a few volts of signal.

The input voltage range of an LM324 is -0.3V to 32V. If an input goes to a voltage more negative than 0.3V then phase reversal will occur. If an input goes to a voltage more positive than 1.5V less than the positive supply then that input will not function.

The output of the first opamp will clip at +0.1V and +7.8V so the other opamps will not have phase reversal.

The value of R5 is 1M. Increasing it to 3M won't make any difference.
If you use the FET preamp then the first opamp is still needed to provide a low impedance drive to the lowpass filter. The gain of the first opamp should be decreased since the FET has a gain of 1.4 times.
 
I can't find the J201 N-channel JFET locally, can I build the circuit with 2n3904 NPN BJT and get the same results?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top