Probe effects on opamp circuit - Page 1
Forum section: electronics / beginners

author: PfhorSlayer
author_rank: Contributor
timestamp: July 19, 2020, 01:15:53 am
content: Hi all! I'm getting started learning about analog circuits and giving a go at building effects pedals for my bass guitar, and I've gotten stuck trying to understand the behavior of (what should be) a very simple opamp circuit, and how its behavior changes when I probe it.The intention of the circuit is to take an input signal, remove any DC bias, then add a fixed DC bias back onto it and compare the biased signal to the reference DC voltage. I would expect that the output of the opamp should slam back and forth between the positive rail and ground as the signal becomes greater and less than the reference DC bias point.When simulated, the circuit behaves exactly as expected. When breadboarded, it does not, and furthermore, it behaves differently when I probe various points. Obviously I've entered the realm of "non-ideal" behavior, but I don't understand what I need to do to resolve the issues and get things working as I intend for them to.The input signal from my bass guitar is (according to the oscilloscope) quite small, less than 100mV peak to peak when I smack the strings rather forcefully. The following is my understanding of what is supposed to be going on here:C1 in the circuit removes any existing DC bias from the signal, providing a signal oscillating about the ground voltage.R2 and R3 at the bottom of the circuit create a voltage divider, providing +4.5V to the non-inverting input of the opamp and biasing the input signal through R4 so it now oscillates about +4.5V, rather than about 0V.The opamp (LM358, in this case) is powered by the +9V and GND rails. It compares the the oscillating input signal with the constant +4.5V: if the input is less than +4.5V, it outputs +9V; if greater, it outputs 0V. Basically turning an input sine-ish wave into a square wave.Now here's what actually happens:If I use the cheap $10 signal gen kit I've got to create a sine wave as input, and probe only the output, I see the expected result. The opamp outputs a square wave. If I probe the inverting input, however, the opamp outputs a constant +9V no matter what the input does. If I attach my bass and do the same thing, I get what looks like occasional spiking up to the 9V rail if I strike the strings forcefully. Just letting a single note ring out does not produce a square wave (regardless of me probing the inverting input or not).Why does probing the inverting input change the output? I assume it has something to do with the capacitance of the probe - if I switch between 1X and 10X, the result changes slightly - but how do I protect against it? I also have a feeling that part of the reason things aren't working when the bass is being used as the input is that its signal is too small to consistently oscillate about the voltage on the non-inverting input of the opamp; that is, it's oscillating, but it's oscillating about a voltage slightly below the +4.5V it should be, so the comparison between it and the +4.5V on the non-inverting input usually results in a 0V output.What am I missing here? Any advice or corrections to my understanding (or lack thereof...) would be greatly appreciated!

author: Ian.M
author_rank: Super Contributor
timestamp: July 19, 2020, 04:19:54 am
content: The scope's input,from the point of view of the cable feeding it 'looks' like a small capacitor in parallel with a 1 Meg resistor to ground. The input capacitance of the scope is typically in the 20pF to 30pF range.A x1 probe will add up to 50pF of cable capacitance and stray capacitance in the probe. A x10 probe adds 9Meg in series for an input impedance of 10Meg in parallel with a considerably smaller capacitor (not ten times smaller due to the adjustable padding capacitor it includes in parallel with the scope input, used for probe compensation, and the stray capacitance from the tip to the shield).Therefore re-simulate your circuit with a 1Meg resistor and 70pF capacitor from -in to ground, to simulate the probe loading if you were using a x1 probe. You'll find the voltage on -in is half that on +in and you'd need at least a 5V pk-pk signal for the output toggle. If you were using a x10 probe, sim as 10Meg to ground in parallel with 15pF. That pulls -in down by 1/11 of the voltage on +in, or a bit less than 0.23V. Any input signal under 455 mV pk-pk wont toggle the output.You'll just have to trust the DC voltage on -in is what it should be as you can't probe it without disturbing it. OTOH if you want to check the AC signal there, do so with a low leakage 100nF capacitor in series with the probe tip. It will charge up so its no longer significantly disturbing the DC level in under six seconds for the x10 probe or about one second for the x1 probe.

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 19, 2020, 05:00:26 am
content: you opamp is open loop. no feedback from output to either + or - input. thats bad. even if you put 1Mohm feedback, thats still bad (highly unstable esp with passive probe whose impedance can go down to as low as only few ohms at some frequency), please use 100Kohm at most in your circuit if you cant afford lower resistance such as 1K or 10Kohm.

author: Ian.M
author_rank: Super Contributor
timestamp: July 19, 2020, 05:23:00 am
content: Another issue is input bias currents. If you are using a bipolar OPAMP, it needs an absolutely minuscule but non-negligible input current to bias the base of each input transistor. That current has to flow through the external resistors and results in a small voltage drop across them that can be significant if they are very high resistance, so if you want both inputs at near enough the same voltage, and because you are using the OPAMP as a comparator, you haven't got any negative feedback so it cant self-compensate, you should therefore add a 1Meg resistor between the divider and +in to match the one feeding the -in. Put the decoupling cap at the +in not the divider tap.

author: PfhorSlayer
author_rank: Contributor
timestamp: July 19, 2020, 05:42:26 am
content: Thanks for the info! So I've added the suggested 1M resistor and 70pF cap to ground to the schematic and simulated it again, but it does not seem to have changed the behavior at all.I'm also simulating it with a 10mV sine wave there, definitely much smaller than the 5V peak-to-peak suggested, and the output is still oscillating between the positive rail and ground, as desired.I checked the voltage on the negative input using a DMM with and without the probe connected, and it absolutely does change the result quite drastically. With the probe connected, I measure 4.59V between the positive input and ground, and 2.205V between the negative and ground. Without it, I see 4.70V between the positive input and ground, and 4.30V between the negative and ground. An ideal opamp should draw no current at its inputs, which I understand to mean that there would be absolutely no voltage drop across the 1M resistor I have basically bridging the two inputs. In the simulation, that seems to be the case - the voltage at the negative input is the voltage at the positive input, plus the AC signal.So on the breadboard, without the probe connected, I measure a 0.4V difference between ground and the two inputs. Measuring directly across the 1M resistor, I see ~15mV voltage drop. I guess the non-ideal, real-life opamp I'm using does draw some current through its inputs, and thus creates a voltage drop across the resistors in series with those inputs?It feels to me like I need to modify the value of the 1M resistor between the 4.5V reference and the negative input, such that the very tiny signal I'm passing into the negative input is significantly greater than the voltage drop across it. Is this the right way to fix this? Or am I completely misunderstanding something here?Thanks!D'oh! Two more replies while I was writing this, so I'll respond to those as well!The goal here is not to make a "good" circuit, it's to understand the behavior and how to resolve issues that will come up when making "good" circuits. I'm not too worried right now about it having no feedback - that'll be the next step, after I understand how it behaves as a comparator!The info about the bias currents makes a lot of sense. Adding a second 1M for the positive input does indeed make it behave much more like I would expect! I just grabbed two random 1M resistors I had lying around, and after measuring them realized that while they're in spec, they're nowhere near each other in terms of actual value. I assume if I were using much more closely matched resistors, the behavior would be even closer to "ideal."What is the reasoning behind moving the decoupling cap to the positive input?

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 19, 2020, 06:01:18 am
content: Quote from: PfhorSlayer on July 19, 2020, 05:42:26 amyou didnt mention it as comparator, i assume bass pedal effect is somesort of linear operation, high gain maybe, with some distortion or a bit of non-linearity. as a comparator (large difference between inputs) your circuit should work. but wait until you meet cheap jelly bean like TL071 (phase-reversal effect) or the more expensive model that will burn itself when differential inputs goes beyond 0.3V. low level behaviors such as current bias or voltage offset as Ian described is circuit specific, to understand it you have to go deep down to understanding its schematics. you can tune your circuit until you satisfy, but wait until you go mass production or change opamp number. inevitably trying to understand that need some basic and love in arithmetics.. such as...https://en.wikipedia.org/wiki/Operational_amplifierhttp://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htmand then there's noise that no one has able to understand and control precisely, as you simply put...Quote from: PfhorSlayer on July 19, 2020, 01:15:53 amprobably soon you'll realize trying to tune bias and offset in open loop setting will be a losing battle as this will change rapidly based on opamp/components used and how much flux residue left on the board or at what temperature. ymmv fwiw.