My First Analog Input Circuit (/w op-amp)

Started by blbuford, January 26, 2011, 04:34:21 PM

Previous topic - Next topic

blbuford

Hello, I figured this would probably be the best forum to post this question since it deals with the signal while its still in its analog form. A little background--I'm trying to make a guitar looping station and I need the signal to be digital, so I can write code to work with it on my FPGA. I've never touched electrical circuitry before, and the "too long; didn't read" version is that after about a month of scouring the internet for information about circuits (among other things) and I came up with a schematic as a starting place.


IC's used: op-amp (IC1) is an AD8605; REF is a ADR433B; ADC is AD7683

To my defense, I know this thing looks horrible and wrong, but that is where my questions are.
1) Can 5V even split like that? I mean that my intuition says that it would be 1.25V going in each direction so that the total would equal 5V.
2) Is there a way to calculate exactly how many volts are coming out of the op-amp and feeding into the a/d converter? I ask because that is why that reference IC is there. By the two equations I was using ( Gain = 1 + R3/R4 and Vout = Gain*Vin + Vbias ), I figured that Vout was somewhere in the neighborhood of 2.96V and my Ref voltage for the a/d converter is 3V which seemed like a nice fit.
3) Finally, I don't have a clue about why the majority of the capacitors are there--I used them simply because the datasheet did on the REF and ADC. C3 and C2 were for a bandpass filter (15Hz - 22.7kHz) but as for the rest of them, I'm clueless. C1 apparently keeps DC current from going in the signal, or at least that's what I gather. Any ideas what C4-C7 are, and why they are needed?

Thoughts, criticisms, (mild) flames, things I missed, or other input? fire away.

Thanks,
-Brett

Taylor

#1
1), yeah, this is fine and how it's normally done. As long as your voltage is regulated (will probably be coming out of something like a 78L05) the voltage will remain steady regardless of the load (that is, how many things you have connected to it)
2) http://www.falstad.com/circuit/index.html    This lets you simulate your circuit easily and scope it in real time, so you can see the amplitude of your signal after your gain stage.
3) C4-C7 are power supply filtering. They remove ripple from your power supply, and in the case of C4 and C5 they should be right next to the ref and ADC chips, respectively, connected by the shortest trace possible.

PRR

> this thing looks horrible and wrong

Where?

There's things I might do different. Nothing horrible.



The 120K||137K or 64K input impedance is rather low for naked e-guitar.

I'm sure you want both ADC inputs at the same DC level. Not one at ADR433 voltage and one at 120:137 +/-10% of some roughly-5V supply.

Bias the opamp from ADR voltage. Use the same resistor as you have on the opamp's other input. Now there will be no static DC difference across the ADC inputs to waste available bits. And one less resistor.

The output of e-guitar can be under 20mV or over 200mV. Your gain of 101 implies levels to 20Vrms 60V peak-peak, which can't happen under a 5V rail. You could be digitizing ten times more distortion than signal. Gain structure from e-guitar will have to be try-and-see, but I bet you want gain of 10 or less. Increase R4 so opamp output sounds clean (or ADC is not throwing extreme values a lot).

The 7pFd cap is suspicious; stray capacitance may be larger. However it intends to limit bandwidth to 23KHz(?), which is far more than you want for e-guitar. Anything over 6KHz is likely to be hash, hiss, or just irritating. C2 may be bigger, like 20p. You "could" still have aliasing from supersonics, especially if FX pedals are in front. You may need a stronger filter topology for "best" results.

With the new large input resistance, C1 can be far smaller. 0.01uFd gives hi-fi response. even smaller may be fine: modern guitar tone often slopes-down the bottom octave. In part to reduce signal level at the bottom of the audio band to put more useful power in midrange, which may also be useful when going into a limited ADC.

I have no knowledge/opinion, but the AppNote says your C4 should be larger. Perhaps the difference is inaudible without sophisticated test gear, and AD is just butt-covering against over-fussy customers.

> C1 apparently keeps DC current from going in the signal,

The signal must swing BOTH ways but you only have one polarity power. The work-around is to DC bias the amplifier half-way between zero and 9V, then the audio can swing over 4V up and down from there. Or in this case, 5V rail and an existing ~~3V reference.

So we have 3V at opamp input but do NOT want 3V DC sneaking back to the guitar. At best, the gitar pot will be scratchy (minor pot glitches, times 3V, is big audible glitches). The standard workaround is a blocking cap which passes the desired higher frequencies (above 20Hz or 80Hz) but blocks lower frequencies and DC.

In pure analog we would have another cap so the opamp's DC does not upset or burn the next box's input. In this case you have a 0V-5C ADC, which to swing-both-ways again must bias-up to half-way, so the opamp's output DC is useful and essential.
  • SUPPORTER

blbuford

Taylor, thanks for that circuit simulator and the quick response. It's already found its self to be a fixture on my taskbar.

PRR, thanks for suggestions, although it think it raises more questions. Isn't the reference voltage on the ADC the max voltage that you expect your input to be then the adc creates a 16-bit number representing the voltage from GND to REF? I ran through the new numbers with your ideas for components on paper and through the simulator, and it seems that 3.71v are making it into the adc input. Is this bad since its above the reference, or is the reference supposed to be the midpoint?

Gurner

#4
The only AtoD'ing (verb?!)  I've done is with modest $2 PICs, so with that disclaimer in mind - to my eyes at least - something doesn't seem quite right here.

Firstly, let's tackle the easy bit first - as PRR says you've waaaaay to much gain *if* your incoming signal is a guitar. Depending on whether it's a humbucker or single coil pickup dictates the gain needed, but at 5V supply using rail to rail opamps (as you are), I work on an approximate gain of 10-15x, therefore try experimenting with R3 at around 100k to 150k.

Ok, the DC level sitting on your opamp input pin is about 2.67V (5V divided by R1 + R2 to give the current, then R2 x current to give the DC level at the junction) - this to me at least is a curious level. To get maximum headroom on both negative & positive swings of your incoming signal, I'd have said it would be better to bias the opamp input at 2.5V. Therefore I'd change R1 & R2 to 470k 1% tolerance. Your output of the opamp will then be 2.5V DC.

ok, now to Vref - I've no idea what's going on there - you're putting 3V into the ADC chip VRef pin - why? (I may be misinterpreting the Vref purpose) - Why not the full 5V?

I ask, becuase if I'm interpreting this right, any AC signal coming into the ADC sig in pin will be sitting on a DC level of 2.67V, which means the AC signal +ve swings will only have 0.33V of headroom before 'clipping' inside your ADC chip?

I put a question mark at the end of that, because like I say, I'm no ADC expert - but I'd have thought it would have been preferable to have your VREF at 5V, if you make the R1 & R2 changes I mentioned, this would give you ±2.5V for your AC signal to swing on a Dc level of 2.5V.

blbuford

Thanks Gunner, I think something short circuited in my head (if you'll pardon the pun), and I some how got stuck on the idea of doing a 3V maximum on the  output of the amp. I think now I'll take another look at it and try to adjust it up to 5V. First though, what kind of resistance is needed on guitar input circuit--like for biasing? I've seen circuits that bias with two 1 MOhm resistors, and some with a tenth of that. What kind of resistance is best for gain setting? I mean the math works either way so long as the ratio of resistance is correct. Is there a proper window of resistance for this type of application? PRR made mention of biasing of the ADC's reference voltage to avoid DC static difference; if I wanted to try biasing off the new 5V ref, I'd need a ton of resistance, right?

Gurner

#6
There are two main methods for biasing opamps .......the first is simple potential divider biasing (as you circuit has now)...ie two resistors set the DC voltage at the opamp input...what values to use...debateable. Personally, I wouldn't go below 470k each, some may prefer 1M apiece.

The other method is to source your bias DC voltage from a reference voltage (which is what PRR was suggesting - ie a regulator, a precision reference IC, etc) - if it's available, this IMHO this preferable. At the very least, it'll save you one resistor to bias up your opamp, but more importantly it ties everything to the same reference...and you can then use your reference voltage as a virtual ground.

You won't be able to bias off the new 5V ref as you mention   ...unless you use the two resistor potential divider method (by the way why do you need ianother 5V? You've already got 5V showing coming in to your circuit?) What you need if you wish to directly bias off a reference voltage is a reference voltage of 2.5V (for a 5V supply circuit)....not for the ADC but for the opamp.

Re gain setting -  I'm not sure there's that much in the way of rules (though one obvious general rule of thumb is the larger the resistor used, the more noise)  but personally, I prefer to keep the main resistor (R3 in your diagram) at 250k or less - but that's just a personal thing. Most resistance ratios will work...whatever you have to hand, but don't go too low or your opamp will baulk.

PRR

#7
> Isn't the reference voltage on the ADC the....

Yes, me bad, I didn't spend the time to note this is not an audio ADC or to see what new type input it uses.

As you are now thinking, nail Vref to +5V. You do not need a high precision Vref. You need VERY stable from instant to instant, and within 10% day to day. The +5V through 1K and 100uFd will be audio-solid; much less uFd will work if your +5V is not crappy. This point feeds ADC Vref pin and the bias network, nothing else.

Also SINAD improves some from 3V to 5V.

Since it is a unipolar ADC, we must bias the input halfway up Vref, at 2.5V. With no signal, the ADC will be outputing half-scale, 8000hex 32,768dec out of FFFFhex 65,536dec full scale.


This 2.5V is also a happy voltage to keep the opamp swinging both ways within zero V and 5V.

Now the peak analog input to the ADC is 2.5V. The peak signal off guitar is rarely over 0.5V. Opamp gain can be about 5 to ensure no-overload. If guitar is soft-strummed, levels might not beat 150mV and gain of 15 is acceptable.

There is no reason to use the very high value NFB gain-set resistors. R3=10K and R4=2K7 with C3 near 1uFd-2uFd will be fine. Or for high-gain, R4=680 and C3 like 5uFd.

To capture e-guitar clean the jack impedance should be over 150K. 470K or 1Meg are common. Two 1Meg resistors from clean 5V to zero will give a nice 500K and set the bias to 2.5V mid-scale.

FWIW: the MAXimum dynamic range of e-guitar could be greater than 16 bits. Input hiss much over 2mV can be noticed and hard-strums can be 500mV peak 350mVrms. This is near 100dB or 17 bits, and ideally you want to go a few bits into analog hiss because hiss is natural and bit-quantization "noise" is nasty. However 18-19 bits is awkward on 8/16-bit machines, and few "18 bit" DACs are both accurate and this small. 16 bits will be fine.
  • SUPPORTER