I generally focus more on digital electronics & logic, and as such, analog electronics is a little unfamiliar to me. But anyway, I’m trying to get my head around op amps for use in an upcoming project. What I am looking to do is to check a voltage against a reference voltage, and have the op amp supply a digital signal: high = input > reference. My application will then act on the rising / falling edge of this signal.
To begin with, I bought myself a pack of NJM4558L (Dual op amps in a SIL package)… Mostly because they all looked more of less the same to my untrained eye and I figured I’d get a start on something. I have it connected with V+ and V- connected to +5v and Gnd respectively. Input- is going to my reference voltage (which is 2.5v courtesy of a voltage divider) and Input+ is going to a variable resistor (set up as a voltage divider). It’s a simple breadboard setup so that I can play around with it and see how it behaves.
While the +Input is above the reference value, the Output is high (~4.5v to be exact). At the reference value, the signal gives a sharp falling edge, down to 1.4v (instead of 0v). Rising above the reference value gives a sharp rising edge, back to the 4.5v figure. That seems to work just fine, although the low value is a bit high.
However if the +Input gets below 800mV, the Output goes high, with a really sloppy edge. Bringing the +Input above this threshold brings the Output low again, with the same sloppy edge. This edge is proportional to the speed that the threshold is crossed - it looks analog.
Why is there a second threshold voltage that causes the output to reverse? Is this something common to op amps in general, or perhaps only this one?
Why is the “low” state of the op amp output at about 1.4v instead of 0v?
With the configuration you have, you are using the op-amp in open mode.
That means the gain of your circuit is in the 10s of thousands.
It is acting like a simple comparator, not a linear output amplifier.
This means your circuit may be tending to oscillate.
This may help you understand how to use op-amps.
Thanks for the link, I'll check it out.
Actually I want to have it act as a comparator. In a normal scenario, I would probably use an atmega's comparator for this. However the end project is based on an MCU that has built-in opamps and no comparators..
While playing with it, I changed it to have a negative feedback, and I could see it operating as an amplifier. That's something cool, and I'll tuck it away for the future.
Right, I haven't looked at the datasheet for the NJM4558L and frankly, I am not going to.
There are three really basic parameters of op-amps. They contain a circuit with various transistors and/ or FETs and there are many different designs. Note that transistors and FETs have switching thresholds.
First parameter: Allowable operating voltage range.
Second parameter: input voltage range. This is frequently or usually limited to a proportion of the operating voltage range but may extend to or even beyond either or both supply rails, so may be "rail to rail". You have discovered that yours is not "rail to rail"; beyond its specified (datasheet) input voltage range it no longer behaves as an op-amp!
Third parameter: You should have guessed it - output voltage range. Again, you have discovered this; it takes appropriate design and generally the use of FETs to achieve "rail to rail" output range.
Note that the earliest op-amps (709, 741 and even earlier; I forget!) expected dual power supplies of +/- 15 V or so, so the voltages they processed for you would have been a relatively small range either side of ground, perhaps 10 V each way. Such supply voltages are generally inconvenient, so later designs allowed lower voltages and the approach of working voltages (input and output) to most or all of the supply range. That's just design!
Thanks for the tip… Actually, now knowing what to look for, the supply voltage is ± 18v, and the input voltage is ± 15v. And where supply voltage <±18v, input voltage max = supply voltage. I didn’t see an output voltage specified.
So my take-away is that this isn’t rail to rail, and when I operate them as such, they behave unexpectedly.
My end project has rail to rail op amps built into the chip, so I might have a poke about for some discrete units to play with.
Google “comparator with hysteresis “ for further help
LM339 is the chip you want, a very cheap rail-to-rail 4-channel comparator with open-collector logic
outputs. Use with pin mode INPUT_PULLUP. This chip works at voltages from 3 to 36V, very flexible.
NJM4558 is an audio opamp designed for minimum of +/-6V supplies and is not a comparator. Using
an opamp as a comparator can lead to various issues (some opamps will fry if you attempt this, some
will not have a high enough output voltage to count as logic high, and of course some are not rail-to-rail).
The output voltage of an opamp that's not supplied from a 5V supply can fry your Ardiuno.
Thanks MarkT, that part looks like the ticket. I'll buy a couple and have a play.
About the NJM, at the time it was cheap and the SIL package made it convenient. I had no idea what I was looking at and no way of telling one from the other. None the less, I was half expecting some blown up parts, so I was testing with my scope.
But thanks to the guys here, I've gotten just enough knowledge to be dangerous
You also have the option of simulating the behavior of devices like op amps, comparators etc. etc. in software. A download of Ltspice is free. There is a bit of a learning curve but there are good introductory videos (Sparkfun etc.).