Best way to amplify an audio signal for PIC use

Thread Starter

Vaughanabe13

Joined May 4, 2009
102
Hello,

I am building a guitar tuner using a PIC18F452. My tuning algorithm works great, and can accurately tune notes when the input is a sine (or square) wave from a generator. The input wave needs to swing high enough so that the PIC can recognize it as logic level 1 on an input pin, and it also needs to swing low enough that the PIC can recognize logic level 0. Essentially I am implementing a Schmitt trigger in software and using TMR0 to count the time for one period and use a look-up table to compare to known values for notes.

Now the problem becomes, how do I actually get an audio signal from an instrument, say an electric guitar's pickup output, into the PIC and amplify the signal enough so the PIC will recognize logic levels? When I connect the pickup output from my guitar to a scope, the pk-pk is only about 50mV. What can I use to jack up the gain, keeping in mind that I don't care about distortion, clipping, or degradation of signal quality? All I need is to turn the guitar output into a sine/square wave that has a high enough amplitude for the PIC to read logic 1 and 0. At that point my algorithm will kick in and be able to measure the frequency.

Any ideas? I have been toying with rail-rail op-amps, NPN common emitter amplifiers, etc, but no luck so far. I am running off a +5V power supply.

Thanks, responses are very much appreciated! Let me know if more information is needed.
 
I see what you are trying to do!
Well if you are not worried whether the input to the PIC is a SINE wave or a square wave then you could use a very simple OP-AMP circuit.
Any op-amp would do. I dont know how to put a circuit up on this. If you know how I can draw it in 2 secs...
What is the Part no on the OP-AMP you are using?
 

Thread Starter

Vaughanabe13

Joined May 4, 2009
102
I picked up a rail-rail op amp (since I am dealing with a single source power supply) this morning. It's the Analog Devices AD623, and here is the data sheet:

http://www.analog.com/static/imported-files/data_sheets/AD623.pdf

The computer terminal I am working on does not have a circuit simulation program to wire up a schematic, so I have attached a quick drawing of how I wired it.




I'm currently getting nothing on the output, and I have no clue what is wrong with it. Any ideas?
 

Thread Starter

Vaughanabe13

Joined May 4, 2009
102
*Update*

I tried cranking up the input waveform and I get 0V output from the op-amp until the pk-pk of the waveform hits about 1.45V. Then it amplifies as it should and boosts the output close to the power source, around 4.5V. This doesn't help me because I need to boost a very low signal. How can I fix this?
 

DonQ

Joined May 6, 2009
321
The in- pin has no reference voltage so it is probably drifting to some voltage other than what you would think. Try just putting a large value resistor (like a 1 MΩ) between the in+ and in-. This will reference it at the same voltage that's provided by the voltage divider. It will probably work much better that way.
 

Thread Starter

Vaughanabe13

Joined May 4, 2009
102
Thanks for the suggestions. I decided to throw out that circuit in favor of an inverting op amp running from +- 5V, because I had to do a proof of concept demo today. However, I still want to get that circuit working so I will take your suggestions and see what I can get.

In the meantime, here is my proof-of-concept guitar tuner, where the middle board is the op amp circuit, the right board is mostly just for the 7 segment display, and the left board is my PIC development board. You may notice a bunch of diodes on the op amp output. This was a quick-fix signal clipper that I made from available diodes, but I'll redesign that later. I will eventually implement all of this in a single board but for now it works.

The tuner is accurate to about +-5 cents, and the error is due to integer rounding.

 
Top